1 # Stubs for pkg_resources (Python 3.4)
\r
4 Any, Callable, Dict, IO, Iterable, Generator, Optional, Sequence, Tuple,
\r
8 from abc import ABCMeta
\r
14 _NestedStr = Union[str, Iterable[Union[str, Iterable[Any]]]]
\r
15 _InstallerType = Callable[[Requirement], Optional[Distribution]]
\r
16 _EPDistType = Union[Distribution, Requirement, str]
\r
17 _MetadataType = Optional[IResourceProvider]
\r
18 _PkgReqType = Union[str, Requirement]
\r
19 _DistFinderType = Callable[[str, _Importer, bool],
\r
20 Generator[Distribution, None, None]]
\r
21 _NSHandlerType = Callable[[_Importer, str, str, types.ModuleType], str]
\r
23 def declare_namespace(name: str) -> None: ...
\r
24 def fixup_namespace_packages(path_item: str) -> None: ...
\r
28 entries = ... # type: List[str]
\r
29 def __init__(self, entries: Optional[Iterable[str]] = ...) -> None: ...
\r
30 def require(self, *requirements: _NestedStr) -> Sequence[Distribution]: ...
\r
31 def run_script(self, requires: str, script_name: str) -> None: ...
\r
32 def iter_entry_points(self, group: str, name: Optional[str] = ...) \
\r
33 -> Generator[EntryPoint, None, None]: ...
\r
34 def add_entry(self, entry: str) -> None: ...
\r
35 def __contains__(self, dist: Distribution) -> bool: ...
\r
36 def __iter__(self) -> Generator[Distribution, None, None]: ...
\r
37 def find(self, req: Requirement) -> Optional[Distribution]: ...
\r
38 def resolve(self, requirements: Sequence[Requirement],
\r
39 env: Optional[Environment] = ...,
\r
40 installer: Optional[_InstallerType] = ...) \
\r
41 -> List[Distribution]: ...
\r
42 def add(self, dist: Distribution, entry: Optional[str] = ...,
\r
43 insert: bool = ..., replace: bool = ...) -> None: ...
\r
44 def subscribe(self, callback: Callable[[Distribution], None]) -> None: ...
\r
45 def find_plugins(self, plugin_env: Environment,
\r
46 full_env: Optional[Environment] = ...,
\r
47 fallback: bool = ...) \
\r
48 -> Tuple[List[Distribution],
\r
49 Dict[Distribution, Exception]]: ...
\r
51 working_set = ... # type: WorkingSet
\r
54 *requirements: Union[str, Sequence[str]]
\r
55 ) -> Sequence[Distribution]: ...
\r
56 def run_script(requires: str, script_name: str) -> None: ...
\r
57 def iter_entry_points(
\r
58 group: str, name: Optional[str] = ...
\r
59 ) -> Generator[EntryPoint, None, None]: ...
\r
60 def add_activation_listener(
\r
61 callback: Callable[[Distribution], None]
\r
66 def __init__(self, search_path: Optional[Sequence[str]] = ...,
\r
67 platform: Optional[str] = ...,
\r
68 python: Optional[str] = ...) -> None: ...
\r
69 def __getitem__(self, project_name: str) -> List[Distribution]: ...
\r
70 def __iter__(self) -> Generator[str, None, None]: ...
\r
71 def add(self, dist: Distribution) -> None: ...
\r
72 def remove(self, dist: Distribution) -> None: ...
\r
73 def can_add(self, dist: Distribution) -> bool: ...
\r
75 other: Union[Distribution, Environment]) -> Environment: ...
\r
77 other: Union[Distribution, Environment]) -> Environment: ...
\r
79 def best_match(self, req: Requirement, working_set: WorkingSet) -> Distribution: ...
\r
81 def best_match(self, req: Requirement, working_set: WorkingSet,
\r
82 installer: Callable[[Requirement], _T] = ...) -> _T: ...
\r
84 def obtain(self, requirement: Requirement) -> None: ...
\r
86 def obtain(self, requirement: Requirement,
\r
87 installer: Callable[[Requirement], _T] = ...) -> _T: ...
\r
88 def scan(self, search_path: Optional[Sequence[str]] = ...) -> None: ...
\r
91 def parse_requirements(strs: Union[str, Iterable[str]]) -> Generator[Requirement, None, None]: ...
\r
94 project_name = ... # type: str
\r
95 key = ... # type: str
\r
96 extras = ... # type: Tuple[str, ...]
\r
97 specs = ... # type: List[Tuple[str, str]]
\r
99 def parse(s: Union[str, Iterable[str]]) -> Requirement: ...
\r
100 def __contains__(self,
\r
101 item: Union[Distribution, str, Tuple[str, ...]]) \
\r
103 def __eq__(self, other_requirement: Any) -> bool: ...
\r
105 def load_entry_point(dist: _EPDistType, group: str, name: str) -> None: ...
\r
106 def get_entry_info(dist: _EPDistType, group: str,
\r
107 name: str) -> Optional[EntryPoint]: ...
\r
109 def get_entry_map(dist: _EPDistType) -> Dict[str, Dict[str, EntryPoint]]: ...
\r
111 def get_entry_map(dist: _EPDistType, group: str) -> Dict[str, EntryPoint]: ...
\r
114 name = ... # type: str
\r
115 module_name = ... # type: str
\r
116 attrs = ... # type: Tuple[str, ...]
\r
117 extras = ... # type: Tuple[str, ...]
\r
118 dist = ... # type: Optional[Distribution]
\r
119 def __init__(self, name: str, module_name: str,
\r
120 attrs: Tuple[str, ...] = ..., extras: Tuple[str, ...] = ...,
\r
121 dist: Optional[Distribution] = ...) -> None: ...
\r
123 def parse(cls, src: str, dist: Optional[Distribution] = ...) -> EntryPoint: ...
\r
125 def parse_group(cls, group: str, lines: Union[str, Sequence[str]],
\r
126 dist: Optional[Distribution] = ...) -> Dict[str, EntryPoint]: ...
\r
128 def parse_map(cls, data: Union[Dict[str, Union[str, Sequence[str]]],
\r
129 str, Sequence[str]],
\r
130 dist: Optional[Distribution] = ...) -> Dict[str, EntryPoint]: ...
\r
131 def load(self, require: bool = ..., env: Optional[Environment] = ...,
\r
132 installer: Optional[_InstallerType] = ...) -> Any: ...
\r
133 def require(self, env: Optional[Environment] = ...,
\r
134 installer: Optional[_InstallerType] = ...) -> None: ...
\r
137 def find_distributions(
\r
138 path_item: str, only: bool = ...
\r
139 ) -> Generator[Distribution, None, None]: ...
\r
140 def get_distribution(dist: Union[Requirement, str, Distribution]) -> Distribution: ...
\r
142 class Distribution(IResourceProvider, IMetadataProvider):
\r
143 location = ... # type: str
\r
144 project_name = ... # type: str
\r
145 key = ... # type: str
\r
146 extras = ... # type: List[str]
\r
147 version = ... # type: str
\r
148 parsed_version = ... # type: Tuple[str, ...]
\r
149 py_version = ... # type: str
\r
150 platform = ... # type: Optional[str]
\r
151 precedence = ... # type: int
\r
152 def __init__(self, location: Optional[str] = ...,
\r
153 metadata: Optional[str] = ...,
\r
154 project_name: Optional[str] = ...,
\r
155 version: Optional[str] = ..., py_version: str = ...,
\r
156 platform: Optional[str] = ...,
\r
157 precedence: int = ...) -> None: ...
\r
159 def from_location(cls, location: str, basename: str,
\r
160 metadata: Optional[str] = ...,
\r
161 **kw: Union[str, None, int]) -> Distribution: ...
\r
163 def from_filename(cls, filename: str, metadata: Optional[str] = ...,
\r
164 **kw: Union[str, None, int]) -> Distribution: ...
\r
165 def activate(self, path: Optional[List[str]] = ...) -> None: ...
\r
166 def as_requirement(self) -> Requirement: ...
\r
167 def requires(self, extras: Tuple[str, ...] = ...) -> List[Requirement]: ...
\r
168 def clone(self, **kw: Union[str, int, None]) -> Requirement: ...
\r
169 def egg_name(self) -> str: ...
\r
170 def __cmp__(self, other: Any) -> bool: ...
\r
171 def get_entry_info(dist: _EPDistType, group: str,
\r
172 name: str) -> Optional[EntryPoint]: ...
\r
174 def get_entry_map(dist: _EPDistType) \
\r
175 -> Dict[str, Dict[str, EntryPoint]]: ...
\r
177 def get_entry_map(dist: _EPDistType, group: str) \
\r
178 -> Dict[str, EntryPoint]: ...
\r
179 def load_entry_point(dist: _EPDistType, group: str, name: str) -> None: ...
\r
181 EGG_DIST = ... # type: int
\r
182 BINARY_DIST = ... # type: int
\r
183 SOURCE_DIST = ... # type: int
\r
184 CHECKOUT_DIST = ... # type: int
\r
185 DEVELOP_DIST = ... # type: int
\r
188 def resource_exists(package_or_requirement: _PkgReqType,
\r
189 resource_name: str) -> bool: ...
\r
190 def resource_stream(package_or_requirement: _PkgReqType,
\r
191 resource_name: str) -> IO[bytes]: ...
\r
192 def resource_string(package_or_requirement: _PkgReqType,
\r
193 resource_name: str) -> bytes: ...
\r
194 def resource_isdir(package_or_requirement: _PkgReqType,
\r
195 resource_name: str) -> bool: ...
\r
196 def resource_listdir(package_or_requirement: _PkgReqType,
\r
197 resource_name: str) -> List[str]: ...
\r
199 def resource_filename(package_or_requirement: _PkgReqType,
\r
200 resource_name: str) -> str: ...
\r
201 def set_extraction_path(path: str) -> None: ...
\r
202 def cleanup_resources(force: bool = ...) -> List[str]: ...
\r
204 class IResourceManager:
\r
205 def resource_exists(self, package_or_requirement: _PkgReqType,
\r
206 resource_name: str) -> bool: ...
\r
207 def resource_stream(self, package_or_requirement: _PkgReqType,
\r
208 resource_name: str) -> IO[bytes]: ...
\r
209 def resource_string(self, package_or_requirement: _PkgReqType,
\r
210 resource_name: str) -> bytes: ...
\r
211 def resource_isdir(self, package_or_requirement: _PkgReqType,
\r
212 resource_name: str) -> bool: ...
\r
213 def resource_listdir(self, package_or_requirement: _PkgReqType,
\r
214 resource_name: str) -> List[str]: ...
\r
215 def resource_filename(self, package_or_requirement: _PkgReqType,
\r
216 resource_name: str) -> str: ...
\r
217 def set_extraction_path(self, path: str) -> None: ...
\r
218 def cleanup_resources(self, force: bool = ...) -> List[str]: ...
\r
219 def get_cache_path(self, archive_name: str,
\r
220 names: Tuple[str, ...] = ...) -> str: ...
\r
221 def extraction_error(self) -> None: ...
\r
222 def postprocess(self, tempname: str, filename: str) -> None: ...
\r
226 def get_provider(package_or_requirement: str) -> IResourceProvider: ...
\r
228 def get_provider(package_or_requirement: Requirement) -> Distribution: ...
\r
230 class IMetadataProvider:
\r
231 def has_metadata(self, name: str) -> bool: ...
\r
232 def metadata_isdir(self, name: str) -> bool: ...
\r
233 def metadata_listdir(self, name: str) -> List[str]: ...
\r
234 def get_metadata(self, name: str) -> str: ...
\r
235 def get_metadata_lines(self, name: str) -> Generator[List[str], None, None]: ...
\r
236 def run_script(self, script_name: str, namespace: Dict[str, Any]) -> None: ...
\r
239 class ResolutionError(Exception): ...
\r
240 class DistributionNotFound(ResolutionError): ...
\r
241 class VersionConflict(ResolutionError): ...
\r
242 class UnknownExtra(ResolutionError): ...
\r
244 class ExtractionError(Exception):
\r
245 manager = ... # type: IResourceManager
\r
246 cache_path = ... # type: str
\r
247 original_error = ... # type: Exception
\r
250 class _Importer(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader, metaclass=ABCMeta): ...
\r
252 def register_finder(importer_type: type,
\r
253 distribution_finder: _DistFinderType) -> None: ...
\r
254 def register_loader_type(
\r
256 provider_factory: Callable[[types.ModuleType], IResourceProvider]
\r
258 def register_namespace_handler(importer_type: type,
\r
259 namespace_handler: _NSHandlerType) -> None: ...
\r
262 class IResourceProvider(IMetadataProvider): ...
\r
265 class NullProvider: ...
\r
267 class EggProvider(NullProvider): ...
\r
269 class DefaultProvider(EggProvider): ...
\r
271 class PathMetadata(DefaultProvider, IResourceProvider):
\r
272 def __init__(self, path: str, egg_info: str) -> None: ...
\r
274 class ZipProvider(EggProvider): ...
\r
276 class EggMetadata(ZipProvider, IResourceProvider):
\r
277 def __init__(self, zipimporter: zipimport.zipimporter) -> None: ...
\r
279 class EmptyProvider(NullProvider): ...
\r
281 empty_provider = ... # type: EmptyProvider
\r
283 class FileMetadata(EmptyProvider, IResourceProvider):
\r
284 def __init__(self, path_to_pkg_info: str) -> None: ...
\r
287 def parse_version(v: str) -> Tuple[str, ...]: ...
\r
288 def yield_lines(strs: _NestedStr) -> Generator[str, None, None]: ...
\r
289 def split_sections(
\r
291 ) -> Generator[Tuple[Optional[str], str], None, None]: ...
\r
292 def safe_name(name: str) -> str: ...
\r
293 def safe_version(version: str) -> str: ...
\r
294 def safe_extra(extra: str) -> str: ...
\r
295 def to_filename(name_or_version: str) -> str: ...
\r
298 def get_build_platform() -> str: ...
\r
299 def get_platform() -> str: ...
\r
300 def get_supported_platform() -> str: ...
\r
301 def compatible_platforms(provided: Optional[str],
\r
302 required: Optional[str]) -> bool: ...
\r
303 def get_default_cache() -> str: ...
\r
306 def get_importer(path_item: str) -> _Importer: ...
\r
309 def ensure_directory(path: str) -> None: ...
\r
310 def normalize_path(filename: str) -> str: ...
\r