From a62d6207abb6ec9bde771a9dafe355e9785ea2ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rousset?= Date: Mon, 18 Jul 2016 06:05:39 +0200 Subject: [PATCH] Fix pkg resources (#341) Add types to pkg_resources, mostly rewrote it based on the documentation. Also remove pkg_resources._vendor which generated by stubgen but was implementation specific. --- third_party/3/pkg_resources.pyi | 306 +++++++++++ third_party/3/pkg_resources/__init__.pyi | 508 ------------------ .../3/pkg_resources/_vendor/__init__.py | 0 .../_vendor/packaging/__init__.pyi | 4 - .../_vendor/packaging/specifiers.pyi | 58 -- .../_vendor/packaging/version.pyi | 49 -- 6 files changed, 306 insertions(+), 619 deletions(-) create mode 100644 third_party/3/pkg_resources.pyi delete mode 100644 third_party/3/pkg_resources/__init__.pyi delete mode 100644 third_party/3/pkg_resources/_vendor/__init__.py delete mode 100644 third_party/3/pkg_resources/_vendor/packaging/__init__.pyi delete mode 100644 third_party/3/pkg_resources/_vendor/packaging/specifiers.pyi delete mode 100644 third_party/3/pkg_resources/_vendor/packaging/version.pyi diff --git a/third_party/3/pkg_resources.pyi b/third_party/3/pkg_resources.pyi new file mode 100644 index 000000000..933164220 --- /dev/null +++ b/third_party/3/pkg_resources.pyi @@ -0,0 +1,306 @@ +# Stubs for pkg_resources (Python 3.4) + +from typing import ( + Any, Callable, Dict, IO, Iterable, Generator, Optional, Sequence, Tuple, + Union, + TypeVar, overload, +) +import importlib.abc +import types +import zipimport + +_T = TypeVar('_T') +_NestedStr = Union[str, Iterable[Union[str, Iterable[Any]]]] +_InstallerType = Callable[[Requirement], Optional[Distribution]] +_EPDistType = Union[Distribution, Requirement, str] +_MetadataType = Optional[IResourceProvider] +_PkgReqType = Union[str, Requirement] +_DistFinderType = Callable[[str, _Importer, bool], + Generator[Distribution, None, None]] +_NSHandlerType = Callable[[_Importer, str, str, types.ModuleType], str] + +def declare_namespace(name: str) -> None: ... +def fixup_namespace_packages(path_item: str) -> None: ... + + +class WorkingSet: + entries = ... # type: List[str] + def __init__(self, entries: Optional[Iterable[str]] = ...) -> None: ... + def require(self, *requirements: _NestedStr) -> Sequence[Distribution]: ... + def run_script(self, requires: str, script_name: str) -> None: ... + def iter_entry_points(self, group: str, name: Optional[str] = ...) \ + -> Generator[EntryPoint, None, None]: ... + def add_entry(self, entry: str) -> None: ... + def __contains__(self, dist: Distribution) -> bool: ... + def __iter__(self) -> Generator[Distribution, None, None]: ... + def find(self, req: Requirement) -> Optional[Distribution]: ... + def resolve(self, requirements: Sequence[Requirement], + env: Optional[Environment] = ..., + installer: Optional[_InstallerType] = ...) \ + -> List[Distribution]: ... + def add(self, dist: Distribution, entry: Optional[str] = ..., + insert: bool = ..., replace: bool = ...) -> None: ... + def subscribe(self, callback: Callable[[Distribution], None]) -> None: ... + def find_plugins(self, plugin_env: Environment, + full_env: Optional[Environment] = ..., + fallback: bool = ...) \ + -> Tuple[List[Distribution], + Dict[Distribution, Exception]]: ... + +working_set = ... # type: WorkingSet + +def require(*requirements: Union[str, Sequence[str]]) \ + -> Sequence[Distribution]: ... +def run_script(requires: str, script_name: str) -> None: ... +def iter_entry_points(group: str, name: Optional[str] = ...) \ + -> Generator[EntryPoint, None, None]: ... +def add_activation_listener(callback: Callable[[Distribution], None]) \ + -> None: ... + + +class Environment: + def __init__(self, search_path: Optional[Sequence[str]] = ..., + platform: Optional[str] = ..., + python: Optional[str] = ...) -> None: ... + def __getitem__(self, project_name: str) -> List[Distribution]: ... + def __iter__(self) -> Generator[str, None, None]: ... + def add(self, dist: Distribution) -> None: ... + def remove(self, dist: Distribution) -> None: ... + def can_add(self, dist: Distribution) -> bool: ... + def __add__(self, + other: Union[Distribution, Environment]) -> Environment: ... + def __iadd__(self, + other: Union[Distribution, Environment]) -> Environment: ... + @overload + def best_match(self, req: Requirement, working_set: WorkingSet) -> Distribution: ... + @overload + def best_match(self, req: Requirement, working_set: WorkingSet, + installer: Callable[[Requirement], _T] = ...) -> _T: ... + @overload + def obtain(self, requirement: Requirement) -> None: ... + @overload + def obtain(self, requirement: Requirement, + installer: Callable[[Requirement], _T] = ...) -> _T: ... + def scan(self, search_path: Optional[Sequence[str]] = ...) -> None: ... + + +def parse_requirements(strs: Union[str, Iterable[str]]) -> Generator[Requirement, None, None]: ... + +class Requirement: + project_name = ... # type: str + key = ... # type: str + extras = ... # type: Tuple[str, ...] + specs = ... # type: List[Tuple[str, str]] + @staticmethod + def parse(s: Union[str, Iterable[str]]) -> Requirement: ... + def __contains__(self, + item: Union[Distribution, str, Tuple[str, ...]]) \ + -> bool: ... + def __eq__(self, other_requirement: Any) -> bool: ... + + + +def load_entry_point(dist: _EPDistType, group: str, name: str) -> None: ... +def get_entry_info(dist: _EPDistType, group: str, + name: str) -> Optional[EntryPoint]: ... +@overload +def get_entry_map(dist: _EPDistType) -> Dict[str, Dict[str, EntryPoint]]: ... +@overload +def get_entry_map(dist: _EPDistType, group: str = ...) -> Dict[str, EntryPoint]: ... + +class EntryPoint: + name = ... # type: str + module_name = ... # type: str + attrs = ... # type: Tuple[str, ...] + extras = ... # type: Tuple[str, ...] + dist = ... # type: Optional[Distribution] + def __init__(self, name: str, module_name: str, + attrs: Tuple[str, ...] = ..., extras: Tuple[str, ...] = ..., + dist: Optional[Distribution] = ...) -> None: ... + @classmethod + def parse(cls, src: str, dist: Optional[Distribution] = ...) -> EntryPoint: ... + @classmethod + def parse_group(cls, group: str, lines: Union[str, Sequence[str]], + dist: Optional[Distribution] = ...) -> Dict[str, EntryPoint]: ... + @classmethod + def parse_map(cls, data: Union[Dict[str, Union[str, Sequence[str]]], + str, Sequence[str]], + dist: Optional[Distribution] = ...) -> Dict[str, EntryPoint]: ... + def load(self, require: bool = ..., env: Optional[Environment] = ..., + installer: Optional[_InstallerType] = ...) -> Any: ... + def require(self, env: Optional[Environment] = ..., + installer: Optional[_InstallerType] = ...) -> None: ... + + +def find_distributions(path_item: str, only: bool = ...) \ + -> Generator[Distribution, None, None]: ... +def get_distribution(dist: Union[Requirement, str, Distribution]) -> Distribution: ... + +class Distribution(IResourceProvider, IMetadataProvider): + location = ... # type: str + project_name = ... # type: str + key = ... # type: str + extras = ... # type: List[str] + version = ... # type: str + parsed_version = ... # type: Tuple[str, ...] + py_version = ... # type: str + platform = ... # type: Optional[str] + precedence = ... # type: int + def __init__(self, location: Optional[str] = ..., + metadata: Optional[str] = ..., + project_name: Optional[str] = ..., + version: Optional[str] = ..., py_version: str = ..., + platform: Optional[str] = ..., + precedence: int = ...) -> None: ... + @classmethod + def from_location(cls, location: str, basename: str, + metadata: Optional[str] = ..., + **kw: Union[str, None, int]) -> Distribution: ... + @classmethod + def from_filename(cls, filename: str, metadata: Optional[str] = ..., + **kw: Union[str, None, int]) -> Distribution: ... + def activate(self, path: Optional[List[str]] = ...) -> None: ... + def as_requirement(self) -> Requirement: ... + def requires(self, extras: Tuple[str, ...] = ...) -> List[Requirement]: ... + def clone(self, **kw: Union[str, int, None]) -> Requirement: ... + def egg_name(self) -> str: ... + def __cmp__(self, other: Any) -> bool: ... + def get_entry_info(dist: _EPDistType, group: str, + name: str) -> Optional[EntryPoint]: ... + @overload + def get_entry_map(dist: _EPDistType) \ + -> Dict[str, Dict[str, EntryPoint]]: ... + @overload + def get_entry_map(dist: _EPDistType, group: str = ...) \ + -> Dict[str, EntryPoint]: ... + def load_entry_point(dist: _EPDistType, group: str, name: str) -> None: ... + +EGG_DIST = ... # type: int +BINARY_DIST = ... # type: int +SOURCE_DIST = ... # type: int +CHECKOUT_DIST = ... # type: int +DEVELOP_DIST = ... # type: int + + +def resource_exists(package_or_requirement: _PkgReqType, + resource_name: str) -> bool: ... +def resource_stream(package_or_requirement: _PkgReqType, + resource_name: str) -> IO[bytes]: ... +def resource_string(package_or_requirement: _PkgReqType, + resource_name: str) -> str: ... +def resource_isdir(package_or_requirement: _PkgReqType, + resource_name: str) -> bool: ... +def resource_listdir(package_or_requirement: _PkgReqType, + resource_name: str) -> List[str]: ... + +def resource_filename(package_or_requirement: _PkgReqType, + resource_name: str) -> str: ... +def set_extraction_path(path: str) -> None: ... +def cleanup_resources(force: bool = ...) -> List[str]: ... + +class IResourceManager: + def resource_exists(self, package_or_requirement: _PkgReqType, + resource_name: str) -> bool: ... + def resource_stream(self, package_or_requirement: _PkgReqType, + resource_name: str) -> IO[bytes]: ... + def resource_string(self, package_or_requirement: _PkgReqType, + resource_name: str) -> str: ... + def resource_isdir(self, package_or_requirement: _PkgReqType, + resource_name: str) -> bool: ... + def resource_listdir(self, package_or_requirement: _PkgReqType, + resource_name: str) -> List[str]: ... + def resource_filename(self, package_or_requirement: _PkgReqType, + resource_name: str) -> str: ... + def set_extraction_path(self, path: str) -> None: ... + def cleanup_resources(self, force: bool = ...) -> List[str]: ... + def get_cache_path(self, archive_name: str, + names: Tuple[str, ...] = ...) -> str: ... + def extraction_error(self) -> None: ... + def postprocess(self, tempname: str, filename: str) -> None: ... + + +@overload +def get_provider(package_or_requirement: str) -> IResourceProvider: ... +@overload +def get_provider(package_or_requirement: Requirement) -> Distribution: ... + +class IMetadataProvider: + def has_metadata(name: str) -> bool: ... + def metadata_isdir(name: str) -> bool: ... + def metadata_listdir(name: str) -> List[str]: ... + def get_metadata(name: str) -> str: ... + def get_metadata_lines(name: str) -> Generator[List[str], None, None]: ... + def run_script(script_name: str, namespace: Dict[str, Any]) -> None: ... + + +class ResolutionError(Exception): ... +class DistributionNotFound(ResolutionError): ... +class VersionConflict(ResolutionError): ... +class UnknownExtra(ResolutionError): ... + +class ExtractionError(Exception): + manager = ... # type: IResourceManager + cache_path = ... # type: str + original_error = ... # type: Exception + + +class _Importer(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader): ... + +def register_finder(importer_type: type, + distribution_finder: _DistFinderType) -> None : ... +def register_loader_type(loader_type: type, + provider_factory: Callable[[types.ModuleType], + IResourceProvider]) \ + -> None: ... +def register_namespace_handler(importer_type: type, + namespace_handler: _NSHandlerType) -> None: ... + + +class IResourceProvider(IMetadataProvider): ... + + +class NullProvider: ... + +class EggProvider(NullProvider): ... + +class DefaultProvider(EggProvider): ... + +class PathMetadata(DefaultProvider, IResourceProvider): + def __init__(self, path: str, egg_info: str) -> None: ... + +class ZipProvider(EggProvider): ... + +class EggMetadata(ZipProvider, IResourceProvider): + def __init__(self, zipimporter: zipimport.zipimporter) -> None: ... + +class EmptyProvider(NullProvider): ... + +empty_provider = ... # type: EmptyProvider + +class FileMetadata(EmptyProvider, IResourceProvider): + def __init__(self, path_to_pkg_info: str) -> None: ... + + +def parse_version(v: str) -> Tuple[str, ...]: ... +def yield_lines(strs: _NestedStr) -> Generator[str, None, None]: ... +def split_sections(strs: _NestedStr) \ + -> Generator[Tuple[Optional[str], str], None, None]: ... +def safe_name(name: str) -> str: ... +def safe_version(version: str) -> str: ... +def safe_extra(extra: str) -> str: ... +def to_filename(name_or_version: str) -> str: ... + + +def get_build_platform() -> str: ... +def get_platform() -> str: ... +def get_supported_platform() -> str: ... +def compatible_platforms(provided: Optional[str], + required: Optional[str]) -> bool: ... +def get_default_cache() -> str: ... + + +def get_importer(path_item: str) -> _Importer: ... + + +def ensure_directory(path: str) -> None: ... +def normalize_path(filename: str) -> str: ... diff --git a/third_party/3/pkg_resources/__init__.pyi b/third_party/3/pkg_resources/__init__.pyi deleted file mode 100644 index ef5801962..000000000 --- a/third_party/3/pkg_resources/__init__.pyi +++ /dev/null @@ -1,508 +0,0 @@ -# Stubs for pkg_resources (Python 3.5) -# -# NOTE: This dynamically typed stub was automatically generated by stubgen. -# NOTE: Still a little bit incomplete. - -from typing import (Any, List, Callable, Union, Tuple, Iterator, Iterable, - Dict, Optional, Pattern) -import io -from collections import namedtuple -import zipfile - -from ._vendor.packaging import version -from ._vendor.packaging.specifiers import SpecifierSet - - -SetuptoolsVersionType = Union['SetuptoolsVersion', 'SetuptoolsLegacyVersion'] -StrOrSequenceOfLines = Union[str, Iterable[str]] - -PackageOrRequirementType = Union[str, 'Requirement'] - -# TODO -LoaderType = Any -ModuleType = Any -ProviderFactoryType = Callable[[ModuleType], 'IResourceProvider'] - -# entry point funcs types -EntryPointFuncsDist = Union['Distribution', 'Requirement', str] -EntryPointFuncsGroup = Dict[str, 'EntryPoint'] -EntryPointFuncsMap = Dict[str, EntryPointFuncsGroup] - -OnChangeCallback = Callable[['Distribution'], None] -InstallerCallback = Callable[['Requirement'], 'Distribution'] -FindPluginsOutput = Tuple[List['Distribution'], Dict['Distribution', 'ResolutionError']] - -ImporterClassType = Any -FinderCallable = Callable[[ImporterClassType, str, bool], Iterator['Distribution']] -ImporterType = Any -NamespaceHandlerCallable = Callable[[ImporterType, str, str, ModuleType], str] - -EPAttrsType = Tuple[str, ...] -EPExtrasType = Tuple[str, ...] - -require = ... # type: Optional[Callable[..., List[Distribution]]] -working_set = ... # type: Optional[WorkingSet] - -class PEP440Warning(RuntimeWarning): ... - -class _SetuptoolsVersionMixin: - def __hash__(self) -> int: ... - def __lt__(self, other) -> bool: ... - def __le__(self, other) -> bool: ... - def __eq__(self, other) -> bool: ... - def __ge__(self, other) -> bool: ... - def __gt__(self, other) -> bool: ... - def __ne__(self, other) -> bool: ... - def __getitem__(self, key: Any) -> Any: ... - def __iter__(self) -> Iterator[str]: ... - - -class SetuptoolsVersion(_SetuptoolsVersionMixin, version.Version): ... -class SetuptoolsLegacyVersion(_SetuptoolsVersionMixin, version.LegacyVersion): ... - - -def parse_version(v: str) -> SetuptoolsVersionType: ... - -class ResolutionError(Exception): ... - -class VersionConflict(ResolutionError): - @property - def dist(self) -> Distribution: ... - @property - def req(self) -> Requirement: ... - def report(self) -> str: ... - # TODO: fill required_by - def with_context(self, required_by) -> Union['VersionConflict', 'ContextualVersionConflict']: ... - - -class ContextualVersionConflict(VersionConflict): - @property - # TODO: fill required_by - def required_by(self): ... - -# TODO -class DistributionNotFound(ResolutionError): - @property - def req(self) -> Requirement: ... - @property - def requirers(self): ... - @property - def requirers_str(self) -> str: ... - def report(self) -> str: ... - -class UnknownExtra(ResolutionError): ... - -EGG_DIST = ... # type: int -BINARY_DIST = ... # type: int -SOURCE_DIST = ... # type: int -CHECKOUT_DIST = ... # type: int -DEVELOP_DIST = ... # type: int - -# TODO -def register_loader_type(loader_type: LoaderType, - provider_factory: ProviderFactoryType) -> None: ... -def get_provider(moduleOrReq: PackageOrRequirementType) -> Union['IResourceProvider', 'Distribution']: ... - -get_platform = ... # type: Callable[[], str] - -def compatible_platforms(provided: Optional[str], required: Optional[str]) -> bool: ... -def run_script(dist_spec, script_name: str) -> None: ... - -run_main = ... # type: Any - -def get_distribution(dist: EntryPointFuncsDist) -> 'Distribution': ... -def load_entry_point(dist: EntryPointFuncsDist, group: str, name: str) -> 'EntryPoint': ... -def get_entry_map(dist: EntryPointFuncsDist, - group: Optional[str] = None) -> EntryPointFuncsMap: ... -def get_entry_info(dist: EntryPointFuncsDist, group: str, name: str) -> Optional['EntryPoint']: ... - -# TODO -class IMetadataProvider: - def has_metadata(name): ... - def get_metadata(name): ... - def get_metadata_lines(name): ... - def metadata_isdir(name): ... - def metadata_listdir(name): ... - def run_script(script_name, namespace): ... - -# TODO -class IResourceProvider(IMetadataProvider): - def get_resource_filename(manager, resource_name): ... - def get_resource_stream(manager, resource_name): ... - def get_resource_string(manager, resource_name): ... - def has_resource(resource_name): ... - def resource_isdir(resource_name): ... - def resource_listdir(resource_name): ... - -class WorkingSet: - entries = ... # type: List[str] - entry_keys = ... # type: Dict[str, List[str]] - by_key = ... # type: Dict[str, Distribution] - callbacks = ... # type: List[OnChangeCallback] - - def __init__(self, entries: List[str] = None) -> None: ... - def add_entry(self, entry: str) -> None: ... - def __contains__(self, dist: Distribution) -> bool: ... - def find(self, req: Requirement) -> Distribution: ... - def iter_entry_points(self, group: str, - name: str = None) -> Iterator[EntryPoint]: ... - # TODO: add type RequirementsType and add here - def run_script(self, requires, script_name: str) -> None: ... - def __iter__(self) -> Iterator[Distribution]: ... - def add(self, dist: Distribution, - entry: str = None, - insert: bool = ..., - replace: bool = ...) -> None: ... - def resolve(self, requirements: Iterable[Requirement], - env: Environment = None, - installer: Optional[InstallerCallback] = None, - replace_conflicting: bool = ...) -> List[Distribution]: ... - def find_plugins(self, plugin_env: Environment, - full_env: Optional[Environment] = None, - installer: Optional[InstallerCallback] = None, - fallback: bool = ...) -> FindPluginsOutput: ... - # TODO: check requirements type - def require(self, *requirements: StrOrSequenceOfLines) -> List[Distribution]: ... - def subscribe(self, callback: OnChangeCallback) -> None: ... - -class Environment: - platform = ... # type: str - python = ... # type: str - def __init__(self, search_path: Iterable[str] = None, - platform: str = ..., - python: str = ...) -> None: ... - def can_add(self, dist: Distribution) -> bool: ... - def remove(self, dist: Distribution) -> None: ... - def scan(self, search_path: Optional[Iterable[str]] = None) -> None: ... - def __getitem__(self, project_name: str) -> List[Distribution]: ... - def add(self, dist: Distribution) -> None: ... - def best_match(self, req: Requirement, - working_set: WorkingSet, - installer: Optional[InstallerCallback] = None) -> Optional[Distribution]: ... - def obtain(self, requirement: Requirement, - installer: Optional[InstallerCallback] = None) -> Optional[Distribution]: ... - def __iter__(self) -> Iterator[str]: ... - def __iadd__(self, other: Union[Distribution, 'Environment']) -> 'Environment': ... - def __add__(self, other: Union[Distribution, 'Environment']) -> 'Environment': ... - -AvailableDistributions = ... # type: Environment - -class ExtractionError(RuntimeError): ... - -class ResourceManager: - extraction_path = ... # type: Any - cached_files = ... # type: Any - def __init__(self) -> None: ... - def resource_exists(self, package_or_requirement: PackageOrRequirementType, - resource_name: str) -> bool: ... - def resource_isdir(self, package_or_requirement: PackageOrRequirementType, - resource_name: str) -> bool: ... - def resource_filename(self, package_or_requirement: PackageOrRequirementType, - resource_name: str) -> str: ... - # TODO: return type - def resource_stream(self, package_or_requirement: PackageOrRequirementType, - resource_name: str): ... - # TODO: return type - def resource_string(self, package_or_requirement: PackageOrRequirementType, - resource_name: str): ... - def resource_listdir(self, package_or_requirement: PackageOrRequirementType, - resource_name: str) -> List[str]: ... - def extraction_error(self) -> None: ... - 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 get_default_cache() -> str: ... - -def safe_name(name: str) -> str: ... - -def safe_version(version: str) -> str: ... - -def safe_extra(extra: str) -> str: ... - -def to_filename(name: str) -> str: ... - -def invalid_marker(text: str) -> Union[SyntaxError, bool]: ... - -def evaluate_marker(text: str, extra=None) -> bool: ... - - -class NullProvider: - egg_name = ... # type: Optional[str] - egg_info = ... # type: Optional[str] - loader = ... # type: Optional[LoaderType] - module_path = ... # type: Optional[str] - # TODO: init param - def __init__(self, module) -> None: ... - def get_resource_filename(self, manager: ResourceManager, resource_name: str) -> str: ... - # TODO: return type - def get_resource_stream(self, manager: ResourceManager, resource_name: str) -> io.BytesIO: ... - # TODO: return type - def get_resource_string(self, manager: ResourceManager, resource_name: str): ... - 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) -> Iterator[str]: ... - def resource_isdir(self, resource_name: str) -> bool: ... - def metadata_isdir(self, name: str) -> bool: ... - 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: ... - - -class EggProvider(NullProvider): - # TODO: module type - def __init__(self, module) -> None: ... - - -class DefaultProvider(EggProvider): - # TODO: return type - def get_resource_stream(self, manager: ResourceManager, resource_name: str): ... - - -class EmptyProvider(NullProvider): - module_path = ... # type: Optional[str] - def __init__(self) -> None: ... - - -empty_provider = ... # type: EmptyProvider - - -class ZipManifests(dict): - @classmethod - def build(cls, path): ... - load = ... # type: Any - - -class MemoizedZipManifests(ZipManifests): ... - - -manifest_mod = namedtuple('manifest_mod', 'manifest mtime') -def load(self, path): ... - - -class ContextualZipFile(zipfile.ZipFile): - def __enter__(self): ... - def __exit__(self, type, value, traceback): ... - def __new__(cls, *args, **kwargs): ... - - -class ZipProvider(EggProvider): - eagers = ... # type: Optional[List[str]] - - zip_pre = ... # type: str - - def __init__(self, module) -> None: ... - - @property - def zipinfo(self): ... - - def get_resource_filename(self, manager: ResourceManager, resource_name: str) -> str: ... - -class FileMetadata(EmptyProvider): - path = ... # type: Any - - def __init__(self, path) -> None: ... - - def has_metadata(self, name: str) -> bool: ... - # TODO - def get_metadata(self, name: str): ... - - def get_metadata_lines(self, name): ... - - -class PathMetadata(DefaultProvider): - module_path = ... # type: Optional[str] - - egg_info = ... # type: Optional[str] - - def __init__(self, path: str, egg_info: str) -> None: ... - - -class EggMetadata(ZipProvider): - zip_pre = ... # type: str - - loader = ... # type: Optional[LoaderType] - - module_path = ... # type: Optional[str] - - def __init__(self, importer: ImporterType) -> None: ... - -def register_finder(importer_type: ImporterClassType, - distribution_finder: FinderCallable): ... - -def find_distributions(path_item: str, - only: bool = ...) -> Iterator['Distribution']: ... - -def register_namespace_handler(importer_type: ImporterClassType, - namespace_handler: NamespaceHandlerCallable): ... - -def declare_namespace(packageName: str) -> None: ... - -# TODO: -def fixup_namespace_packages(path_item, parent=None): ... - -def normalize_path(filename: str) -> str: ... - -def yield_lines(strs: StrOrSequenceOfLines) -> Iterator[str]: ... - -class EntryPoint: - name = ... # type: str - module_name = ... # type: str - attrs = ... # type: EPAttrsType - extras = ... # type: EPExtrasType - dist = ... # type: Optional['Distribution'] - def __init__(self, name: str, module_name: str, - attrs: EPAttrsType=..., - extras: EPExtrasType=..., - dist: Optional['Distribution'] = None) -> None: ... - def load(self, - require: bool = ..., - *args, **kwargs) -> Any: ... - def resolve(self) -> Any: ... - def require(self, - env: Optional[Environment] = None, - installer: Optional[InstallerCallback] = None) -> None: ... - pattern = ... # type: Pattern - @classmethod - def parse(cls, src: str, - dist: Optional['Distribution'] = None) -> 'EntryPoint': ... - @classmethod - def parse_group(cls, group: str, lines: StrOrSequenceOfLines, - dist: Optional['Distribution'] = None) -> EntryPointFuncsGroup: ... - @classmethod - def parse_map(cls, - data: Union[Dict[str, StrOrSequenceOfLines], StrOrSequenceOfLines], - dist: Optional['Distribution'] = None) -> EntryPointFuncsMap: ... - -class Distribution: - PKG_INFO = ... # type: str - project_name = ... # type: str - py_version = ... # type: str - platform = ... # type: Optional[str] - location = ... # type: str - precedence = ... # type: int - - def __init__(self, - location: Optional[str] = None, - metadata: Optional[IResourceProvider] = None, - project_name: Optional[str] = None, - version: Optional[str] = None, - py_version: str = ..., - platform: Optional[str] = None, - precedence: int = ...) -> None: ... - - @classmethod - def from_location(cls, - location: str, - basename: str, - metadata: Optional[IResourceProvider] = None, - **kw) -> 'Distribution': ... - - # TODO: add exact tuple form - @property - def hashcmp(self) -> Tuple[SetuptoolsVersionType, int, str, str, str, str]: ... - def __hash__(self) -> int: ... - def __lt__(self, other: 'Distribution') -> bool: ... - def __le__(self, other: 'Distribution') -> bool: ... - def __gt__(self, other: 'Distribution') -> bool: ... - def __ge__(self, other: 'Distribution') -> bool: ... - def __eq__(self, other: Any) -> bool: ... - def __ne__(self, other: Any) -> bool: ... - - @property - def key(self) -> str: ... - - @property - def parsed_version(self) -> SetuptoolsVersionType: ... - - @property - def version(self) -> str: ... - - def requires(self, - extras: Iterable[str] = ...) -> List[Requirement]: ... - - def activate(self, - path: Optional[Iterable[str]] = None) -> None: ... - - def egg_name(self) -> str: ... - - def __getattr__(self, attr: str) -> Any: ... - - @classmethod - def from_filename(cls, filename: str, - metadata: Optional[IResourceProvider] = None, **kw) -> 'Distribution': ... - - def as_requirement(self) -> Requirement: ... - - def load_entry_point(self, group: str, name: str) -> Any: ... - - def get_entry_map(self, - group: Optional[str] = None) -> EntryPointFuncsMap: ... - - def get_entry_info(self, group: str, name: str) -> Optional[EntryPoint]: ... - - def insert_on(self, path: List[str], - loc: Optional[str] = None, - replace: bool = ...) -> None: ... - - def check_version_conflict(self) -> None: ... - - def has_version(self) -> bool: ... - - def clone(self, **kw) -> 'Distribution': ... - - @property - def extras(self) -> List[str]: ... - - -class EggInfoDistribution(Distribution): ... - - -class DistInfoDistribution(Distribution): - PKG_INFO = ... # type: str - EQEQ = ... # type: Pattern - - -class RequirementParseError(ValueError): ... - - -def parse_requirements(strs) -> Iterator['Requirement']: ... - - -class Requirement: - project_name = ... # type: str - key = ... # type: str - specifier = ... # type: SpecifierSet - specs = ... # type: List[Tuple[str, str]] - extras = ... # type: Tuple[str] - hashCmp = ... # type: Tuple[str, SpecifierSet, frozenset] - - def __init__(self, project_name: str, specs: List[Tuple[str, str]], - extras: Tuple[str]) -> None: ... - def __eq__(self, other: Any) -> bool: ... - def __ne__(self, other: Any) -> bool: ... - def __contains__(self, item: Union[Distribution, str]) -> bool: ... - def __hash__(self) -> int: ... - - @staticmethod - def parse(s: StrOrSequenceOfLines) -> 'Requirement': ... - -def ensure_directory(path: str) -> None: ... - -ContentType = List[str] -def split_sections(s) -> Iterator[Tuple[Optional[str], ContentType]]: ... - -# Names in __all__ with no definition: -# add_activation_listener -# cleanup_resources -# iter_entry_points -# resource_exists -# resource_filename -# resource_isdir -# resource_listdir -# resource_stream -# resource_string -# set_extraction_path diff --git a/third_party/3/pkg_resources/_vendor/__init__.py b/third_party/3/pkg_resources/_vendor/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/third_party/3/pkg_resources/_vendor/packaging/__init__.pyi b/third_party/3/pkg_resources/_vendor/packaging/__init__.pyi deleted file mode 100644 index 6ccb56e89..000000000 --- a/third_party/3/pkg_resources/_vendor/packaging/__init__.pyi +++ /dev/null @@ -1,4 +0,0 @@ -# Stubs for packaging (Python 3.5) -# -# NOTE: This dynamically typed stub was automatically generated by stubgen. - diff --git a/third_party/3/pkg_resources/_vendor/packaging/specifiers.pyi b/third_party/3/pkg_resources/_vendor/packaging/specifiers.pyi deleted file mode 100644 index df128e015..000000000 --- a/third_party/3/pkg_resources/_vendor/packaging/specifiers.pyi +++ /dev/null @@ -1,58 +0,0 @@ -# Stubs for packaging.specifiers (Python 3.5) -# -# NOTE: This dynamically typed stub was automatically generated by stubgen. -import abc - -class InvalidSpecifier(ValueError): ... - -class BaseSpecifier: - def __hash__(self): ... - def __eq__(self, other): ... - def __ne__(self, other): ... - @abc.abstractproperty - def prereleases(self): ... - @prereleases.setter - def prereleases(self, value): ... - def contains(self, item, prereleases=None): ... - def filter(self, iterable, prereleases=None): ... - -class _IndividualSpecifier(BaseSpecifier): - def __init__(self, spec:str=..., prereleases=None) -> None: ... - def __hash__(self): ... - def __eq__(self, other): ... - def __ne__(self, other): ... - @property - def operator(self): ... - @property - def version(self): ... - @property - def prereleases(self): ... - @prereleases.setter - def prereleases(self, value): ... - def __contains__(self, item): ... - def contains(self, item, prereleases=None): ... - def filter(self, iterable, prereleases=None): ... - -class LegacySpecifier(_IndividualSpecifier): ... - -class Specifier(_IndividualSpecifier): - @property - def prereleases(self): ... - @prereleases.setter - def prereleases(self, value): ... - -class SpecifierSet(BaseSpecifier): - def __init__(self, specifiers:str=..., prereleases=None) -> None: ... - def __hash__(self): ... - def __and__(self, other): ... - def __eq__(self, other): ... - def __ne__(self, other): ... - def __len__(self): ... - def __iter__(self): ... - @property - def prereleases(self): ... - @prereleases.setter - def prereleases(self, value): ... - def __contains__(self, item): ... - def contains(self, item, prereleases=None): ... - def filter(self, iterable, prereleases=None): ... diff --git a/third_party/3/pkg_resources/_vendor/packaging/version.pyi b/third_party/3/pkg_resources/_vendor/packaging/version.pyi deleted file mode 100644 index 8f5cd41e6..000000000 --- a/third_party/3/pkg_resources/_vendor/packaging/version.pyi +++ /dev/null @@ -1,49 +0,0 @@ -# Stubs for packaging.version (Python 3.5) -# -# NOTE: This dynamically typed stub was automatically generated by stubgen. - -from typing import Any -from collections import namedtuple - -_Version = namedtuple('_Version', ['epoch', 'release', 'dev', 'pre', 'post', 'local']) - -def parse(version): ... - -class InvalidVersion(ValueError): ... - -class _BaseVersion: - def __hash__(self): ... - def __lt__(self, other): ... - def __le__(self, other): ... - def __eq__(self, other): ... - def __ge__(self, other): ... - def __gt__(self, other): ... - def __ne__(self, other): ... - -class LegacyVersion(_BaseVersion): - def __init__(self, version): ... - @property - def public(self): ... - @property - def base_version(self): ... - @property - def local(self): ... - @property - def is_prerelease(self): ... - @property - def is_postrelease(self): ... - -VERSION_PATTERN = ... # type: Any - -class Version(_BaseVersion): - def __init__(self, version): ... - @property - def public(self): ... - @property - def base_version(self): ... - @property - def local(self): ... - @property - def is_prerelease(self): ... - @property - def is_postrelease(self): ...