From 4f2dd0f446e1e4fa8d9158a12268852f156d0b11 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Fri, 26 May 2017 08:28:51 -0700 Subject: [PATCH] remove unused type ignore flags (#1346) Verified that none of those are necessary for pytype. --- stdlib/2/typing.pyi | 4 ++-- stdlib/3.4/enum.pyi | 11 ++++++----- stdlib/3/importlib/machinery.pyi | 12 ++++++------ stdlib/3/typing.pyi | 4 ++-- third_party/2and3/pytz/__init__.pyi | 4 ++-- 5 files changed, 18 insertions(+), 17 deletions(-) diff --git a/stdlib/2/typing.pyi b/stdlib/2/typing.pyi index 8fbda2c7f..1165c91c1 100644 --- a/stdlib/2/typing.pyi +++ b/stdlib/2/typing.pyi @@ -212,9 +212,9 @@ class Mapping(Iterable[_KT], Container[_KT], Sized, Generic[_KT, _VT_co]): def __getitem__(self, k: _KT) -> _VT_co: ... # Mixin methods - @overload # type: ignore + @overload def get(self, k: _KT) -> Optional[_VT_co]: ... - @overload # type: ignore + @overload def get(self, k: _KT, default: Union[_VT_co, _T]) -> Union[_VT_co, _T]: ... def keys(self) -> list[_KT]: ... def values(self) -> list[_VT_co]: ... diff --git a/stdlib/3.4/enum.pyi b/stdlib/3.4/enum.pyi index a7e0fd686..7df2d52b8 100644 --- a/stdlib/3.4/enum.pyi +++ b/stdlib/3.4/enum.pyi @@ -5,7 +5,7 @@ _T = TypeVar('_T', bound=Enum) _S = TypeVar('_S', bound=Type[Enum]) class EnumMeta(type, Iterable[Enum], Sized, Reversible[Enum], Container[Enum]): - def __iter__(self: Type[_T]) -> Iterator[_T]: ... # type: ignore + def __iter__(self: Type[_T]) -> Iterator[_T]: ... def __reversed__(self: Type[_T]) -> Iterator[_T]: ... def __contains__(self, member: Any) -> bool: ... def __getitem__(self: Type[_T], name: str) -> _T: ... @@ -45,11 +45,12 @@ if sys.version_info >= (3, 6): def __xor__(self: _T, other: _T) -> _T: ... def __invert__(self: _T) -> _T: ... - # All `type: ignore` comments below due to IntFlag making the function signatures more permissive. + # The `type: ignore` comment is needed because mypy considers the type + # signatures of several methods defined in int and Flag to be incompatible. class IntFlag(int, Flag): # type: ignore - def __or__(self: _T, other: Union[int, _T]) -> _T: ... # type: ignore - def __and__(self: _T, other: Union[int, _T]) -> _T: ... # type: ignore - def __xor__(self: _T, other: Union[int, _T]) -> _T: ... # type: ignore + def __or__(self: _T, other: Union[int, _T]) -> _T: ... + def __and__(self: _T, other: Union[int, _T]) -> _T: ... + def __xor__(self: _T, other: Union[int, _T]) -> _T: ... __ror__ = __or__ __rand__ = __and__ __rxor__ = __xor__ diff --git a/stdlib/3/importlib/machinery.pyi b/stdlib/3/importlib/machinery.pyi index 9a9e7e647..32be0627e 100644 --- a/stdlib/3/importlib/machinery.pyi +++ b/stdlib/3/importlib/machinery.pyi @@ -30,9 +30,9 @@ if sys.version_info >= (3, 3): @classmethod def load_module(cls, fullname: str) -> types.ModuleType: ... @classmethod - def get_code(cls, fullname: str) -> None: ... # type: ignore + def get_code(cls, fullname: str) -> None: ... @classmethod - def get_source(cls, fullname: str) -> None: ... # type: ignore + def get_source(cls, fullname: str) -> None: ... # Loader @classmethod def load_module(cls, fullname: str) -> types.ModuleType: ... @@ -59,9 +59,9 @@ else: @classmethod def load_module(cls, fullname: str) -> types.ModuleType: ... @classmethod - def get_code(cls, fullname: str) -> None: ... # type: ignore + def get_code(cls, fullname: str) -> None: ... @classmethod - def get_source(cls, fullname: str) -> None: ... # type: ignore + def get_source(cls, fullname: str) -> None: ... # Loader @classmethod def load_module(cls, fullname: str) -> types.ModuleType: ... @@ -87,9 +87,9 @@ if sys.version_info >= (3, 3): @classmethod def load_module(cls, fullname: str) -> types.ModuleType: ... @classmethod - def get_code(cls, fullname: str) -> None: ... # type: ignore + def get_code(cls, fullname: str) -> None: ... @classmethod - def get_source(cls, fullname: str) -> None: ... # type: ignore + def get_source(cls, fullname: str) -> None: ... # Loader @classmethod def load_module(cls, fullname: str) -> types.ModuleType: ... diff --git a/stdlib/3/typing.pyi b/stdlib/3/typing.pyi index 6390e60ac..c834d748e 100644 --- a/stdlib/3/typing.pyi +++ b/stdlib/3/typing.pyi @@ -294,9 +294,9 @@ class Mapping(_Collection[_KT], Generic[_KT, _VT_co]): def __getitem__(self, k: _KT) -> _VT_co: ... # Mixin methods - @overload # type: ignore + @overload def get(self, k: _KT) -> Optional[_VT_co]: ... - @overload # type: ignore + @overload def get(self, k: _KT, default: Union[_VT_co, _T]) -> Union[_VT_co, _T]: ... def items(self) -> AbstractSet[Tuple[_KT, _VT_co]]: ... def keys(self) -> AbstractSet[_KT]: ... diff --git a/third_party/2and3/pytz/__init__.pyi b/third_party/2and3/pytz/__init__.pyi index 2c2accd67..e47caeac0 100644 --- a/third_party/2and3/pytz/__init__.pyi +++ b/third_party/2and3/pytz/__init__.pyi @@ -14,9 +14,9 @@ country_names = ... # type: Dict class _UTCclass(datetime.tzinfo): zone = ... # type: str def fromutc(self, dt: datetime.datetime) -> datetime.datetime: ... - def utcoffset(self, dt: Optional[datetime.datetime]) -> datetime.timedelta: ... # type: ignore + def utcoffset(self, dt: Optional[datetime.datetime]) -> datetime.timedelta: ... def tzname(self, dt: Optional[datetime.datetime]) -> str: ... - def dst(self, dt: Optional[datetime.datetime]) -> datetime.timedelta: ... # type: ignore + def dst(self, dt: Optional[datetime.datetime]) -> datetime.timedelta: ... def localize(self, dt: datetime.datetime, is_dst: bool = ...) -> datetime.datetime: ... def normalize(self, dt: datetime.datetime, is_dst: bool = ...) -> datetime.datetime: ...