mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-16 05:28:31 +08:00
Always use _typeshed.Self, where applicable (#6880)
* Always use `_typeshed.Self`, where applicable * Revert changes to `google-cloud-ndb` (ambiguous) * Remove empty line added by script * Revert changes to `stubs/python-dateutil/dateutil/relativedelta.pyi` * Manually add a few more that the script missed * Improve `filelock` annotation Source code here: https://github.com/tox-dev/py-filelock/blob/79ec7b2826e33b982fe83b057f359448b9d966ba/src/filelock/_api.py#L207 * Improve `opentracing/scope` annotation Source code here: https://github.com/opentracing/opentracing-python/blob/3e1d357a348269ef54d67f761302fab93dbfc0f7/opentracing/scope.py#L71 * Improve `redis/client` stub Source code here: https://github.com/redis/redis-py/blob/15f315a496c3267c8cbcc6d6d9c6005ea4d4a4d5/redis/client.py#L1217 * Improve `redis/lock` annotation Source code here: https://github.com/redis/redis-py/blob/15f315a496c3267c8cbcc6d6d9c6005ea4d4a4d5/redis/lock.py#L155 * Improve `requests/models` annotation Source code here: https://github.com/psf/requests/blob/d718e753834b84018014a23d663369ac27d1ab9c/requests/models.py#L653
This commit is contained in:
@@ -1,38 +1,37 @@
|
||||
from _typeshed import Self
|
||||
from abc import abstractmethod
|
||||
from typing import Pattern, TypeVar
|
||||
|
||||
_T = TypeVar("_T", bound=Version)
|
||||
from typing import Pattern
|
||||
|
||||
class Version:
|
||||
def __repr__(self) -> str: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def __lt__(self: _T, other: _T | str) -> bool: ...
|
||||
def __le__(self: _T, other: _T | str) -> bool: ...
|
||||
def __gt__(self: _T, other: _T | str) -> bool: ...
|
||||
def __ge__(self: _T, other: _T | str) -> bool: ...
|
||||
def __lt__(self: Self, other: Self | str) -> bool: ...
|
||||
def __le__(self: Self, other: Self | str) -> bool: ...
|
||||
def __gt__(self: Self, other: Self | str) -> bool: ...
|
||||
def __ge__(self: Self, other: Self | str) -> bool: ...
|
||||
@abstractmethod
|
||||
def __init__(self, vstring: str | None = ...) -> None: ...
|
||||
@abstractmethod
|
||||
def parse(self: _T, vstring: str) -> _T: ...
|
||||
def parse(self: Self, vstring: str) -> Self: ...
|
||||
@abstractmethod
|
||||
def __str__(self) -> str: ...
|
||||
@abstractmethod
|
||||
def _cmp(self: _T, other: _T | str) -> bool: ...
|
||||
def _cmp(self: Self, other: Self | str) -> bool: ...
|
||||
|
||||
class StrictVersion(Version):
|
||||
version_re: Pattern[str]
|
||||
version: tuple[int, int, int]
|
||||
prerelease: tuple[str, int] | None
|
||||
def __init__(self, vstring: str | None = ...) -> None: ...
|
||||
def parse(self: _T, vstring: str) -> _T: ...
|
||||
def parse(self: Self, vstring: str) -> Self: ...
|
||||
def __str__(self) -> str: ...
|
||||
def _cmp(self: _T, other: _T | str) -> bool: ...
|
||||
def _cmp(self: Self, other: Self | str) -> bool: ...
|
||||
|
||||
class LooseVersion(Version):
|
||||
component_re: Pattern[str]
|
||||
vstring: str
|
||||
version: tuple[str | int, ...]
|
||||
def __init__(self, vstring: str | None = ...) -> None: ...
|
||||
def parse(self: _T, vstring: str) -> _T: ...
|
||||
def parse(self: Self, vstring: str) -> Self: ...
|
||||
def __str__(self) -> str: ...
|
||||
def _cmp(self: _T, other: _T | str) -> bool: ...
|
||||
def _cmp(self: Self, other: Self | str) -> bool: ...
|
||||
|
||||
Reference in New Issue
Block a user