Skip to content

Commit 78706b6

Browse files
authored
Move an import to avoid cyclic imports (#13809)
This should help people who need to `import mypy.reports` directly, see #13396 (comment)
1 parent dc5c299 commit 78706b6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

mypy/maptype.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from __future__ import annotations
22

3-
import mypy.typeops
43
from mypy.expandtype import expand_type
54
from mypy.nodes import TypeInfo
65
from mypy.types import AnyType, Instance, TupleType, Type, TypeOfAny, TypeVarId, has_type_vars
@@ -29,6 +28,9 @@ def map_instance_to_supertype(instance: Instance, superclass: TypeInfo) -> Insta
2928
env = instance_to_type_environment(instance)
3029
tuple_type = expand_type(instance.type.tuple_type, env)
3130
if isinstance(tuple_type, TupleType):
31+
# Make the import here to avoid cyclic imports.
32+
import mypy.typeops
33+
3234
return mypy.typeops.tuple_fallback(tuple_type)
3335

3436
if not superclass.type_vars:

0 commit comments

Comments
 (0)