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

Method mark_incomplete

mypy/semanal.py:7334–7368  ·  view source on GitHub ↗

Mark a definition as incomplete (and defer current analysis target). Also potentially mark the current namespace as incomplete. Args: name: The name that we weren't able to define (or '*' if the name is unknown) node: The node that refers to the name (defini

(
        self,
        name: str,
        node: Node,
        becomes_typeinfo: bool = False,
        module_public: bool = True,
        module_hidden: bool = False,
    )

Source from the content-addressed store, hash-verified

7332 self.num_incomplete_refs += 1
7333
7334 def mark_incomplete(
7335 self,
7336 name: str,
7337 node: Node,
7338 becomes_typeinfo: bool = False,
7339 module_public: bool = True,
7340 module_hidden: bool = False,
7341 ) -> None:
7342 """Mark a definition as incomplete (and defer current analysis target).
7343
7344 Also potentially mark the current namespace as incomplete.
7345
7346 Args:
7347 name: The name that we weren't able to define (or '*' if the name is unknown)
7348 node: The node that refers to the name (definition or lvalue)
7349 becomes_typeinfo: Pass this to PlaceholderNode (used by special forms like
7350 named tuples that will create TypeInfos).
7351 """
7352 self.defer(node)
7353 if name == "*":
7354 self.incomplete = True
7355 elif not self.is_global_or_nonlocal(name):
7356 fullname = self.qualified_name(name)
7357 assert self.statement
7358 placeholder = PlaceholderNode(
7359 fullname, node, self.statement.line, becomes_typeinfo=becomes_typeinfo
7360 )
7361 self.add_symbol(
7362 name,
7363 placeholder,
7364 module_public=module_public,
7365 module_hidden=module_hidden,
7366 context=dummy_context(),
7367 )
7368 self.missing_names[-1].add(name)
7369
7370 def is_incomplete_namespace(self, fullname: str) -> bool:
7371 """Is a module or class namespace potentially missing some definitions?

Callers 13

create_aliasMethod · 0.95
visit_class_defMethod · 0.95
analyze_classMethod · 0.95
visit_import_allMethod · 0.95
visit_assignment_stmtMethod · 0.95

Calls 7

deferMethod · 0.95
is_global_or_nonlocalMethod · 0.95
qualified_nameMethod · 0.95
add_symbolMethod · 0.95
PlaceholderNodeClass · 0.90
dummy_contextFunction · 0.85
addMethod · 0.45

Tested by

no test coverage detected