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