Use _typeshed.Self in Python 2, too (#6932)

This commit is contained in:
Alex Waygood
2022-01-16 22:44:51 +00:00
committed by GitHub
parent 0949e9e90d
commit 6a88d5e7ae
29 changed files with 156 additions and 160 deletions

View File

@@ -1,3 +1,4 @@
from _typeshed import Self
from abc import abstractmethod
from typing import Pattern, Text, Tuple, TypeVar
@@ -8,7 +9,7 @@ class Version:
@abstractmethod
def __init__(self, vstring: Text | None = ...) -> None: ...
@abstractmethod
def parse(self: _T, vstring: Text) -> _T: ...
def parse(self: Self, vstring: Text) -> Self: ...
@abstractmethod
def __str__(self) -> str: ...
@abstractmethod
@@ -19,7 +20,7 @@ class StrictVersion(Version):
version: Tuple[int, int, int]
prerelease: Tuple[Text, int] | None
def __init__(self, vstring: Text | None = ...) -> None: ...
def parse(self: _T, vstring: Text) -> _T: ...
def parse(self: Self, vstring: Text) -> Self: ...
def __str__(self) -> str: ...
def __cmp__(self: _T, other: _T | str) -> bool: ...
@@ -28,6 +29,6 @@ class LooseVersion(Version):
vstring: Text
version: Tuple[Text | int, ...]
def __init__(self, vstring: Text | None = ...) -> None: ...
def parse(self: _T, vstring: Text) -> _T: ...
def parse(self: Self, vstring: Text) -> Self: ...
def __str__(self) -> str: ...
def __cmp__(self: _T, other: _T | str) -> bool: ...