-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtyping.py
More file actions
31 lines (20 loc) · 1.04 KB
/
typing.py
File metadata and controls
31 lines (20 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from collections.abc import Mapping, Sequence
from os import PathLike
from typing import TYPE_CHECKING, Any, BinaryIO, Literal, Optional, Protocol, Union
_LZMAFilenameType = Union[str, bytes, PathLike[str], PathLike[bytes], BinaryIO]
if TYPE_CHECKING:
# avoid circular dependency
from xz.block import XZBlock
_LZMAPresetType = Optional[int]
_LZMAFiltersType = Optional[Sequence[Mapping[str, Any]]]
# all valid modes if we don't consider changing order nor repetitions
# (see utils.parse_mode for more details)
# the values are unit tested in test_parse_mode to make sure that all are here
_XZModesBinaryType = Literal[
"r", "r+", "w", "w+", "x", "x+", "rb", "rb+", "wb", "wb+", "xb", "xb+"
]
_XZModesTextType = Literal["rt", "rt+", "wt", "wt+", "xt", "xt+"]
class _BlockReadStrategyType(Protocol): # noqa: PYI046
def on_create(self, block: "XZBlock") -> None: ... # pragma: no cover
def on_delete(self, block: "XZBlock") -> None: ... # pragma: no cover
def on_read(self, block: "XZBlock") -> None: ... # pragma: no cover