class documentation

A Git configuration.

Method get Retrieve the contents of a configuration setting.
Method get_boolean Retrieve a configuration setting as boolean.
Method get_multivar Retrieve the contents of a multivar configuration setting.
Method has_section Check if a specified section exists.
Method items Iterate over the configuration pairs for a specific section.
Method sections Iterate over the sections.
Method set Set a configuration value.
def get(self, section: SectionLike, name: NameLike) -> Value:

Retrieve the contents of a configuration setting.

Parameters
section:SectionLikeTuple with section name and optional subsection name
name:NameLikeVariable name
Returns
ValueContents of the setting
Raises
KeyErrorif the value is not set
def get_boolean(self, section: SectionLike, name: NameLike, default: bool) -> bool:
def get_boolean(self, section: SectionLike, name: NameLike) -> bool | None:

Retrieve a configuration setting as boolean.

Parameters
section:SectionLikeTuple with section name and optional subsection name
name:NameLikeName of the setting, including section and possible subsection.
default:bool | NoneDefault value if setting is not found
Returns
bool | NoneContents of the setting
def get_multivar(self, section: SectionLike, name: NameLike) -> Iterator[Value]:

Retrieve the contents of a multivar configuration setting.

Parameters
section:SectionLikeTuple with section name and optional subsection namee
name:NameLikeVariable name
Returns
Iterator[Value]Contents of the setting as iterable
Raises
KeyErrorif the value is not set
def has_section(self, name: Section) -> bool:

Check if a specified section exists.

Parameters
name:SectionName of section to check for
Returns
boolboolean indicating whether the section exists
def items(self, section: SectionLike) -> Iterator[tuple[Name, Value]]:

Iterate over the configuration pairs for a specific section.

Parameters
section:SectionLikeTuple with section name and optional subsection namee
Returns
Iterator[tuple[Name, Value]]Iterator over (name, value) pairs
def sections(self) -> Iterator[Section]:

Iterate over the sections.

Returns: Iterator over section tuples

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

Set a configuration value.

Parameters
section:SectionLikeTuple with section name and optional subsection namee
name:NameLikeName of the configuration value, including section and optional subsection
value:ValueLike | boolvalue of the setting