class documentation

class ConfigDict(Config):

Known subclasses: dulwich.config.ConfigFile

Constructor: ConfigDict(values, encoding)

View In Hierarchy

Git configuration stored in a dictionary.

Method __delitem__ Delete a configuration section.
Method __eq__ Check equality with another ConfigDict.
Method __getitem__ Get configuration values for a section.
Method __init__ Create a new ConfigDict.
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_multivar 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_setting Undocumented
Method _check_section_and_name Undocumented
Instance Variable _values Undocumented

Inherited from Config:

Method get_boolean Retrieve a configuration setting as boolean.
Method has_section Check if a specified section exists.
def __delitem__(self, key: Section):

Delete a configuration section.

Raises
KeyErrorIf section not found
def __eq__(self, other: object) -> bool:

Check equality with another ConfigDict.

def __getitem__(self, key: Section) -> CaseInsensitiveOrderedMultiDict[Name, Value]:

Get configuration values for a section.

Raises
KeyErrorIf section not found
def __init__(self, values: MutableMapping[Section, CaseInsensitiveOrderedMultiDict[Name, Value]] | None = None, encoding: str | None = None):

Create a new ConfigDict.

def __iter__(self) -> Iterator[Section]:

Iterate over configuration sections.

def __len__(self) -> int:

Return the number of sections.

def __repr__(self) -> str:

Return string representation of ConfigDict.

def __setitem__(self, key: Section, value: CaseInsensitiveOrderedMultiDict[Name, Value]):

Set configuration values for a section.

def add(self, section: SectionLike, name: NameLike, value: ValueLike | bool):

Add a value to a configuration setting, creating a multivar if needed.

def get(self, section: SectionLike, name: NameLike) -> Value:

Get a configuration value.

Parameters
section:SectionLikeSection name
name:NameLikeSetting name
Returns
ValueConfiguration value
Raises
KeyErrorif the value is not set
def get_multivar(self, section: SectionLike, name: NameLike) -> Iterator[Value]:

Get multiple values for a configuration setting.

Parameters
section:SectionLikeSection name
name:NameLikeSetting name
Returns
Iterator[Value]Iterator of configuration values
def items(self, section: SectionLike) -> Iterator[tuple[Name, Value]]:

Get items in a section.

def keys(self) -> KeysView[Section]:

Return a view of section names.

def remove(self, section: SectionLike, name: NameLike):

Remove a configuration setting.

Parameters
section:SectionLikeSection name
name:NameLikeSetting name
Raises
KeyErrorIf the section or name doesn't exist
def sections(self) -> Iterator[Section]:

Get all sections.

def set(self, section: SectionLike, name: NameLike, value: ValueLike | bool):

Set a configuration value.

Parameters
section:SectionLikeSection name
name:NameLikeSetting name
value:ValueLike | boolConfiguration value
encoding =

Undocumented

def _parse_setting(cls, name: str) -> tuple[str, str | None, str]:

Undocumented

def _check_section_and_name(self, section: SectionLike, name: NameLike) -> tuple[Section, Name]:

Undocumented