Skip to content

Commit 4e80ab5

Browse files
Fix circular import: remove import from mypy.suggestions and inline ReturnTypeFinder
1 parent 3586c99 commit 4e80ab5

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

mypy/checker.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1602,11 +1602,12 @@ def check_func_def(
16021602

16031603
# Infer return type from return statements if function has no explicit return type annotation
16041604
if isinstance(item, FuncDef) and isinstance(typ, CallableType):
1605+
16051606
def is_unannotated_any(t: Type) -> bool:
16061607
if not isinstance(t, ProperType):
16071608
return False
16081609
return isinstance(t, AnyType) and t.type_of_any == TypeOfAny.unannotated
1609-
1610+
16101611
ret_type_proper = get_proper_type(typ.ret_type)
16111612
# Only infer for functions without explicit return type annotations
16121613
# Skip generators and coroutines as they have special return type handling
@@ -1636,7 +1637,7 @@ def visit_func_def(self, o: FuncDef) -> None:
16361637
finder = ReturnTypeFinder(self._type_maps[0])
16371638
item.body.accept(finder)
16381639
return_types_list = finder.return_types
1639-
1640+
16401641
if return_types_list:
16411642
# Create union of all return types
16421643
inferred_ret_type = make_simplified_union(return_types_list)

0 commit comments

Comments
 (0)