mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 21:46:42 +08:00
Refine types for distutils.version (#1835)
Note: these type signatures were derived mainly by looking at the docstrings inside distutils.version. For reference: - py3 impl: https://github.com/python/cpython/blob/master/Lib/distutils/version.py - py2 impl: https://github.com/python/cpython/blob/2.7/Lib/distutils/version.py
This commit is contained in:
committed by
Jelle Zijlstra
parent
732726400f
commit
1e4c2a9031
@@ -1,31 +1,54 @@
|
||||
import sys
|
||||
from typing import Any
|
||||
from abc import abstractmethod
|
||||
from typing import Any, Optional, TypeVar, Union, Pattern, Tuple
|
||||
|
||||
_T = TypeVar('_T', bound='Version')
|
||||
|
||||
class Version:
|
||||
def __init__(self, vstring=None): ...
|
||||
def __repr__(self) -> str: ...
|
||||
|
||||
if sys.version_info >= (3,):
|
||||
def __eq__(self, other): ...
|
||||
def __lt__(self, other): ...
|
||||
def __le__(self, other): ...
|
||||
def __gt__(self, other): ...
|
||||
def __ge__(self, other): ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def __lt__(self: _T, other: Union[_T, str]) -> bool: ...
|
||||
def __le__(self: _T, other: Union[_T, str]) -> bool: ...
|
||||
def __gt__(self: _T, other: Union[_T, str]) -> bool: ...
|
||||
def __ge__(self: _T, other: Union[_T, str]) -> bool: ...
|
||||
|
||||
@abstractmethod
|
||||
def __init__(self, vstring: Optional[str] = ...) -> None: ...
|
||||
@abstractmethod
|
||||
def parse(self: _T, vstring: str) -> _T: ...
|
||||
@abstractmethod
|
||||
def __str__(self) -> str: ...
|
||||
if sys.version_info >= (3,):
|
||||
@abstractmethod
|
||||
def _cmp(self: _T, other: Union[_T, str]) -> bool: ...
|
||||
else:
|
||||
@abstractmethod
|
||||
def __cmp__(self: _T, other: Union[_T, str]) -> bool: ...
|
||||
|
||||
class StrictVersion(Version):
|
||||
version_re = ... # type: Any
|
||||
version = ... # type: Any
|
||||
prerelease = ... # type: Any
|
||||
def parse(self, vstring): ...
|
||||
version_re: Pattern[str]
|
||||
version: Tuple[int, int, int]
|
||||
prerelease: Optional[Tuple[str, int]]
|
||||
|
||||
if sys.version_info < (3,):
|
||||
def __cmp__(self, other): ...
|
||||
def __init__(self, vstring: Optional[str] = ...) -> None: ...
|
||||
def parse(self: _T, vstring: str) -> _T: ...
|
||||
def __str__(self) -> str: ...
|
||||
if sys.version_info >= (3,):
|
||||
def _cmp(self: _T, other: Union[_T, str]) -> bool: ...
|
||||
else:
|
||||
def __cmp__(self: _T, other: Union[_T, str]) -> bool: ...
|
||||
|
||||
class LooseVersion(Version):
|
||||
component_re = ... # type: Any
|
||||
def __init__(self, vstring=None): ...
|
||||
vstring = ... # type: Any
|
||||
version = ... # type: Any
|
||||
def parse(self, vstring): ...
|
||||
component_re: Pattern[str]
|
||||
vstring: str
|
||||
version: Tuple[Union[str, int], ...]
|
||||
|
||||
if sys.version_info < (3,):
|
||||
def __cmp__(self, other): ...
|
||||
def __init__(self, vstring: Optional[str] = ...) -> None: ...
|
||||
def parse(self: _T, vstring: str) -> _T: ...
|
||||
def __str__(self) -> str: ...
|
||||
if sys.version_info >= (3,):
|
||||
def _cmp(self: _T, other: Union[_T, str]) -> bool: ...
|
||||
else:
|
||||
def __cmp__(self: _T, other: Union[_T, str]) -> bool: ...
|
||||
|
||||
Reference in New Issue
Block a user