1111    Annotated ,
1212    Any ,
1313    ForwardRef ,
14-     Optional ,
1514    TypeVar ,
16-     Union ,
1715    cast ,
1816    get_args ,
1917    get_origin ,
@@ -61,14 +59,14 @@ class StrawberryAnnotation:
6159
6260    def  __init__ (
6361        self ,
64-         annotation : Union [ object ,  str ] ,
62+         annotation : object   |   str ,
6563        * ,
66-         namespace : Optional [ dict [str , Any ]]  =  None ,
64+         namespace : dict [str , Any ]  |   None  =  None ,
6765    ) ->  None :
6866        self .raw_annotation  =  annotation 
6967        self .namespace  =  namespace 
7068
71-         self .__resolve_cache__ : Optional [ Union [ StrawberryType ,  type ]]  =  None 
69+         self .__resolve_cache__ : StrawberryType   |   type   |   None  =  None 
7270
7371    def  __eq__ (self , other : object ) ->  bool :
7472        if  not  isinstance (other , StrawberryAnnotation ):
@@ -81,8 +79,8 @@ def __hash__(self) -> int:
8179
8280    @staticmethod  
8381    def  from_annotation (
84-         annotation : object , namespace : Optional [ dict [str , Any ]]  =  None 
85-     ) ->  Optional [ StrawberryAnnotation ] :
82+         annotation : object , namespace : dict [str , Any ]  |   None  =  None 
83+     ) ->  StrawberryAnnotation   |   None :
8684        if  annotation  is  None :
8785            return  None 
8886
@@ -91,7 +89,7 @@ def from_annotation(
9189        return  annotation 
9290
9391    @property  
94-     def  annotation (self ) ->  Union [ object ,  str ] :
92+     def  annotation (self ) ->  object   |   str :
9593        """Return evaluated type on success or fallback to raw (string) annotation.""" 
9694        try :
9795            return  self .evaluate ()
@@ -101,7 +99,7 @@ def annotation(self) -> Union[object, str]:
10199            return  self .raw_annotation 
102100
103101    @annotation .setter  
104-     def  annotation (self , value : Union [ object ,  str ] ) ->  None :
102+     def  annotation (self , value : object   |   str ) ->  None :
105103        self .raw_annotation  =  value 
106104
107105        self .__resolve_cache__  =  None 
@@ -131,8 +129,8 @@ def _get_type_with_args(
131129    def  resolve (
132130        self ,
133131        * ,
134-         type_definition : Optional [ StrawberryObjectDefinition ]  =  None ,
135-     ) ->  Union [ StrawberryType ,  type ] :
132+         type_definition : StrawberryObjectDefinition   |   None  =  None ,
133+     ) ->  StrawberryType   |   type :
136134        """Return resolved (transformed) annotation.""" 
137135        if  (resolved  :=  self .__resolve_cache__ ) is  None :
138136            resolved  =  self ._resolve ()
@@ -161,11 +159,11 @@ def resolve(
161159
162160        return  resolved 
163161
164-     def  _resolve (self ) ->  Union [ StrawberryType ,  type ] :
162+     def  _resolve (self ) ->  StrawberryType   |   type :
165163        evaled_type  =  cast ("Any" , self .evaluate ())
166164        return  self ._resolve_evaled_type (evaled_type )
167165
168-     def  _resolve_evaled_type (self , evaled_type : Any ) ->  Union [ StrawberryType ,  type ] :
166+     def  _resolve_evaled_type (self , evaled_type : Any ) ->  StrawberryType   |   type :
169167        if  is_private (evaled_type ):
170168            return  evaled_type 
171169
@@ -247,7 +245,7 @@ def create_optional(self, evaled_type: Any) -> StrawberryOptional:
247245        # passed as we can safely use `Union` for both optional types 
248246        # (e.g. `Optional[str]`) and optional unions (e.g. 
249247        # `Optional[Union[TypeA, TypeB]]`) 
250-         child_type  =  Union [ non_optional_types ]   # type: ignore 
248+         child_type  =  non_optional_types   # type: ignore 
251249
252250        of_type  =  StrawberryAnnotation (
253251            annotation = child_type ,
@@ -324,7 +322,7 @@ def _is_enum(cls, annotation: Any) -> bool:
324322        return  issubclass (annotation , Enum )
325323
326324    @classmethod  
327-     def  _is_type_generic (cls , type_ : Union [ StrawberryType ,  type ] ) ->  bool :
325+     def  _is_type_generic (cls , type_ : StrawberryType   |   type ) ->  bool :
328326        """Returns True if `resolver_type` is generic else False.""" 
329327        from  strawberry .types .base  import  StrawberryType 
330328
0 commit comments