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

Method default

mypy/join.py:668–687  ·  view source on GitHub ↗
(self, typ: Type)

Source from the content-addressed store, hash-verified

666 assert False, f"This should be never called, got {t}"
667
668 def default(self, typ: Type) -> ProperType:
669 typ = get_proper_type(typ)
670 if isinstance(typ, Instance):
671 return object_from_instance(typ)
672 elif isinstance(typ, TypeType):
673 return self.default(typ.item)
674 elif isinstance(typ, UnboundType):
675 return AnyType(TypeOfAny.special_form)
676 elif isinstance(typ, TupleType):
677 return self.default(mypy.typeops.tuple_fallback(typ))
678 elif isinstance(typ, TypedDictType):
679 return self.default(typ.fallback)
680 elif isinstance(typ, FunctionLike):
681 return self.default(typ.fallback)
682 elif isinstance(typ, TypeVarType):
683 return self.default(typ.upper_bound)
684 elif isinstance(typ, ParamSpecType):
685 return self.default(typ.upper_bound)
686 else:
687 return AnyType(TypeOfAny.special_form)
688
689
690def is_better(t: Type, s: Type) -> bool:

Callers 7

visit_type_varMethod · 0.95
visit_param_specMethod · 0.95
visit_type_var_tupleMethod · 0.95
visit_parametersMethod · 0.95
visit_instanceMethod · 0.95
visit_typeddict_typeMethod · 0.95
visit_type_typeMethod · 0.95

Calls 4

get_proper_typeFunction · 0.90
AnyTypeClass · 0.90
isinstanceFunction · 0.85
object_from_instanceFunction · 0.85

Tested by

no test coverage detected