File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -831,16 +831,18 @@ def prepare_global_scope(module):
831831 # type annotations in class bodies are stored as strings rather than evaluated eagerly.
832832 # Without this, `SomeProxiedType | None` in a field annotation would call `__or__` on
833833 # the `_LazyImportProxy` at class-construction time and raise TypeError.
834- has_future_annotations = any (
835- any (alias .name == "annotations" for alias in node .names )
836- for node in future_imports
837- )
834+ has_future_annotations = any (any (alias .name == "annotations" for alias in node .names ) for node in future_imports )
838835 if not has_future_annotations :
839- future_imports .insert (0 , ast .fix_missing_locations (ast .ImportFrom (
840- module = "__future__" ,
841- names = [ast .alias (name = "annotations" )],
842- level = 0 ,
843- )))
836+ future_imports .insert (
837+ 0 ,
838+ ast .fix_missing_locations (
839+ ast .ImportFrom (
840+ module = "__future__" ,
841+ names = [ast .alias (name = "annotations" )],
842+ level = 0 ,
843+ )
844+ ),
845+ )
844846
845847 if definitions or future_imports :
846848 combined_module = ast .Module (body = future_imports + definitions , type_ignores = [])
You can’t perform that action at this time.
0 commit comments