commit 818a94283c3a0ab54fc2592cbe54600ac902db1c from: David Hotham date: Thu Jun 30 17:54:28 2022 UTC tidying up the boolean config change commit - fddeca05f88e0ebc397a2122bfa3c1eb77ca38a2 commit + 818a94283c3a0ab54fc2592cbe54600ac902db1c blob - 81feb78ee5f3402d748c351071d28da3886741c9 blob + 19f540e69893a800afb90122765f0e02d003faf1 --- dulwich/client.py +++ dulwich/client.py @@ -2285,7 +2285,6 @@ def iter_instead_of(config: Config, push: bool = False except KeyError: pass for needle in needles: - assert isinstance(needle, bytes) yield needle.decode('utf-8'), replacement.decode('utf-8') blob - d9dac555bef8dd3f0597019a1921987700f8b34b blob + e52d468e3bc66f6fa295218061a2656e207ac800 --- dulwich/config.py +++ dulwich/config.py @@ -199,8 +199,6 @@ class Config(object): value = self.get(section, name) except KeyError: return default - if isinstance(value, bool): - return value if value.lower() == b"true": return True elif value.lower() == b"false": @@ -401,7 +399,7 @@ class ConfigDict(Config, MutableMapping[Section, Mutab return self._values.keys() -def _format_string(value): +def _format_string(value: bytes) -> bytes: if ( value.startswith(b" ") or value.startswith(b"\t") @@ -618,12 +616,7 @@ class ConfigFile(ConfigDict): else: f.write(b"[" + section_name + b' "' + subsection_name + b'"]\n') for key, value in values.items(): - if value is True: - value = b"true" - elif value is False: - value = b"false" - else: - value = _format_string(value) + value = _format_string(value) f.write(b"\t" + key + b" = " + value + b"\n")