mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-10 14:01:55 +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:79ec7b2826/src/filelock/_api.py (L207)* Improve `opentracing/scope` annotation Source code here:3e1d357a34/opentracing/scope.py (L71)* Improve `redis/client` stub Source code here:15f315a496/redis/client.py (L1217)* Improve `redis/lock` annotation Source code here:15f315a496/redis/lock.py (L155)* Improve `requests/models` annotation Source code here:d718e75383/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