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

Method optional_type

mypy/treetransform.py:795–799  ·  view source on GitHub ↗
(self, type: Type | None)

Source from the content-addressed store, hash-verified

793 return type
794
795 def optional_type(self, type: Type | None) -> Type | None:
796 if type:
797 return self.type(type)
798 else:
799 return None
800
801 def types(self, types: list[Type]) -> list[Type]:
802 return [self.type(type) for type in types]

Callers 10

visit_func_defMethod · 0.95
visit_lambda_exprMethod · 0.95
visit_varMethod · 0.95
duplicate_assignmentMethod · 0.95
visit_for_stmtMethod · 0.95
visit_with_stmtMethod · 0.95
visit_op_exprMethod · 0.95
visit_comparison_exprMethod · 0.95
visit_unary_exprMethod · 0.95

Calls 1

typeMethod · 0.95

Tested by

no test coverage detected