Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions mypy/stubtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from contextlib import redirect_stderr, redirect_stdout
from functools import singledispatch
from pathlib import Path
from typing import Any, Generic, Iterator, TypeVar, Union, cast
from typing import Any, Generic, Iterator, TypeVar, Union
from typing_extensions import get_origin

import mypy.build
Expand Down Expand Up @@ -476,10 +476,7 @@ def verify_typeinfo(
to_check = set(stub.names)
# Check all public things on the runtime class
to_check.update(
# cast to workaround mypyc complaints
m
for m in cast(Any, vars)(runtime)
if not is_probably_private(m) and m not in IGNORABLE_CLASS_DUNDERS
m for m in vars(runtime) if not is_probably_private(m) and m not in IGNORABLE_CLASS_DUNDERS
)
# Special-case the __init__ method for Protocols
#
Expand Down
15 changes: 10 additions & 5 deletions mypy/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,8 @@ def __init__(

def accept(self, visitor: TypeVisitor[T]) -> T:
assert isinstance(visitor, SyntheticTypeVisitor)
return cast(T, visitor.visit_callable_argument(self))
ret: T = visitor.visit_callable_argument(self)
return ret

def serialize(self) -> JsonDict:
assert False, "Synthetic types don't serialize"
Expand All @@ -975,7 +976,8 @@ def __init__(self, items: list[Type], line: int = -1, column: int = -1) -> None:

def accept(self, visitor: TypeVisitor[T]) -> T:
assert isinstance(visitor, SyntheticTypeVisitor)
return cast(T, visitor.visit_type_list(self))
ret: T = visitor.visit_type_list(self)
return ret

def serialize(self) -> JsonDict:
assert False, "Synthetic types don't serialize"
Expand Down Expand Up @@ -2489,7 +2491,8 @@ def simple_name(self) -> str:

def accept(self, visitor: TypeVisitor[T]) -> T:
assert isinstance(visitor, SyntheticTypeVisitor)
return cast(T, visitor.visit_raw_expression_type(self))
ret: T = visitor.visit_raw_expression_type(self)
return ret

def serialize(self) -> JsonDict:
assert False, "Synthetic types don't serialize"
Expand Down Expand Up @@ -2736,7 +2739,8 @@ class EllipsisType(ProperType):

def accept(self, visitor: TypeVisitor[T]) -> T:
assert isinstance(visitor, SyntheticTypeVisitor)
return cast(T, visitor.visit_ellipsis_type(self))
ret: T = visitor.visit_ellipsis_type(self)
return ret

def serialize(self) -> JsonDict:
assert False, "Synthetic types don't serialize"
Expand Down Expand Up @@ -2845,7 +2849,8 @@ def __init__(self, fullname: str | None, args: list[Type], line: int) -> None:

def accept(self, visitor: TypeVisitor[T]) -> T:
assert isinstance(visitor, SyntheticTypeVisitor)
return cast(T, visitor.visit_placeholder_type(self))
ret: T = visitor.visit_placeholder_type(self)
return ret

def __hash__(self) -> int:
return hash((self.fullname, tuple(self.args)))
Expand Down