MCPcopy
hub / github.com/python/mypy / missing_classvar_callable_note

Method missing_classvar_callable_note

mypy/checkexpr.py:2564–2576  ·  view source on GitHub ↗
(
        self, object_type: Type, callable_name: str, context: Context
    )

Source from the content-addressed store, hash-verified

2562 return ok, is_unexpected_arg_error
2563
2564 def missing_classvar_callable_note(
2565 self, object_type: Type, callable_name: str, context: Context
2566 ) -> None:
2567 if isinstance(object_type, ProperType) and isinstance(object_type, Instance):
2568 _, var_name = callable_name.rsplit(".", maxsplit=1)
2569 node = object_type.type.get(var_name)
2570 if node is not None and isinstance(node.node, Var):
2571 if not node.node.is_inferred and not node.node.is_classvar:
2572 self.msg.note(
2573 f'"{var_name}" is considered instance variable,'
2574 " to make it class variable use ClassVar[...]",
2575 context,
2576 )
2577
2578 def check_var_args_kwargs(
2579 self, arg_types: list[Type], arg_kinds: list[ArgKind], context: Context

Callers 1

check_argument_countMethod · 0.95

Calls 4

isinstanceFunction · 0.85
rsplitMethod · 0.80
getMethod · 0.45
noteMethod · 0.45

Tested by

no test coverage detected