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

Method checkers_for_star

mypy/checkstrformat.py:900–916  ·  view source on GitHub ↗

Returns a tuple of check functions that check whether, respectively, a node or a type is compatible with a star in a conversion specifier.

(self, context: Context)

Source from the content-addressed store, hash-verified

898 return checkers
899
900 def checkers_for_star(self, context: Context) -> Checkers:
901 """Returns a tuple of check functions that check whether, respectively,
902 a node or a type is compatible with a star in a conversion specifier.
903 """
904 expected = self.named_type("builtins.int")
905
906 def check_type(type: Type) -> bool:
907 expected = self.named_type("builtins.int")
908 return self.chk.check_subtype(
909 type, expected, context, "* wants int", code=codes.STRING_FORMATTING
910 )
911
912 def check_expr(expr: Expression) -> None:
913 type = self.accept(expr, expected)
914 check_type(type)
915
916 return check_expr, check_type
917
918 def check_placeholder_type(self, typ: Type, expected_type: Type, context: Context) -> bool:
919 return self.chk.check_subtype(

Callers 1

replacement_checkersMethod · 0.95

Calls 1

named_typeMethod · 0.95

Tested by

no test coverage detected