mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-19 18:31:14 +08:00
pkg_resources: don't ignore "missing symbol from stub" in stubtest (#11494)
This commit is contained in:
@@ -44,8 +44,3 @@ setuptools._distutils.*
|
||||
# Other vendored code
|
||||
setuptools._vendor.*
|
||||
pkg_resources._vendor.*
|
||||
# Deprecated in favor of importlib.resources, importlib.metadata and their backports
|
||||
# So like distutils, we only add what we need to reference.
|
||||
pkg_resources.AvailableDistributions
|
||||
pkg_resources.ResourceManager
|
||||
pkg_resources.extern
|
||||
|
||||
@@ -6,7 +6,7 @@ from abc import ABCMeta
|
||||
from collections.abc import Callable, Generator, Iterable, Iterator, Sequence
|
||||
from io import BytesIO
|
||||
from re import Pattern
|
||||
from typing import IO, Any, ClassVar, Literal, Protocol, TypeVar, overload, type_check_only
|
||||
from typing import IO, Any, ClassVar, Literal, Protocol, TypeVar, overload
|
||||
from typing_extensions import Self, TypeAlias
|
||||
|
||||
from ._vendored_packaging import requirements as packaging_requirements, version as packaging_version
|
||||
@@ -80,6 +80,8 @@ class Environment:
|
||||
def __iadd__(self, other: Distribution | Environment) -> Self: ...
|
||||
def __add__(self, other: Distribution | Environment) -> Environment: ...
|
||||
|
||||
AvailableDistributions = Environment
|
||||
|
||||
def parse_requirements(strs: str | Iterable[str]) -> Generator[Requirement, None, None]: ...
|
||||
|
||||
class RequirementParseError(packaging_requirements.InvalidRequirement): ...
|
||||
@@ -142,8 +144,10 @@ SOURCE_DIST: int
|
||||
CHECKOUT_DIST: int
|
||||
DEVELOP_DIST: int
|
||||
|
||||
@type_check_only
|
||||
class _IResourceManager(Protocol):
|
||||
class ResourceManager:
|
||||
extraction_path: Incomplete
|
||||
cached_files: Incomplete
|
||||
def __init__(self) -> None: ...
|
||||
def resource_exists(self, package_or_requirement: _PkgReqType, resource_name: str) -> bool: ...
|
||||
def resource_isdir(self, package_or_requirement: _PkgReqType, resource_name: str) -> bool: ...
|
||||
def resource_filename(self, package_or_requirement: _PkgReqType, resource_name: str) -> str: ...
|
||||
@@ -151,10 +155,10 @@ class _IResourceManager(Protocol):
|
||||
def resource_string(self, package_or_requirement: _PkgReqType, resource_name: str) -> bytes: ...
|
||||
def resource_listdir(self, package_or_requirement: _PkgReqType, resource_name: str) -> list[str]: ...
|
||||
def extraction_error(self) -> None: ...
|
||||
def get_cache_path(self, archive_name: str, names: Iterable[str] = ...) -> str: ...
|
||||
def get_cache_path(self, archive_name: str, names: Iterable[str] = ()) -> str: ...
|
||||
def postprocess(self, tempname: str, filename: str) -> None: ...
|
||||
def set_extraction_path(self, path: str) -> None: ...
|
||||
def cleanup_resources(self, force: bool = ...) -> list[str]: ...
|
||||
def cleanup_resources(self, force: bool = False) -> list[str]: ...
|
||||
|
||||
def resource_exists(package_or_requirement: _PkgReqType, resource_name: str) -> bool: ...
|
||||
def resource_isdir(package_or_requirement: _PkgReqType, resource_name: str) -> bool: ...
|
||||
@@ -203,7 +207,7 @@ class ContextualVersionConflict(VersionConflict):
|
||||
class UnknownExtra(ResolutionError): ...
|
||||
|
||||
class ExtractionError(Exception):
|
||||
manager: _IResourceManager
|
||||
manager: ResourceManager
|
||||
cache_path: str
|
||||
original_error: Exception
|
||||
|
||||
@@ -214,9 +218,9 @@ def register_loader_type(loader_type: type, provider_factory: Callable[[types.Mo
|
||||
def register_namespace_handler(importer_type: type, namespace_handler: _NSHandlerType) -> None: ...
|
||||
|
||||
class IResourceProvider(IMetadataProvider, Protocol):
|
||||
def get_resource_filename(self, manager: _IResourceManager, resource_name): ...
|
||||
def get_resource_stream(self, manager: _IResourceManager, resource_name): ...
|
||||
def get_resource_string(self, manager: _IResourceManager, resource_name): ...
|
||||
def get_resource_filename(self, manager: ResourceManager, resource_name): ...
|
||||
def get_resource_stream(self, manager: ResourceManager, resource_name): ...
|
||||
def get_resource_string(self, manager: ResourceManager, resource_name): ...
|
||||
def has_resource(self, resource_name): ...
|
||||
def resource_isdir(self, resource_name): ...
|
||||
def resource_listdir(self, resource_name): ...
|
||||
@@ -231,9 +235,9 @@ class NullProvider:
|
||||
module_path: str | None
|
||||
|
||||
def __init__(self, module) -> None: ...
|
||||
def get_resource_filename(self, manager: _IResourceManager, resource_name) -> str: ...
|
||||
def get_resource_stream(self, manager: _IResourceManager, resource_name) -> BytesIO: ...
|
||||
def get_resource_string(self, manager: _IResourceManager, resource_name): ...
|
||||
def get_resource_filename(self, manager: ResourceManager, resource_name) -> str: ...
|
||||
def get_resource_stream(self, manager: ResourceManager, resource_name) -> BytesIO: ...
|
||||
def get_resource_string(self, manager: ResourceManager, resource_name): ...
|
||||
def has_resource(self, resource_name) -> bool: ...
|
||||
def has_metadata(self, name: str) -> bool | None: ...
|
||||
def get_metadata(self, name: str) -> str: ...
|
||||
|
||||
17
stubs/setuptools/pkg_resources/extern/__init__.pyi
vendored
Normal file
17
stubs/setuptools/pkg_resources/extern/__init__.pyi
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
from _typeshed import Incomplete
|
||||
from collections.abc import Generator
|
||||
|
||||
class VendorImporter:
|
||||
root_name: Incomplete
|
||||
vendored_names: Incomplete
|
||||
vendor_pkg: Incomplete
|
||||
def __init__(self, root_name, vendored_names=(), vendor_pkg: Incomplete | None = None) -> None: ...
|
||||
@property
|
||||
def search_path(self) -> Generator[Incomplete, None, None]: ...
|
||||
def load_module(self, fullname): ...
|
||||
def create_module(self, spec): ...
|
||||
def exec_module(self, module) -> None: ...
|
||||
def find_spec(self, fullname, path: Incomplete | None = None, target: Incomplete | None = None): ...
|
||||
def install(self) -> None: ...
|
||||
|
||||
names: Incomplete
|
||||
Reference in New Issue
Block a user