@@ -2830,18 +2830,18 @@ def flatten_types(t: Type) -> List[Type]:
2830
2830
def get_isinstance_type (expr : Expression , type_map : Dict [Expression , Type ]) -> List [TypeRange ]:
2831
2831
all_types = flatten_types (type_map [expr ])
2832
2832
types = [] # type: List[TypeRange]
2833
- for type in all_types :
2834
- if isinstance (type , FunctionLike ) and type .is_type_obj ():
2833
+ for typ in all_types :
2834
+ if isinstance (typ , FunctionLike ) and typ .is_type_obj ():
2835
2835
# Type variables may be present -- erase them, which is the best
2836
2836
# we can do (outside disallowing them here).
2837
- type = erase_typevars (type .items ()[0 ].ret_type )
2838
- types .append (TypeRange (type , is_upper_bound = False ))
2839
- elif isinstance (type , TypeType ):
2837
+ typ = erase_typevars (typ .items ()[0 ].ret_type )
2838
+ types .append (TypeRange (typ , is_upper_bound = False ))
2839
+ elif isinstance (typ , TypeType ):
2840
2840
# Type[A] means "any type that is a subtype of A" rather than "precisely type A"
2841
2841
# we indicate this by setting is_upper_bound flag
2842
- types .append (TypeRange (type .item , is_upper_bound = True ))
2843
- elif isinstance (type , Instance ) and type .type .fullname () == 'builtins.type' :
2844
- object_type = Instance (type .type .mro [- 1 ], [])
2842
+ types .append (TypeRange (typ .item , is_upper_bound = True ))
2843
+ elif isinstance (typ , Instance ) and typ .type .fullname () == 'builtins.type' :
2844
+ object_type = Instance (typ .type .mro [- 1 ], [])
2845
2845
types .append (TypeRange (object_type , is_upper_bound = True ))
2846
2846
else : # we didn't see an actual type, but rather a variable whose value is unknown to us
2847
2847
return None
@@ -2992,17 +2992,17 @@ def is_more_precise_signature(t: CallableType, s: CallableType) -> bool:
2992
2992
return is_more_precise (t .ret_type , s .ret_type )
2993
2993
2994
2994
2995
- def infer_operator_assignment_method (type : Type , operator : str ) -> Tuple [bool , str ]:
2995
+ def infer_operator_assignment_method (typ : Type , operator : str ) -> Tuple [bool , str ]:
2996
2996
"""Determine if operator assignment on given value type is in-place, and the method name.
2997
2997
2998
2998
For example, if operator is '+', return (True, '__iadd__') or (False, '__add__')
2999
2999
depending on which method is supported by the type.
3000
3000
"""
3001
3001
method = nodes .op_methods [operator ]
3002
- if isinstance (type , Instance ):
3002
+ if isinstance (typ , Instance ):
3003
3003
if operator in nodes .ops_with_inplace_method :
3004
3004
inplace_method = '__i' + method [2 :]
3005
- if type .type .has_readable_member (inplace_method ):
3005
+ if typ .type .has_readable_member (inplace_method ):
3006
3006
return True , inplace_method
3007
3007
return False , method
3008
3008
0 commit comments