Skip to content

Commit 062cb81

Browse files
Apply suggestions from code review
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
1 parent a690223 commit 062cb81

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

mypy/sametypes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ def visit_union_type(self, left: UnionType) -> bool:
145145
if isinstance(self.right, UnionType):
146146
# fast path for simple literals
147147
def _extract_literals(u: UnionType) -> Tuple[Set[LiteralType], List[Type]]:
148-
lit = set() # type: Set[LiteralType]
149-
rem = [] # type: List[Type]
148+
lit: Set[LiteralType] = set()
149+
rem: List[Type] = []
150150
for i in u.items:
151151
if is_simple_literal(i):
152152
assert isinstance(i, LiteralType) # type: ignore[misc]

mypy/subtypes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ def visit_overloaded(self, left: Overloaded) -> bool:
499499

500500
def visit_union_type(self, left: UnionType) -> bool:
501501
if isinstance(self.right, Instance):
502-
literal_types = set() # type: Set[Instance]
502+
literal_types: Set[Instance] = set()
503503
# avoid redundant check for union of literals
504504
for item in left.items:
505505
if mypy.typeops.is_simple_literal(item):
@@ -1151,7 +1151,7 @@ def report(*args: Any) -> None:
11511151

11521152

11531153
def try_restrict_literal_union(t: UnionType, s: Type) -> Optional[List[Type]]:
1154-
new_items = [] # type: List[Type]
1154+
new_items: List[Type] = []
11551155
for i in t.relevant_items():
11561156
it = get_proper_type(i)
11571157
if not mypy.typeops.is_simple_literal(it):

0 commit comments

Comments
 (0)