class ConfigFile(ConfigDict):
Constructors: ConfigFile.from_file(f, config_dir, included_paths, include_depth, ...), ConfigFile.from_path(path, max_include_depth, file_opener, condition_matchers), ConfigFile(values, encoding)
A Git configuration file, like .git/config or ~/.gitconfig.
| Class Method | from |
Read configuration from a file-like object. |
| Class Method | from |
Read configuration from a file on disk. |
| Method | __init__ |
Initialize a ConfigFile. |
| Method | write |
Write configuration to a file-like object. |
| Method | write |
Write configuration to a file on disk. |
| Instance Variable | path |
Undocumented |
| Method | _evaluate |
Evaluate a hasconfig condition. |
| Method | _evaluate |
Evaluate an includeIf condition. |
| Method | _handle |
Handle include/includeIf directives during config parsing. |
| Method | _match |
Match a config value against a hasconfig pattern. |
| Method | _merge |
Merge another config file into this one. |
| Method | _process |
Process an include or includeIf directive. |
| Method | _resolve |
Resolve an include path to an absolute path. |
| Instance Variable | _included |
Undocumented |
Inherited from ConfigDict:
| Method | __delitem__ |
Delete a configuration section. |
| Method | __eq__ |
Check equality with another ConfigDict. |
| Method | __getitem__ |
Get configuration values for a section. |
| Method | __iter__ |
Iterate over configuration sections. |
| Method | __len__ |
Return the number of sections. |
| Method | __repr__ |
Return string representation of ConfigDict. |
| Method | __setitem__ |
Set configuration values for a section. |
| Method | add |
Add a value to a configuration setting, creating a multivar if needed. |
| Method | get |
Get a configuration value. |
| Method | get |
Get multiple values for a configuration setting. |
| Method | items |
Get items in a section. |
| Method | keys |
Return a view of section names. |
| Method | remove |
Remove a configuration setting. |
| Method | sections |
Get all sections. |
| Method | set |
Set a configuration value. |
| Instance Variable | encoding |
Undocumented |
| Class Method | _parse |
Undocumented |
| Method | _check |
Undocumented |
| Instance Variable | _values |
Undocumented |
Inherited from Config (via ConfigDict):
| Method | get |
Retrieve a configuration setting as boolean. |
| Method | has |
Check if a specified section exists. |
IO[ bytes], *, config_dir: str | None = None, included_paths: set[ str] | None = None, include_depth: int = 0, max_include_depth: int = DEFAULT_MAX_INCLUDE_DEPTH, file_opener: FileOpener | None = None, condition_matchers: Mapping[ str, ConditionMatcher] | None = None) -> ConfigFile:
¶
Read configuration from a file-like object.
| Parameters | |
f:IO[ | File-like object to read from |
configstr | None | Directory containing the config file (for relative includes) |
includedset[ | Set of already included paths (to prevent cycles) |
includeint | Current include depth (to prevent infinite recursion) |
maxint | Maximum allowed include depth |
fileFileOpener | None | Optional callback to open included files |
conditionMapping[ | Optional dict of condition matchers for includeIf |
| Returns | |
ConfigFile | Undocumented |
str | os.PathLike[ str], *, max_include_depth: int = DEFAULT_MAX_INCLUDE_DEPTH, file_opener: FileOpener | None = None, condition_matchers: Mapping[ str, ConditionMatcher] | None = None) -> ConfigFile:
¶
Read configuration from a file on disk.
| Parameters | |
path:str | os.PathLike[ | Path to the configuration file |
maxint | Maximum allowed include depth |
fileFileOpener | None | Optional callback to open included files |
conditionMapping[ | Optional dict of condition matchers for includeIf |
| Returns | |
ConfigFile | Undocumented |
MutableMapping[ Section, CaseInsensitiveOrderedMultiDict[ Name, Value]] | None = None, encoding: str | None = None):
¶
dulwich.config.ConfigDict.__init__Initialize a ConfigFile.
| Parameters | |
values:MutableMapping[ | Optional mapping of configuration values |
encoding:str | None | Optional encoding for the file (defaults to system encoding) |
Evaluate a hasconfig condition.
Format: hasconfig:config.key:pattern Example: hasconfig:remote.*.url:ssh://org-@github.com/*
str, config_dir: str | None = None, condition_matchers: Mapping[ str, ConditionMatcher] | None = None) -> bool:
¶
Evaluate an includeIf condition.
Section | None, setting: bytes, value: bytes, *, config_dir: str | None, include_depth: int, max_include_depth: int, file_opener: FileOpener | None, condition_matchers: Mapping[ str, ConditionMatcher] | None):
¶
Handle include/includeIf directives during config parsing.
Section, path_value: bytes, *, config_dir: str | None, include_depth: int, max_include_depth: int, file_opener: FileOpener | None, condition_matchers: Mapping[ str, ConditionMatcher] | None):
¶
Process an include or includeIf directive.