Skip to content

Commit a260b79

Browse files
committed
Rename type into typ
1 parent f94ca45 commit a260b79

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

mypy/checker.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2830,18 +2830,18 @@ def flatten_types(t: Type) -> List[Type]:
28302830
def get_isinstance_type(expr: Expression, type_map: Dict[Expression, Type]) -> List[TypeRange]:
28312831
all_types = flatten_types(type_map[expr])
28322832
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():
28352835
# Type variables may be present -- erase them, which is the best
28362836
# 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):
28402840
# Type[A] means "any type that is a subtype of A" rather than "precisely type A"
28412841
# 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], [])
28452845
types.append(TypeRange(object_type, is_upper_bound=True))
28462846
else: # we didn't see an actual type, but rather a variable whose value is unknown to us
28472847
return None
@@ -2992,17 +2992,17 @@ def is_more_precise_signature(t: CallableType, s: CallableType) -> bool:
29922992
return is_more_precise(t.ret_type, s.ret_type)
29932993

29942994

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]:
29962996
"""Determine if operator assignment on given value type is in-place, and the method name.
29972997
29982998
For example, if operator is '+', return (True, '__iadd__') or (False, '__add__')
29992999
depending on which method is supported by the type.
30003000
"""
30013001
method = nodes.op_methods[operator]
3002-
if isinstance(type, Instance):
3002+
if isinstance(typ, Instance):
30033003
if operator in nodes.ops_with_inplace_method:
30043004
inplace_method = '__i' + method[2:]
3005-
if type.type.has_readable_member(inplace_method):
3005+
if typ.type.has_readable_member(inplace_method):
30063006
return True, inplace_method
30073007
return False, method
30083008

0 commit comments

Comments
 (0)