| 1 |
from typing import Any, Dict, Iterator, List, Protocol, TypeVar, Union |
| 2 |
|
| 3 |
|
| 4 |
_T = TypeVar("_T") |
| 5 |
|
| 6 |
|
| 7 |
class PackageMetadata(Protocol): |
| 8 |
def __len__(self) -> int: |
| 9 |
... |
| 10 |
|
| 11 |
def __contains__(self, item: str) -> bool: |
| 12 |
... |
| 13 |
|
| 14 |
def __getitem__(self, key: str) -> str: |
| 15 |
... |
| 16 |
|
| 17 |
def __iter__(self) -> Iterator[str]: |
| 18 |
... |
| 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 |
|
| 32 |
class SimplePath(Protocol): |
| 33 |
""" |
| 34 |
A minimal subset of pathlib.Path required by PathDistribution. |
| 35 |
""" |
| 36 |
|
| 37 |
def joinpath(self) -> 'SimplePath': |
| 38 |
... |
| 39 |
|
| 40 |
def __truediv__(self) -> 'SimplePath': |
| 41 |
... |
| 42 |
|
| 43 |
def parent(self) -> 'SimplePath': |
| 44 |
... |
| 45 |
|
| 46 |
def read_text(self) -> str: |
| 47 |
... |