src/nitpick/plugins/ini.py
def compare_different_keys(self, section, key, raw_actual: Any, raw_expected: Any) -> Iterator[Fuss]:
        """Compare different keys, with special treatment when they are lists or numeric."""
        if isinstance(raw_actual, (int, float, bool)) or isinstance(raw_expected, (int, float, bool)):
            # A boolean "True" or "true" has the same effect on ConfigParser files.
            actual = str(raw_actual).lower()
            expected = str(raw_expected).lower()
        else:
            actual = raw_actual
            expected = raw_expected
        if actual == expected:
            return

        if self.fix:
            self.updater[section][key].value = expected
            self.dirty = True
        if section == TOP_SECTION:
            yield self.reporter.make_fuss(
                Violations.TOP_SECTION_HAS_DIFFERENT_VALUE,
                f"{key} = {raw_expected}",
                key=key,
                actual=raw_actual,
                fixed=self.fix,
            )
        else:
            yield self.reporter.make_fuss(
                Violations.OPTION_HAS_DIFFERENT_VALUE,
                f"[{section}]\n{key} = {raw_expected}",
                section=section,
                key=key,
                actual=raw_actual,
                fixed=self.fix,
            )
Compare different keys, with special treatment when they are lists or numeric.
Compare different keys, with special treatment when they are lists or numeric.
Compare different keys with special treatment when they are lists or numeric .
def compare_different_keys(self, section, key, raw_actual: Any, raw_expected: Any) -> Iterator[Fuss]:
        if isinstance(raw_actual, (int, float, bool)) or isinstance(raw_expected, (int, float, bool)):
            actual = str(raw_actual).lower()
            expected = str(raw_expected).lower()
        else:
            actual = raw_actual
            expected = raw_expected
        if actual == expected:
            return
        if self.fix:
            self.updater[section][key].value = expected
            self.dirty = True
        if section == TOP_SECTION:
            yield self.reporter.make_fuss(
                Violations.TOP_SECTION_HAS_DIFFERENT_VALUE,
                f"{key} = {raw_expected}",
                key=key,
                actual=raw_actual,
                fixed=self.fix,
            )
        else:
            yield self.reporter.make_fuss(
                Violations.OPTION_HAS_DIFFERENT_VALUE,
                f"[{section}]\n{key} = {raw_expected}",
                section=section,
                key=key,
                actual=raw_actual,
                fixed=self.fix,
            )
def compare_different_keys ( self , section , key , raw_actual : Any , raw_expected : Any ) -> Iterator [ Fuss ] : if isinstance ( raw_actual , ( int , float , bool ) ) or isinstance ( raw_expected , ( int , float , bool ) ) : actual = str ( raw_actual ) . lower ( ) expected = str ( raw_expected ) . lower ( ) else : actual = raw_actual expected = raw_expected if actual == expected : return if self . fix : self . updater [ section ] [ key ] . value = expected self . dirty = True if section == TOP_SECTION : yield self . reporter . make_fuss ( Violations . TOP_SECTION_HAS_DIFFERENT_VALUE , f"{key} = {raw_expected}" , key = key , actual = raw_actual , fixed = self . fix , ) else : yield self . reporter . make_fuss ( Violations . OPTION_HAS_DIFFERENT_VALUE , f"[{section}]\n{key} = {raw_expected}" , section = section , key = key , actual = raw_actual , fixed = self . fix , )
Compare different keys, with special treatment when they are lists or numeric.
Compare different keys with special treatment when they are lists or numeric .
"""Compare different keys, with special treatment when they are lists or numeric.""" # A boolean "True" or "true" has the same effect on ConfigParser files.
self
section
key
raw_actual
Any
raw_expected
Any