-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add stubs for
pkg_resources._vendor.packaging
(#10423)
- Loading branch information
1 parent
a83e559
commit 47fc836
Showing
6 changed files
with
157 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
stubs/setuptools/pkg_resources/_vendor/packaging/__init__.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
__title__: str | ||
__summary__: str | ||
__uri__: str | ||
__version__: str | ||
__author__: str | ||
__email__: str | ||
__license__: str | ||
__copyright__: str |
13 changes: 13 additions & 0 deletions
13
stubs/setuptools/pkg_resources/_vendor/packaging/markers.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
__all__ = ["InvalidMarker", "UndefinedComparison", "UndefinedEnvironmentName", "Marker", "default_environment"] | ||
|
||
class InvalidMarker(ValueError): ... | ||
class UndefinedComparison(ValueError): ... | ||
class UndefinedEnvironmentName(ValueError): ... | ||
|
||
def default_environment() -> dict[str, str]: ... | ||
|
||
class Marker: | ||
def __init__(self, marker: str) -> None: ... | ||
def __hash__(self) -> int: ... | ||
def __eq__(self, other: object) -> bool: ... | ||
def evaluate(self, environment: dict[str, str] | None = None) -> bool: ... |
14 changes: 14 additions & 0 deletions
14
stubs/setuptools/pkg_resources/_vendor/packaging/requirements.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from .markers import Marker | ||
from .specifiers import SpecifierSet | ||
|
||
class InvalidRequirement(ValueError): ... | ||
|
||
class Requirement: | ||
name: str | ||
url: str | None | ||
extras: set[str] | ||
specifier: SpecifierSet | ||
marker: Marker | None | ||
def __init__(self, requirement_str: str) -> None: ... | ||
def __hash__(self) -> int: ... | ||
def __eq__(self, other: object) -> bool: ... |
66 changes: 66 additions & 0 deletions
66
stubs/setuptools/pkg_resources/_vendor/packaging/specifiers.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import abc | ||
from collections.abc import Iterable, Iterator | ||
from typing import TypeVar | ||
from typing_extensions import TypeAlias | ||
|
||
from .version import Version | ||
|
||
# These exist at runtime, hence the public names | ||
UnparsedVersion: TypeAlias = Version | str | ||
UnparsedVersionVar = TypeVar("UnparsedVersionVar", bound=UnparsedVersion) # noqa: Y001 | ||
|
||
class InvalidSpecifier(ValueError): ... | ||
|
||
class BaseSpecifier(metaclass=abc.ABCMeta): | ||
@abc.abstractmethod | ||
def __str__(self) -> str: ... | ||
@abc.abstractmethod | ||
def __hash__(self) -> int: ... | ||
@abc.abstractmethod | ||
def __eq__(self, other: object) -> bool: ... | ||
@property | ||
@abc.abstractmethod | ||
def prereleases(self) -> bool | None: ... | ||
@prereleases.setter | ||
def prereleases(self, value: bool) -> None: ... | ||
@abc.abstractmethod | ||
def contains(self, item: str, prereleases: bool | None = None) -> bool: ... | ||
@abc.abstractmethod | ||
def filter(self, iterable: Iterable[UnparsedVersionVar], prereleases: bool | None = None) -> Iterator[UnparsedVersionVar]: ... | ||
|
||
class Specifier(BaseSpecifier): | ||
def __init__(self, spec: str = "", prereleases: bool | None = None) -> None: ... | ||
@property # type: ignore[override] | ||
def prereleases(self) -> bool: ... | ||
@prereleases.setter | ||
def prereleases(self, value: bool) -> None: ... | ||
@property | ||
def operator(self) -> str: ... | ||
@property | ||
def version(self) -> str: ... | ||
def __str__(self) -> str: ... # noqa: Y029 # needed as it's abstract on the superclass | ||
def __hash__(self) -> int: ... | ||
def __eq__(self, other: object) -> bool: ... | ||
def __contains__(self, item: Version | str) -> bool: ... | ||
def contains(self, item: UnparsedVersion, prereleases: bool | None = None) -> bool: ... | ||
def filter(self, iterable: Iterable[UnparsedVersionVar], prereleases: bool | None = None) -> Iterator[UnparsedVersionVar]: ... | ||
|
||
class SpecifierSet(BaseSpecifier): | ||
def __init__(self, spec: str = "", prereleases: bool | None = None) -> None: ... | ||
@property | ||
def prereleases(self) -> bool | None: ... | ||
@prereleases.setter | ||
def prereleases(self, value: bool) -> None: ... | ||
@property | ||
def operator(self) -> str: ... | ||
@property | ||
def version(self) -> str: ... | ||
def __str__(self) -> str: ... # noqa: Y029 # needed as it's abstract on the superclass | ||
def __hash__(self) -> int: ... | ||
def __and__(self, other: SpecifierSet | str) -> SpecifierSet: ... | ||
def __len__(self) -> int: ... | ||
def __iter__(self) -> Iterator[Specifier]: ... | ||
def __eq__(self, other: object) -> bool: ... | ||
def __contains__(self, item: UnparsedVersion) -> bool: ... | ||
def contains(self, item: UnparsedVersion, prereleases: bool | None = None, installed: bool | None = None) -> bool: ... | ||
def filter(self, iterable: Iterable[UnparsedVersionVar], prereleases: bool | None = None) -> Iterator[UnparsedVersionVar]: ... |
49 changes: 49 additions & 0 deletions
49
stubs/setuptools/pkg_resources/_vendor/packaging/version.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
from typing_extensions import Final | ||
|
||
__all__ = ["VERSION_PATTERN", "parse", "Version", "InvalidVersion"] | ||
|
||
def parse(version: str) -> Version: ... | ||
|
||
class InvalidVersion(ValueError): ... | ||
|
||
VERSION_PATTERN: Final[str] | ||
|
||
class _BaseVersion: | ||
def __hash__(self) -> int: ... | ||
def __lt__(self, other: _BaseVersion) -> bool: ... | ||
def __le__(self, other: _BaseVersion) -> bool: ... | ||
def __ge__(self, other: _BaseVersion) -> bool: ... | ||
def __gt__(self, other: _BaseVersion) -> bool: ... | ||
def __eq__(self, other: object) -> bool: ... | ||
def __ne__(self, other: object) -> bool: ... | ||
|
||
class Version(_BaseVersion): | ||
def __init__(self, version: str) -> None: ... | ||
@property | ||
def epoch(self) -> int: ... | ||
@property | ||
def release(self) -> tuple[int, ...]: ... | ||
@property | ||
def pre(self) -> tuple[str, int] | None: ... | ||
@property | ||
def post(self) -> int | None: ... | ||
@property | ||
def dev(self) -> int | None: ... | ||
@property | ||
def local(self) -> str | None: ... | ||
@property | ||
def public(self) -> str: ... | ||
@property | ||
def base_version(self) -> str: ... | ||
@property | ||
def is_prerelease(self) -> bool: ... | ||
@property | ||
def is_postrelease(self) -> bool: ... | ||
@property | ||
def is_devrelease(self) -> bool: ... | ||
@property | ||
def major(self) -> int: ... | ||
@property | ||
def minor(self) -> int: ... | ||
@property | ||
def micro(self) -> int: ... |