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

Method process_typealias

mypy/stubgen.py:1205–1215  ·  view source on GitHub ↗
(
        self, lvalue: NameExpr, rvalue: Expression, is_explicit_type_alias: bool = False
    )

Source from the content-addressed store, hash-verified

1203 return False
1204
1205 def process_typealias(
1206 self, lvalue: NameExpr, rvalue: Expression, is_explicit_type_alias: bool = False
1207 ) -> None:
1208 p = AliasPrinter(self)
1209 if is_explicit_type_alias:
1210 self.import_tracker.require_name("TypeAlias")
1211 self.add(f"{self._indent}{lvalue.name}: TypeAlias = {rvalue.accept(p)}\n")
1212 else:
1213 self.add(f"{self._indent}{lvalue.name} = {rvalue.accept(p)}\n")
1214 self.record_name(lvalue.name)
1215 self._vars[-1].append(lvalue.name)
1216
1217 def visit_type_alias_stmt(self, o: TypeAliasStmt) -> None:
1218 """Type aliases defined with the `type` keyword (PEP 695)."""

Callers 1

visit_assignment_stmtMethod · 0.95

Calls 6

AliasPrinterClass · 0.85
require_nameMethod · 0.80
record_nameMethod · 0.80
appendMethod · 0.80
addMethod · 0.45
acceptMethod · 0.45

Tested by

no test coverage detected