Remove nearly all __str__ and __repr__ methods from typeshed (#6968)

This commit is contained in:
Alex Waygood
2022-01-19 23:45:11 +00:00
committed by GitHub
parent fe6233a8c3
commit aea52b35d1
27 changed files with 11 additions and 72 deletions

View File

@@ -9,8 +9,6 @@ class Error(Exception):
def __init__(self, msg: str = ...) -> None: ...
def _get_message(self) -> None: ...
def _set_message(self, value: str) -> None: ...
def __repr__(self) -> str: ...
def __str__(self) -> str: ...
class NoSectionError(Error):
section: str

View File

@@ -69,8 +69,8 @@ class object:
def __setattr__(self, name: str, value: Any) -> None: ...
def __eq__(self, o: object) -> bool: ...
def __ne__(self, o: object) -> bool: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def __str__(self) -> str: ... # noqa Y029
def __repr__(self) -> str: ... # noqa Y029
def __hash__(self) -> int: ...
def __format__(self, format_spec: str) -> str: ...
def __getattribute__(self, name: str) -> Any: ...
@@ -182,7 +182,6 @@ class int:
def __le__(self, x: int) -> bool: ...
def __gt__(self, x: int) -> bool: ...
def __ge__(self, x: int) -> bool: ...
def __str__(self) -> str: ...
def __float__(self) -> float: ...
def __int__(self) -> int: ...
def __abs__(self) -> int: ...
@@ -232,7 +231,6 @@ class float:
def __ge__(self, x: float) -> bool: ...
def __neg__(self) -> float: ...
def __pos__(self) -> float: ...
def __str__(self) -> str: ...
def __int__(self) -> int: ...
def __float__(self) -> float: ...
def __abs__(self) -> float: ...
@@ -265,7 +263,6 @@ class complex:
def __ne__(self, x: object) -> bool: ...
def __neg__(self) -> complex: ...
def __pos__(self) -> complex: ...
def __str__(self) -> str: ...
def __complex__(self) -> complex: ...
def __abs__(self) -> float: ...
def __hash__(self) -> int: ...
@@ -341,8 +338,6 @@ class unicode(basestring, Sequence[unicode]):
# The argument type is incompatible with Sequence
def __contains__(self, s: unicode | bytes) -> bool: ... # type: ignore
def __iter__(self) -> Iterator[unicode]: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def __int__(self) -> int: ...
def __float__(self) -> float: ...
def __hash__(self) -> int: ...
@@ -432,9 +427,7 @@ class str(Sequence[str], basestring):
def __mod__(self, x: Any) -> str: ...
def __mul__(self, n: int) -> str: ...
def __ne__(self, x: object) -> bool: ...
def __repr__(self) -> str: ...
def __rmul__(self, n: int) -> str: ...
def __str__(self) -> str: ...
def __getnewargs__(self) -> tuple[str]: ...
def __getslice__(self, start: int, stop: int) -> str: ...
def __float__(self) -> float: ...
@@ -495,8 +488,6 @@ class bytearray(MutableSequence[int], ByteString):
def fromhex(cls, __string: str) -> bytearray: ...
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[int]: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def __int__(self) -> int: ...
def __float__(self) -> float: ...
__hash__: None # type: ignore
@@ -630,7 +621,6 @@ class list(MutableSequence[_T], Generic[_T]):
def sort(self, cmp: Callable[[_T, _T], Any] = ..., key: Callable[[_T], Any] = ..., reverse: bool = ...) -> None: ...
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[_T]: ...
def __str__(self) -> str: ...
__hash__: None # type: ignore
@overload
def __getitem__(self, i: int) -> _T: ...
@@ -693,7 +683,6 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
def __setitem__(self, k: _KT, v: _VT) -> None: ...
def __delitem__(self, v: _KT) -> None: ...
def __iter__(self) -> Iterator[_KT]: ...
def __str__(self) -> str: ...
__hash__: None # type: ignore
class set(MutableSet[_T], Generic[_T]):
@@ -718,7 +707,6 @@ class set(MutableSet[_T], Generic[_T]):
def __len__(self) -> int: ...
def __contains__(self, o: object) -> bool: ...
def __iter__(self) -> Iterator[_T]: ...
def __str__(self) -> str: ...
def __and__(self, s: AbstractSet[object]) -> set[_T]: ...
def __iand__(self, s: AbstractSet[object]) -> set[_T]: ...
def __or__(self, s: AbstractSet[_S]) -> set[_T | _S]: ...
@@ -752,7 +740,6 @@ class frozenset(AbstractSet[_T_co], Generic[_T_co]):
def __len__(self) -> int: ...
def __contains__(self, o: object) -> bool: ...
def __iter__(self) -> Iterator[_T_co]: ...
def __str__(self) -> str: ...
def __and__(self, s: AbstractSet[_T_co]) -> frozenset[_T_co]: ...
def __or__(self, s: AbstractSet[_S]) -> frozenset[_T_co | _S]: ...
def __sub__(self, s: AbstractSet[_T_co]) -> frozenset[_T_co]: ...
@@ -1061,8 +1048,6 @@ class BaseException(object):
args: tuple[Any, ...]
message: Any
def __init__(self, *args: object) -> None: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def __getitem__(self, i: int) -> Any: ...
def __getslice__(self, start: int, stop: int) -> tuple[Any, ...]: ...

View File

@@ -87,7 +87,6 @@ class Breakpoint:
def disable(self) -> None: ...
def bpprint(self, out: IO[str] | None = ...) -> None: ...
def bpformat(self) -> str: ...
def __str__(self) -> str: ...
def checkfuncname(b: Breakpoint, frame: FrameType) -> bool: ...
def effective(file: str, line: int, frame: FrameType) -> tuple[Breakpoint, bool] | tuple[None, None]: ...

View File

@@ -69,8 +69,8 @@ class object:
def __setattr__(self, name: str, value: Any) -> None: ...
def __eq__(self, o: object) -> bool: ...
def __ne__(self, o: object) -> bool: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def __str__(self) -> str: ... # noqa Y029
def __repr__(self) -> str: ... # noqa Y029
def __hash__(self) -> int: ...
def __format__(self, format_spec: str) -> str: ...
def __getattribute__(self, name: str) -> Any: ...
@@ -182,7 +182,6 @@ class int:
def __le__(self, x: int) -> bool: ...
def __gt__(self, x: int) -> bool: ...
def __ge__(self, x: int) -> bool: ...
def __str__(self) -> str: ...
def __float__(self) -> float: ...
def __int__(self) -> int: ...
def __abs__(self) -> int: ...
@@ -232,7 +231,6 @@ class float:
def __ge__(self, x: float) -> bool: ...
def __neg__(self) -> float: ...
def __pos__(self) -> float: ...
def __str__(self) -> str: ...
def __int__(self) -> int: ...
def __float__(self) -> float: ...
def __abs__(self) -> float: ...
@@ -265,7 +263,6 @@ class complex:
def __ne__(self, x: object) -> bool: ...
def __neg__(self) -> complex: ...
def __pos__(self) -> complex: ...
def __str__(self) -> str: ...
def __complex__(self) -> complex: ...
def __abs__(self) -> float: ...
def __hash__(self) -> int: ...
@@ -341,8 +338,6 @@ class unicode(basestring, Sequence[unicode]):
# The argument type is incompatible with Sequence
def __contains__(self, s: unicode | bytes) -> bool: ... # type: ignore
def __iter__(self) -> Iterator[unicode]: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def __int__(self) -> int: ...
def __float__(self) -> float: ...
def __hash__(self) -> int: ...
@@ -432,9 +427,7 @@ class str(Sequence[str], basestring):
def __mod__(self, x: Any) -> str: ...
def __mul__(self, n: int) -> str: ...
def __ne__(self, x: object) -> bool: ...
def __repr__(self) -> str: ...
def __rmul__(self, n: int) -> str: ...
def __str__(self) -> str: ...
def __getnewargs__(self) -> tuple[str]: ...
def __getslice__(self, start: int, stop: int) -> str: ...
def __float__(self) -> float: ...
@@ -495,8 +488,6 @@ class bytearray(MutableSequence[int], ByteString):
def fromhex(cls, __string: str) -> bytearray: ...
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[int]: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def __int__(self) -> int: ...
def __float__(self) -> float: ...
__hash__: None # type: ignore
@@ -630,7 +621,6 @@ class list(MutableSequence[_T], Generic[_T]):
def sort(self, cmp: Callable[[_T, _T], Any] = ..., key: Callable[[_T], Any] = ..., reverse: bool = ...) -> None: ...
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[_T]: ...
def __str__(self) -> str: ...
__hash__: None # type: ignore
@overload
def __getitem__(self, i: int) -> _T: ...
@@ -693,7 +683,6 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
def __setitem__(self, k: _KT, v: _VT) -> None: ...
def __delitem__(self, v: _KT) -> None: ...
def __iter__(self) -> Iterator[_KT]: ...
def __str__(self) -> str: ...
__hash__: None # type: ignore
class set(MutableSet[_T], Generic[_T]):
@@ -718,7 +707,6 @@ class set(MutableSet[_T], Generic[_T]):
def __len__(self) -> int: ...
def __contains__(self, o: object) -> bool: ...
def __iter__(self) -> Iterator[_T]: ...
def __str__(self) -> str: ...
def __and__(self, s: AbstractSet[object]) -> set[_T]: ...
def __iand__(self, s: AbstractSet[object]) -> set[_T]: ...
def __or__(self, s: AbstractSet[_S]) -> set[_T | _S]: ...
@@ -752,7 +740,6 @@ class frozenset(AbstractSet[_T_co], Generic[_T_co]):
def __len__(self) -> int: ...
def __contains__(self, o: object) -> bool: ...
def __iter__(self) -> Iterator[_T_co]: ...
def __str__(self) -> str: ...
def __and__(self, s: AbstractSet[_T_co]) -> frozenset[_T_co]: ...
def __or__(self, s: AbstractSet[_S]) -> frozenset[_T_co | _S]: ...
def __sub__(self, s: AbstractSet[_T_co]) -> frozenset[_T_co]: ...
@@ -1061,8 +1048,6 @@ class BaseException(object):
args: tuple[Any, ...]
message: Any
def __init__(self, *args: object) -> None: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def __getitem__(self, i: int) -> Any: ...
def __getslice__(self, start: int, stop: int) -> tuple[Any, ...]: ...

View File

@@ -6,11 +6,9 @@ _LocaleType = tuple[Optional[str], Optional[str]]
class IllegalMonthError(ValueError):
def __init__(self, month: int) -> None: ...
def __str__(self) -> str: ...
class IllegalWeekdayError(ValueError):
def __init__(self, weekday: int) -> None: ...
def __str__(self) -> str: ...
def isleap(year: int) -> bool: ...
def leapdays(y1: int, y2: int) -> int: ...

View File

@@ -38,7 +38,6 @@ class MiniFieldStorage:
name: Any
value: Any
def __init__(self, name: Any, value: Any) -> None: ...
def __repr__(self) -> str: ...
class FieldStorage(object):
FieldStorageClass: _type | None
@@ -72,7 +71,6 @@ class FieldStorage(object):
keep_blank_values: int = ...,
strict_parsing: int = ...,
) -> None: ...
def __repr__(self) -> str: ...
def __iter__(self) -> Iterator[str]: ...
def __getitem__(self, key: str) -> Any: ...
def getvalue(self, key: str, default: Any = ...) -> Any: ...

View File

@@ -51,7 +51,6 @@ class deque(Sized, Iterable[_T], Reversible[_T], Generic[_T]):
def rotate(self, n: int = ...) -> None: ...
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[_T]: ...
def __str__(self) -> str: ...
def __hash__(self) -> int: ...
def __getitem__(self, i: int) -> _T: ...
def __setitem__(self, i: int, x: _T) -> None: ...

View File

@@ -73,7 +73,7 @@ class Decimal(object):
def __rmul__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
def __rsub__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
def __rtruediv__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
def __str__(self, eng: bool = ..., context: Context | None = ...) -> str: ...
def __str__(self, eng: bool = ..., context: Context | None = ...) -> str: ... # noqa Y029
def __sub__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
def __truediv__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
def remainder_near(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...

View File

@@ -5,7 +5,6 @@ from typing import Pattern, Text, TypeVar
_T = TypeVar("_T", bound=Version)
class Version:
def __repr__(self) -> str: ...
@abstractmethod
def __init__(self, vstring: Text | None = ...) -> None: ...
@abstractmethod
@@ -21,7 +20,7 @@ class StrictVersion(Version):
prerelease: tuple[Text, int] | None
def __init__(self, vstring: Text | None = ...) -> None: ...
def parse(self: Self, vstring: Text) -> Self: ...
def __str__(self) -> str: ...
def __str__(self) -> str: ... # noqa Y029
def __cmp__(self: _T, other: _T | str) -> bool: ...
class LooseVersion(Version):
@@ -30,5 +29,5 @@ class LooseVersion(Version):
version: tuple[Text | int, ...]
def __init__(self, vstring: Text | None = ...) -> None: ...
def parse(self: Self, vstring: Text) -> Self: ...
def __str__(self) -> str: ...
def __str__(self) -> str: ... # noqa Y029
def __cmp__(self: _T, other: _T | str) -> bool: ...

View File

@@ -2,7 +2,6 @@ class GetoptError(Exception):
opt: str
msg: str
def __init__(self, msg: str, opt: str = ...) -> None: ...
def __str__(self) -> str: ...
error = GetoptError

View File

@@ -18,7 +18,6 @@ def ReplacePackage(oldname: str, newname: str) -> None: ...
class Module: # undocumented
def __init__(self, name: str, file: str | None = ..., path: str | None = ...) -> None: ...
def __repr__(self) -> str: ...
class ModuleFinder:

View File

@@ -94,7 +94,6 @@ if sys.platform == "win32":
name: str
def __init__(self, fname: str) -> None: ...
def __repr__(self) -> str: ...
class Feature:
id: str

View File

@@ -7,8 +7,6 @@ _Setlike = Union[BaseSet[_T], Iterable[_T]]
class BaseSet(Iterable[_T]):
def __init__(self) -> None: ...
def __len__(self) -> int: ...
def __repr__(self) -> str: ...
def __str__(self) -> str: ...
def __iter__(self) -> Iterator[_T]: ...
def __cmp__(self, other: Any) -> int: ...
def __eq__(self, other: Any) -> bool: ...

View File

@@ -30,7 +30,6 @@ class WeakValueDictionary(MutableMapping[_KT, _VT]):
def has_key(self, key: object) -> bool: ...
def __contains__(self, o: object) -> bool: ...
def __iter__(self) -> Iterator[_KT]: ...
def __str__(self) -> str: ...
def copy(self) -> WeakValueDictionary[_KT, _VT]: ...
def keys(self) -> list[_KT]: ...
def values(self) -> list[_VT]: ...
@@ -59,7 +58,6 @@ class WeakKeyDictionary(MutableMapping[_KT, _VT]):
def has_key(self, key: object) -> bool: ...
def __contains__(self, o: object) -> bool: ...
def __iter__(self) -> Iterator[_KT]: ...
def __str__(self) -> str: ...
def copy(self) -> WeakKeyDictionary[_KT, _VT]: ...
def keys(self) -> list[_KT]: ...
def values(self) -> list[_VT]: ...

View File

@@ -31,7 +31,6 @@ class ZipExtFile(io.BufferedIOBase):
) -> None: ...
def read(self, n: int | None = ...) -> bytes: ...
def readline(self, limit: int = ...) -> bytes: ... # type: ignore
def __repr__(self) -> str: ...
def peek(self, n: int = ...) -> bytes: ...
def read1(self, n: int | None) -> bytes: ... # type: ignore

View File

@@ -90,7 +90,6 @@ class Breakpoint:
def disable(self) -> None: ...
def bpprint(self, out: IO[str] | None = ...) -> None: ...
def bpformat(self) -> str: ...
def __str__(self) -> str: ...
def checkfuncname(b: Breakpoint, frame: FrameType) -> bool: ...
def effective(file: str, line: int, frame: FrameType) -> tuple[Breakpoint, bool] | tuple[None, None]: ...

View File

@@ -94,8 +94,8 @@ class object:
def __setattr__(self, __name: str, __value: Any) -> None: ...
def __eq__(self, __o: object) -> bool: ...
def __ne__(self, __o: object) -> bool: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def __str__(self) -> str: ... # noqa Y029
def __repr__(self) -> str: ... # noqa Y029
def __hash__(self) -> int: ...
def __format__(self, __format_spec: str) -> str: ...
def __getattribute__(self, __name: str) -> Any: ...

View File

@@ -3,7 +3,6 @@ from abc import abstractmethod
from typing import Pattern
class Version:
def __repr__(self) -> str: ...
def __eq__(self, other: object) -> bool: ...
def __lt__(self: Self, other: Self | str) -> bool: ...
def __le__(self: Self, other: Self | str) -> bool: ...
@@ -24,7 +23,7 @@ class StrictVersion(Version):
prerelease: tuple[str, int] | None
def __init__(self, vstring: str | None = ...) -> None: ...
def parse(self: Self, vstring: str) -> Self: ...
def __str__(self) -> str: ...
def __str__(self) -> str: ... # noqa Y029
def _cmp(self: Self, other: Self | str) -> bool: ...
class LooseVersion(Version):
@@ -33,5 +32,5 @@ class LooseVersion(Version):
version: tuple[str | int, ...]
def __init__(self, vstring: str | None = ...) -> None: ...
def parse(self: Self, vstring: str) -> Self: ...
def __str__(self) -> str: ...
def __str__(self) -> str: ... # noqa Y029
def _cmp(self: Self, other: Self | str) -> bool: ...

View File

@@ -16,7 +16,6 @@ if sys.platform == "win32":
wAttributes: wintypes.WORD
srWindow: wintypes.SMALL_RECT
dwMaximumWindowSize: COORD
def __str__(self) -> str: ...
def winapi_test() -> bool: ...
def GetConsoleScreenBufferInfo(stream_id: int = ...) -> CONSOLE_SCREEN_BUFFER_INFO: ...
def SetConsoleTextAttribute(stream_id: int, attrs: wintypes.WORD) -> wintypes.BOOL: ...

View File

@@ -37,8 +37,6 @@ class Enum(metaclass=EnumMeta):
@staticmethod
def _generate_next_value_(name: str, start: int, count: int, last_values: list[Any]) -> Any: ...
def __new__(cls: type[Self], value: object) -> Self: ...
def __repr__(self) -> str: ...
def __str__(self) -> str: ...
def __dir__(self) -> list[str]: ...
def __format__(self, format_spec: str) -> str: ...
def __hash__(self) -> Any: ...
@@ -57,8 +55,6 @@ class auto(IntFlag):
class Flag(Enum):
def __contains__(self: _T, other: _T) -> bool: ...
def __repr__(self) -> str: ...
def __str__(self) -> str: ...
def __bool__(self) -> bool: ...
def __or__(self: Self, other: Self) -> Self: ...
def __and__(self: Self, other: Self) -> Self: ...

View File

@@ -4,7 +4,6 @@ from types import TracebackType
class Timeout(TimeoutError):
def __init__(self, lock_file: str) -> None: ...
def __str__(self) -> str: ...
class _Acquire_ReturnProxy:
def __init__(self, lock: str) -> None: ...

View File

@@ -1,5 +1,4 @@
frozendict.FrozenOrderedDict
frozendict.frozendict.__hash__
frozendict.frozendict.__new__
frozendict.frozendict.__repr__
frozendict.frozendict.copy

View File

@@ -19,7 +19,6 @@ class frozendict(Mapping[_KT, _VT], Generic[_KT, _VT]):
def copy(self: Self, **add_or_replace: _VT) -> Self: ...
def __iter__(self) -> Iterator[_KT]: ...
def __len__(self) -> int: ...
def __repr__(self) -> str: ...
def __hash__(self) -> int: ...
class FrozenOrderedDict(frozendict[_KT, _VT]):

View File

@@ -18,7 +18,6 @@ class BaseContainer(Sequence[_T]):
def __len__(self) -> int: ...
def __ne__(self, other: object) -> bool: ...
def __hash__(self) -> int: ...
def __repr__(self) -> str: ...
def sort(self, *, key: Optional[Callable[[_T], Any]] = ..., reverse: bool = ...) -> None: ...
@overload
def __getitem__(self, key: SupportsIndex) -> _T: ...

View File

@@ -4,7 +4,6 @@ class weekday(object):
def __init__(self, weekday: int, n: int | None = ...) -> None: ...
def __call__(self: Self, n: int) -> Self: ...
def __eq__(self, other: object) -> bool: ...
def __repr__(self) -> str: ...
def __hash__(self) -> int: ...
weekday: int
n: int

View File

@@ -94,6 +94,5 @@ class relativedelta(object):
def __ne__(self, other: object) -> bool: ...
def __div__(self: Self, other: SupportsFloat) -> Self: ...
def __truediv__(self: Self, other: SupportsFloat) -> Self: ...
def __repr__(self) -> str: ...
def __abs__(self: Self) -> Self: ...
def __hash__(self) -> int: ...

View File

@@ -70,7 +70,6 @@ class FlagValues:
def RegisteredFlags(self) -> list[str]: ...
def flag_values_dict(self) -> dict[str, Any]: ...
FlagValuesDict = flag_values_dict
def __str__(self) -> str: ...
def GetHelp(self, prefix: str = ...) -> str: ...
def module_help(self, module: ModuleType | str) -> str: ...
ModuleHelp = module_help