37ee43e6ef447dfb4ae68f5f6c35597d12fdc5a1
[SubU] /
1 from ._compat import Protocol
2 from typing import Any, Dict, Iterator, List, TypeVar, Union
3
4
5 _T = TypeVar("_T")
6
7
8 class PackageMetadata(Protocol):
9     def __len__(self) -> int:
10         ...  # pragma: no cover
11
12     def __contains__(self, item: str) -> bool:
13         ...  # pragma: no cover
14
15     def __getitem__(self, key: str) -> str:
16         ...  # pragma: no cover
17
18     def __iter__(self) -> Iterator[str]:
19         ...  # pragma: no cover
20
21     def get_all(self, name: str, failobj: _T = ...) -> Union[List[Any], _T]:
22         """
23         Return all values associated with a possibly multi-valued key.
24         """
25
26     @property
27     def json(self) -> Dict[str, Union[str, List[str]]]:
28         """
29         A JSON-compatible form of the metadata.
30         """
31
32
33 class SimplePath(Protocol):
34     """
35     A minimal subset of pathlib.Path required by PathDistribution.
36     """
37
38     def joinpath(self) -> 'SimplePath':
39         ...  # pragma: no cover
40
41     def __truediv__(self) -> 'SimplePath':
42         ...  # pragma: no cover
43
44     def parent(self) -> 'SimplePath':
45         ...  # pragma: no cover
46
47     def read_text(self) -> str:
48         ...  # pragma: no cover