Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/importlib_metadata/_meta.py: 100%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

15 statements  

1from __future__ import annotations 

2 

3import os 

4from collections.abc import Iterator 

5from typing import ( 

6 Any, 

7 Protocol, 

8 TypeVar, 

9 overload, 

10) 

11 

12_T = TypeVar("_T") 

13 

14 

15class PackageMetadata(Protocol): 

16 def __len__(self) -> int: ... # pragma: no cover 

17 

18 def __contains__(self, item: str) -> bool: ... # pragma: no cover 

19 

20 def __getitem__(self, key: str) -> str: ... # pragma: no cover 

21 

22 def __iter__(self) -> Iterator[str]: ... # pragma: no cover 

23 

24 @overload 

25 def get( 

26 self, name: str, failobj: None = None 

27 ) -> str | None: ... # pragma: no cover 

28 

29 @overload 

30 def get(self, name: str, failobj: _T) -> str | _T: ... # pragma: no cover 

31 

32 # overload per python/importlib_metadata#435 

33 @overload 

34 def get_all( 

35 self, name: str, failobj: None = None 

36 ) -> list[Any] | None: ... # pragma: no cover 

37 

38 @overload 

39 def get_all(self, name: str, failobj: _T) -> list[Any] | _T: 

40 """ 

41 Return all values associated with a possibly multi-valued key. 

42 """ 

43 

44 @property 

45 def json(self) -> dict[str, str | list[str]]: 

46 """ 

47 A JSON-compatible form of the metadata. 

48 """ 

49 

50 

51class SimplePath(Protocol): 

52 """ 

53 A minimal subset of pathlib.Path required by Distribution. 

54 """ 

55 

56 def joinpath( 

57 self, other: str | os.PathLike[str] 

58 ) -> SimplePath: ... # pragma: no cover 

59 

60 def __truediv__( 

61 self, other: str | os.PathLike[str] 

62 ) -> SimplePath: ... # pragma: no cover 

63 

64 @property 

65 def parent(self) -> SimplePath: ... # pragma: no cover 

66 

67 def read_text(self, encoding=None) -> str: ... # pragma: no cover 

68 

69 def read_bytes(self) -> bytes: ... # pragma: no cover 

70 

71 def exists(self) -> bool: ... # pragma: no cover