@@ -35,7 +35,7 @@ def is_special_form(t: Any, form: Any) -> bool:
3535 Returns:
3636 True if t is the special form or a generic alias with that origin
3737 """
38- return t is form or (is_generic_alias (t ) and get_origin (t ) is form ) # type: ignore [comparison-overlap]
38+ return t is form or (is_generic_alias (t ) and get_origin (t ) is form )
3939
4040
4141def is_generic_alias (t : Any ) -> TypeGuard [GenericAlias ]:
@@ -44,7 +44,7 @@ def is_generic_alias(t: Any) -> TypeGuard[GenericAlias]:
4444
4545def is_valid_type_arg (t : Any ) -> bool :
4646 return isinstance (t , type ) or (
47- is_generic_alias (t ) and get_origin (t ) is not Unpack # type: ignore [comparison-overlap]
47+ is_generic_alias (t ) and get_origin (t ) is not Unpack
4848 )
4949
5050
@@ -84,7 +84,7 @@ def is_type_var_or_tuple(t: Any) -> bool:
8484def is_type_var_tuple_unpack (t : Any ) -> TypeGuard [GenericAlias ]:
8585 return (
8686 is_generic_alias (t )
87- and get_origin (t ) is Unpack # type: ignore [comparison-overlap]
87+ and get_origin (t ) is Unpack
8888 and is_type_var_tuple (get_args (t )[0 ])
8989 )
9090
@@ -98,7 +98,7 @@ def is_generic_type_alias(t: Any) -> TypeGuard[GenericAlias]:
9898
9999
100100def is_annotated (t : Any ) -> TypeGuard [Annotated [Any , ...]]:
101- return is_generic_alias (t ) and get_origin (t ) is Annotated # type: ignore [comparison-overlap]
101+ return is_generic_alias (t ) and get_origin (t ) is Annotated
102102
103103
104104def is_forward_ref (t : Any ) -> TypeGuard [ForwardRef ]:
@@ -121,9 +121,8 @@ def contains_forward_refs(t: Any) -> bool:
121121
122122
123123def is_union_type (t : Any ) -> TypeGuard [UnionType ]:
124- return (
125- (is_generic_alias (t ) and get_origin (t ) is Union ) # type: ignore [comparison-overlap]
126- or isinstance (t , UnionType )
124+ return (is_generic_alias (t ) and get_origin (t ) is Union ) or isinstance (
125+ t , UnionType
127126 )
128127
129128
@@ -132,7 +131,7 @@ def is_optional_type(t: Any) -> TypeGuard[UnionType]:
132131
133132
134133def is_literal (t : Any ) -> bool :
135- return is_generic_alias (t ) and get_origin (t ) is Literal # type: ignore [comparison-overlap]
134+ return is_generic_alias (t ) and get_origin (t ) is Literal
136135
137136
138137def get_head (t : Any ) -> type | None :
0 commit comments