1 from ._compat import Protocol
2 from typing import Any, Dict, Iterator, List, TypeVar, Union
8 class PackageMetadata(Protocol):
9 def __len__(self) -> int:
10 ... # pragma: no cover
12 def __contains__(self, item: str) -> bool:
13 ... # pragma: no cover
15 def __getitem__(self, key: str) -> str:
16 ... # pragma: no cover
18 def __iter__(self) -> Iterator[str]:
19 ... # pragma: no cover
21 def get_all(self, name: str, failobj: _T = ...) -> Union[List[Any], _T]:
23 Return all values associated with a possibly multi-valued key.
27 def json(self) -> Dict[str, Union[str, List[str]]]:
29 A JSON-compatible form of the metadata.
33 class SimplePath(Protocol):
35 A minimal subset of pathlib.Path required by PathDistribution.
38 def joinpath(self) -> 'SimplePath':
39 ... # pragma: no cover
41 def __truediv__(self) -> 'SimplePath':
42 ... # pragma: no cover
44 def parent(self) -> 'SimplePath':
45 ... # pragma: no cover
47 def read_text(self) -> str:
48 ... # pragma: no cover