Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/pyrsistent/typing.py: 0%

40 statements  

« prev     ^ index     » next       coverage.py v7.2.7, created at 2023-06-07 06:35 +0000

1"""Helpers for use with type annotation. 

2 

3Use the empty classes in this module when annotating the types of Pyrsistent 

4objects, instead of using the actual collection class. 

5 

6For example, 

7 

8 from pyrsistent import pvector 

9 from pyrsistent.typing import PVector 

10 

11 myvector: PVector[str] = pvector(['a', 'b', 'c']) 

12 

13""" 

14from __future__ import absolute_import 

15 

16try: 

17 from typing import Container 

18 from typing import Hashable 

19 from typing import Generic 

20 from typing import Iterable 

21 from typing import Mapping 

22 from typing import Sequence 

23 from typing import Sized 

24 from typing import TypeVar 

25 

26 __all__ = [ 

27 'CheckedPMap', 

28 'CheckedPSet', 

29 'CheckedPVector', 

30 'PBag', 

31 'PDeque', 

32 'PList', 

33 'PMap', 

34 'PSet', 

35 'PVector', 

36 ] 

37 

38 T = TypeVar('T') 

39 KT = TypeVar('KT') 

40 VT = TypeVar('VT') 

41 

42 class CheckedPMap(Mapping[KT, VT], Hashable): 

43 pass 

44 

45 # PSet.add and PSet.discard have different type signatures than that of Set. 

46 class CheckedPSet(Generic[T], Hashable): 

47 pass 

48 

49 class CheckedPVector(Sequence[T], Hashable): 

50 pass 

51 

52 class PBag(Container[T], Iterable[T], Sized, Hashable): 

53 pass 

54 

55 class PDeque(Sequence[T], Hashable): 

56 pass 

57 

58 class PList(Sequence[T], Hashable): 

59 pass 

60 

61 class PMap(Mapping[KT, VT], Hashable): 

62 pass 

63 

64 # PSet.add and PSet.discard have different type signatures than that of Set. 

65 class PSet(Generic[T], Hashable): 

66 pass 

67 

68 class PVector(Sequence[T], Hashable): 

69 pass 

70 

71 class PVectorEvolver(Generic[T]): 

72 pass 

73 

74 class PMapEvolver(Generic[KT, VT]): 

75 pass 

76 

77 class PSetEvolver(Generic[T]): 

78 pass 

79except ImportError: 

80 pass