Debian Codegraph @

clevercsv/_types.py

raw symbols SCIP
1 # -*- coding: utf-8 -*-
2
3 from __future__ import annotations
4
5 import csv
6 import os
7 import sys
8
9 from typing import TYPE_CHECKING
10 from typing import Any
11 from typing import Mapping
12 from typing import TypeVar
13 from typing import Union
14
15 import _csv
16
17 from clevercsv.dialect import SimpleDialect
18
19 AnyPath = Union[str, bytes, "os.PathLike[str]", "os.PathLike[bytes]"]
20 StrPath = Union[str, "os.PathLike[str]"]
21 _OpenFile = Union[AnyPath, int]
22 _DictRow = Mapping[str, Any]
23 _DialectLike = Union[
24 str,
25 csv.Dialect,
26 _csv.Dialect,
27 type[_csv.Dialect],
28 SimpleDialect,
29 ]
30 _T = TypeVar("_T")
31
32 if sys.version_info >= (3, 8):
33 from typing import Dict as _DictReadMapping
34 else:
35 from collections import OrderedDict as _DictReadMapping
36
37
38 if TYPE_CHECKING:
39 from _typeshed import FileDescriptorOrPath # NOQA
40 from _typeshed import SupportsIter # NOQA
41 from _typeshed import SupportsWrite # NOQA
42
43 __all__ = [
44 "SupportsWrite",
45 "SupportsIter",
46 "FileDescriptorOrPath",
47 "AnyPath",
48 "_OpenFile",
49 "_DictRow",
50 "_DialectLike",
51 "_DictReadMapping",
52 ]
53 else:
54 __all__ = [
55 "AnyPath",
56 "_OpenFile",
57 "_DictRow",
58 "_DialectLike",
59 "_DictReadMapping",
60 ]