MCPcopy Index your code
hub / github.com/python/mypy / analyze_conversion_specifiers

Method analyze_conversion_specifiers

mypy/checkstrformat.py:697–712  ·  view source on GitHub ↗
(
        self, specifiers: list[ConversionSpecifier], context: Context
    )

Source from the content-addressed store, hash-verified

695 assert False
696
697 def analyze_conversion_specifiers(
698 self, specifiers: list[ConversionSpecifier], context: Context
699 ) -> bool | None:
700 has_star = any(specifier.has_star() for specifier in specifiers)
701 has_key = any(specifier.has_key() for specifier in specifiers)
702 all_have_keys = all(
703 specifier.has_key() or specifier.conv_type == "%" for specifier in specifiers
704 )
705
706 if has_key and has_star:
707 self.msg.string_interpolation_with_star_and_key(context)
708 return None
709 if has_key and not all_have_keys:
710 self.msg.string_interpolation_mixing_key_and_non_keys(context)
711 return None
712 return has_key
713
714 def check_simple_str_interpolation(
715 self,

Callers 1

Calls 6

anyFunction · 0.85
allFunction · 0.85
has_starMethod · 0.80
has_keyMethod · 0.80

Tested by

no test coverage detected