Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
  • Loading branch information
hauntsaninja and sobolevn committed Jan 22, 2022
1 parent a690223 commit 062cb81
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions mypy/sametypes.py
Expand Up @@ -145,8 +145,8 @@ def visit_union_type(self, left: UnionType) -> bool:
if isinstance(self.right, UnionType):
# fast path for simple literals
def _extract_literals(u: UnionType) -> Tuple[Set[LiteralType], List[Type]]:
lit = set() # type: Set[LiteralType]
rem = [] # type: List[Type]
lit: Set[LiteralType] = set()
rem: List[Type] = []
for i in u.items:
if is_simple_literal(i):
assert isinstance(i, LiteralType) # type: ignore[misc]
Expand Down
4 changes: 2 additions & 2 deletions mypy/subtypes.py
Expand Up @@ -499,7 +499,7 @@ def visit_overloaded(self, left: Overloaded) -> bool:

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


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

0 comments on commit 062cb81

Please sign in to comment.