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

Method make_normalized

mypy/types.py:3531–3545  ·  view source on GitHub ↗
(
        item: Type, *, line: int = -1, column: int = -1, is_type_form: bool = False
    )

Source from the content-addressed store, hash-verified

3529
3530 @staticmethod
3531 def make_normalized(
3532 item: Type, *, line: int = -1, column: int = -1, is_type_form: bool = False
3533 ) -> ProperType:
3534 item = get_proper_type(item)
3535 if is_type_form:
3536 # Don't convert TypeForm[X | Y] to (TypeForm[X] | TypeForm[Y])
3537 pass
3538 else:
3539 if isinstance(item, UnionType):
3540 return UnionType.make_union(
3541 [TypeType.make_normalized(union_item) for union_item in item.items],
3542 line=line,
3543 column=column,
3544 )
3545 return TypeType(item, line=line, column=column, is_type_form=is_type_form) # type: ignore[arg-type]
3546
3547 def accept(self, visitor: TypeVisitor[T]) -> T:
3548 return visitor.visit_type_type(self)

Callers 15

convert_to_typetypeFunction · 0.80
check_self_argFunction · 0.80
check_callable_callMethod · 0.80
visit_type_form_exprMethod · 0.80
acceptMethod · 0.80
erase_to_boundFunction · 0.80
callable_typeFunction · 0.80
class_typeMethod · 0.80

Calls 4

get_proper_typeFunction · 0.85
isinstanceFunction · 0.85
TypeTypeClass · 0.85
make_unionMethod · 0.80

Tested by 1

test_type_typeMethod · 0.64