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
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-07 06:35 +0000
1"""Helpers for use with type annotation.
3Use the empty classes in this module when annotating the types of Pyrsistent
4objects, instead of using the actual collection class.
6For example,
8 from pyrsistent import pvector
9 from pyrsistent.typing import PVector
11 myvector: PVector[str] = pvector(['a', 'b', 'c'])
13"""
14from __future__ import absolute_import
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
26 __all__ = [
27 'CheckedPMap',
28 'CheckedPSet',
29 'CheckedPVector',
30 'PBag',
31 'PDeque',
32 'PList',
33 'PMap',
34 'PSet',
35 'PVector',
36 ]
38 T = TypeVar('T')
39 KT = TypeVar('KT')
40 VT = TypeVar('VT')
42 class CheckedPMap(Mapping[KT, VT], Hashable):
43 pass
45 # PSet.add and PSet.discard have different type signatures than that of Set.
46 class CheckedPSet(Generic[T], Hashable):
47 pass
49 class CheckedPVector(Sequence[T], Hashable):
50 pass
52 class PBag(Container[T], Iterable[T], Sized, Hashable):
53 pass
55 class PDeque(Sequence[T], Hashable):
56 pass
58 class PList(Sequence[T], Hashable):
59 pass
61 class PMap(Mapping[KT, VT], Hashable):
62 pass
64 # PSet.add and PSet.discard have different type signatures than that of Set.
65 class PSet(Generic[T], Hashable):
66 pass
68 class PVector(Sequence[T], Hashable):
69 pass
71 class PVectorEvolver(Generic[T]):
72 pass
74 class PMapEvolver(Generic[KT, VT]):
75 pass
77 class PSetEvolver(Generic[T]):
78 pass
79except ImportError:
80 pass