mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-23 19:41:51 +08:00
Use strict pyright configs for pkg_resources (#11538)
This commit is contained in:
@@ -73,7 +73,7 @@
|
||||
"stubs/redis",
|
||||
"stubs/requests",
|
||||
"stubs/requests-oauthlib",
|
||||
"stubs/setuptools",
|
||||
"stubs/setuptools/setuptools",
|
||||
"stubs/stripe",
|
||||
"stubs/tqdm",
|
||||
"stubs/ttkthemes",
|
||||
|
||||
@@ -24,6 +24,7 @@ _ModuleLike: TypeAlias = object | types.ModuleType # Any object that optionally
|
||||
_ProviderFactoryType: TypeAlias = Callable[[_ModuleLike], IResourceProvider]
|
||||
_DistFinderType: TypeAlias = Callable[[_T, str, bool], Iterable[Distribution]]
|
||||
_NSHandlerType: TypeAlias = Callable[[_T, str, str, types.ModuleType], str | None]
|
||||
_ResourceStream: TypeAlias = Incomplete # A readable file-like object
|
||||
|
||||
__all__ = [
|
||||
"require",
|
||||
@@ -104,7 +105,7 @@ class _ZipLoaderModule(Protocol):
|
||||
__loader__: zipimport.zipimporter
|
||||
|
||||
def declare_namespace(packageName: str) -> None: ...
|
||||
def fixup_namespace_packages(path_item: str, parent=None) -> None: ...
|
||||
def fixup_namespace_packages(path_item: str, parent: str | None = None) -> None: ...
|
||||
|
||||
class WorkingSet:
|
||||
entries: list[str]
|
||||
@@ -122,10 +123,14 @@ class WorkingSet:
|
||||
env: Environment | None = None,
|
||||
installer: _InstallerType | None = None,
|
||||
replace_conflicting: bool = False,
|
||||
extras=None,
|
||||
extras: tuple[str, ...] | None = None,
|
||||
) -> list[Distribution]: ...
|
||||
def find_plugins(
|
||||
self, plugin_env: Environment, full_env: Environment | None = None, installer=None, fallback: bool = True
|
||||
self,
|
||||
plugin_env: Environment,
|
||||
full_env: Environment | None = None,
|
||||
installer: _InstallerType | None = None,
|
||||
fallback: bool = True,
|
||||
) -> tuple[list[Distribution], dict[Distribution, Exception]]: ...
|
||||
def require(self, *requirements: _NestedStr) -> Sequence[Distribution]: ...
|
||||
def subscribe(self, callback: Callable[[Distribution], object], existing: bool = True) -> None: ...
|
||||
@@ -304,15 +309,15 @@ def register_loader_type(loader_type: type[_ModuleLike], provider_factory: _Prov
|
||||
def register_namespace_handler(importer_type: type[_T], namespace_handler: _NSHandlerType[_T]) -> None: ...
|
||||
|
||||
class IResourceProvider(IMetadataProvider, Protocol):
|
||||
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): ...
|
||||
def get_resource_filename(self, manager: ResourceManager, resource_name: str) -> StrPath: ...
|
||||
def get_resource_stream(self, manager: ResourceManager, resource_name: str) -> _ResourceStream: ...
|
||||
def get_resource_string(self, manager: ResourceManager, resource_name: str) -> bytes: ...
|
||||
def has_resource(self, resource_name: str) -> bool: ...
|
||||
def resource_isdir(self, resource_name: str) -> bool: ...
|
||||
def resource_listdir(self, resource_name: str) -> list[str]: ...
|
||||
|
||||
def invalid_marker(text) -> SyntaxError | Literal[False]: ...
|
||||
def evaluate_marker(text, extra: Incomplete | None = None): ...
|
||||
def invalid_marker(text: str) -> SyntaxError | Literal[False]: ...
|
||||
def evaluate_marker(text: str, extra: Incomplete | None = None) -> bool: ...
|
||||
|
||||
class NullProvider:
|
||||
egg_name: str | None
|
||||
@@ -321,16 +326,16 @@ class NullProvider:
|
||||
module_path: str | None
|
||||
|
||||
def __init__(self, module: _ModuleLike) -> None: ...
|
||||
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 get_resource_filename(self, manager: ResourceManager, resource_name: str) -> str: ...
|
||||
def get_resource_stream(self, manager: ResourceManager, resource_name: str) -> BytesIO: ...
|
||||
def get_resource_string(self, manager: ResourceManager, resource_name: str) -> bytes: ...
|
||||
def has_resource(self, resource_name: str) -> bool: ...
|
||||
def has_metadata(self, name: str) -> bool: ...
|
||||
def get_metadata(self, name: str) -> str: ...
|
||||
def get_metadata_lines(self, name: str) -> chain[str]: ...
|
||||
def resource_isdir(self, resource_name) -> bool: ...
|
||||
def resource_isdir(self, resource_name: str) -> bool: ...
|
||||
def metadata_isdir(self, name: str) -> bool: ...
|
||||
def resource_listdir(self, resource_name) -> list[str]: ...
|
||||
def resource_listdir(self, resource_name: str) -> list[str]: ...
|
||||
def metadata_listdir(self, name: str) -> list[str]: ...
|
||||
def run_script(self, script_name: str, namespace: dict[str, Any]) -> None: ...
|
||||
|
||||
@@ -383,7 +388,7 @@ class Distribution(NullProvider):
|
||||
@overload
|
||||
def get_entry_map(self, group: str) -> dict[str, EntryPoint]: ...
|
||||
def get_entry_info(self, group: str, name: str) -> EntryPoint | None: ...
|
||||
def insert_on(self, path, loc: Incomplete | None = None, replace: bool = False) -> None: ...
|
||||
def insert_on(self, path: list[str], loc: Incomplete | None = None, replace: bool = False) -> None: ...
|
||||
def check_version_conflict(self) -> None: ...
|
||||
def has_version(self) -> bool: ...
|
||||
def clone(self, **kw: str | int | IResourceProvider | None) -> Requirement: ...
|
||||
|
||||
Reference in New Issue
Block a user