Let us walk on the 3-isogeny graph
Loading...
Searching...
No Matches
pip._internal.configuration Namespace Reference

Data Structures

class  Configuration
 

Functions

str _normalize_name (str name)
 
List[str] _disassemble_key (str name)
 
Dict[Kind, List[str]] get_configuration_files ()
 

Variables

 RawConfigParser = configparser.RawConfigParser
 
 Kind = NewType("Kind", str)
 
str CONFIG_BASENAME = "pip.ini" if WINDOWS else "pip.conf"
 
str ENV_NAMES_IGNORED = "version", "help"
 
 kinds
 
 OVERRIDE_ORDER = kinds.GLOBAL, kinds.USER, kinds.SITE, kinds.ENV, kinds.ENV_VAR
 
 VALID_LOAD_ONLY = kinds.USER, kinds.GLOBAL, kinds.SITE
 
 logger = getLogger(__name__)
 

Detailed Description

Configuration management setup

Some terminology:
- name
  As written in config files.
- value
  Value associated with a name
- key
  Name combined with it's section (section.name)
- variant
  A single word describing where the configuration key-value pair came from

Function Documentation

◆ _disassemble_key()

List[str] _disassemble_key ( str  name)
protected

Definition at line 58 of file configuration.py.

58def _disassemble_key(name: str) -> List[str]:
59 if "." not in name:
60 error_message = (
61 "Key does not contain dot separated section and key. "
62 "Perhaps you wanted to use 'global.{}' instead?"
63 ).format(name)
64 raise ConfigurationError(error_message)
65 return name.split(".", 1)
66
67
for i

References i.

Referenced by Configuration.get_value(), Configuration.set_value(), and Configuration.unset_value().

Here is the caller graph for this function:

◆ _normalize_name()

str _normalize_name ( str  name)
protected
Make a name consistent regardless of source (environment or file)

Definition at line 50 of file configuration.py.

50def _normalize_name(name: str) -> str:
51 """Make a name consistent regardless of source (environment or file)"""
52 name = name.lower().replace("_", "-")
53 if name.startswith("--"):
54 name = name[2:] # only prefer long opts
55 return name
56
57

References i.

Referenced by Configuration._normalized_keys(), Configuration.get_value(), Configuration.set_value(), and Configuration.unset_value().

Here is the caller graph for this function:

◆ get_configuration_files()

Dict[Kind, List[str]] get_configuration_files ( )

Definition at line 68 of file configuration.py.

68def get_configuration_files() -> Dict[Kind, List[str]]:
69 global_config_files = [
70 os.path.join(path, CONFIG_BASENAME) for path in appdirs.site_config_dirs("pip")
71 ]
72
73 site_config_file = os.path.join(sys.prefix, CONFIG_BASENAME)
74 legacy_config_file = os.path.join(
76 "pip" if WINDOWS else ".pip",
77 CONFIG_BASENAME,
78 )
79 new_config_file = os.path.join(appdirs.user_config_dir("pip"), CONFIG_BASENAME)
80 return {
81 kinds.GLOBAL: global_config_files,
82 kinds.SITE: [site_config_file],
83 kinds.USER: [legacy_config_file, new_config_file],
84 }
85
86

References i.

Referenced by Configuration.iter_config_files().

Here is the caller graph for this function:

Variable Documentation

◆ CONFIG_BASENAME

str CONFIG_BASENAME = "pip.ini" if WINDOWS else "pip.conf"

Definition at line 32 of file configuration.py.

◆ ENV_NAMES_IGNORED

str ENV_NAMES_IGNORED = "version", "help"

Definition at line 33 of file configuration.py.

◆ Kind

Kind = NewType("Kind", str)

Definition at line 30 of file configuration.py.

◆ kinds

kinds
Initial value:
1= enum(
2 USER="user", # User Specific
3 GLOBAL="global", # System Wide
4 SITE="site", # [Virtual] Environment Specific
5 ENV="env", # from PIP_CONFIG_FILE
6 ENV_VAR="env-var", # from Environment Variables
7)

Definition at line 36 of file configuration.py.

◆ logger

logger = getLogger(__name__)

Definition at line 46 of file configuration.py.

◆ OVERRIDE_ORDER

OVERRIDE_ORDER = kinds.GLOBAL, kinds.USER, kinds.SITE, kinds.ENV, kinds.ENV_VAR

Definition at line 43 of file configuration.py.

◆ RawConfigParser

RawConfigParser = configparser.RawConfigParser

Definition at line 29 of file configuration.py.

◆ VALID_LOAD_ONLY

VALID_LOAD_ONLY = kinds.USER, kinds.GLOBAL, kinds.SITE

Definition at line 44 of file configuration.py.