basedpyright 1.13.2 → 1.13.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pyright-langserver.js +1 -1
- package/dist/pyright-langserver.js.map +1 -1
- package/dist/pyright.js +1 -1
- package/dist/pyright.js.map +1 -1
- package/dist/typeshed-fallback/commit.txt +1 -1
- package/dist/typeshed-fallback/stdlib/VERSIONS +2 -0
- package/dist/typeshed-fallback/stdlib/_ast.pyi +42 -279
- package/dist/typeshed-fallback/stdlib/_bisect.pyi +221 -221
- package/dist/typeshed-fallback/stdlib/_bootlocale.pyi +1 -1
- package/dist/typeshed-fallback/stdlib/_collections_abc.pyi +15 -5
- package/dist/typeshed-fallback/stdlib/_csv.pyi +213 -213
- package/dist/typeshed-fallback/stdlib/_decimal.pyi +0 -18
- package/dist/typeshed-fallback/stdlib/_dummy_thread.pyi +33 -33
- package/dist/typeshed-fallback/stdlib/_dummy_threading.pyi +180 -164
- package/dist/typeshed-fallback/stdlib/_heapq.pyi +67 -67
- package/dist/typeshed-fallback/stdlib/_interpqueues.pyi +16 -0
- package/dist/typeshed-fallback/stdlib/_interpreters.pyi +50 -0
- package/dist/typeshed-fallback/stdlib/_json.pyi +92 -92
- package/dist/typeshed-fallback/stdlib/_lsprof.pyi +92 -92
- package/dist/typeshed-fallback/stdlib/_msi.pyi +94 -92
- package/dist/typeshed-fallback/stdlib/_operator.pyi +0 -24
- package/dist/typeshed-fallback/stdlib/_random.pyi +30 -30
- package/dist/typeshed-fallback/stdlib/_tkinter.pyi +6 -2
- package/dist/typeshed-fallback/stdlib/_weakrefset.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/abc.pyi +12 -4
- package/dist/typeshed-fallback/stdlib/argparse.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/array.pyi +281 -281
- package/dist/typeshed-fallback/stdlib/asynchat.pyi +21 -21
- package/dist/typeshed-fallback/stdlib/asyncio/events.pyi +35 -4
- package/dist/typeshed-fallback/stdlib/asyncio/futures.pyi +107 -15
- package/dist/typeshed-fallback/stdlib/asyncio/locks.pyi +9 -3
- package/dist/typeshed-fallback/stdlib/asyncio/queues.pyi +10 -2
- package/dist/typeshed-fallback/stdlib/asyncio/sslproto.pyi +23 -4
- package/dist/typeshed-fallback/stdlib/asyncio/tasks.pyi +107 -12
- package/dist/typeshed-fallback/stdlib/asyncio/windows_events.pyi +86 -86
- package/dist/typeshed-fallback/stdlib/asyncio/windows_utils.pyi +49 -49
- package/dist/typeshed-fallback/stdlib/asyncore.pyi +90 -90
- package/dist/typeshed-fallback/stdlib/audioop.pyi +95 -95
- package/dist/typeshed-fallback/stdlib/binascii.pyi +123 -123
- package/dist/typeshed-fallback/stdlib/binhex.pyi +45 -45
- package/dist/typeshed-fallback/stdlib/builtins.pyi +0 -1
- package/dist/typeshed-fallback/stdlib/bz2.pyi +59 -6
- package/dist/typeshed-fallback/stdlib/cmath.pyi +112 -112
- package/dist/typeshed-fallback/stdlib/codecs.pyi +18 -6
- package/dist/typeshed-fallback/stdlib/collections/__init__.pyi +200 -56
- package/dist/typeshed-fallback/stdlib/concurrent/futures/__init__.pyi +33 -14
- package/dist/typeshed-fallback/stdlib/concurrent/futures/_base.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/concurrent/futures/thread.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/contextvars.pyi +99 -16
- package/dist/typeshed-fallback/stdlib/csv.pyi +14 -2
- package/dist/typeshed-fallback/stdlib/ctypes/__init__.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/ctypes/_endian.pyi +6 -2
- package/dist/typeshed-fallback/stdlib/curses/panel.pyi +16 -4
- package/dist/typeshed-fallback/stdlib/dataclasses.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/datetime.pyi +346 -104
- package/dist/typeshed-fallback/stdlib/dbm/gnu.pyi +52 -2
- package/dist/typeshed-fallback/stdlib/dbm/ndbm.pyi +26 -2
- package/dist/typeshed-fallback/stdlib/difflib.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/distutils/__init__.pyi +5 -5
- package/dist/typeshed-fallback/stdlib/distutils/archive_util.pyi +35 -35
- package/dist/typeshed-fallback/stdlib/distutils/bcppcompiler.pyi +3 -3
- package/dist/typeshed-fallback/stdlib/distutils/ccompiler.pyi +173 -173
- package/dist/typeshed-fallback/stdlib/distutils/cmd.pyi +99 -99
- package/dist/typeshed-fallback/stdlib/distutils/command/bdist.pyi +25 -25
- package/dist/typeshed-fallback/stdlib/distutils/command/bdist_dumb.pyi +21 -21
- package/dist/typeshed-fallback/stdlib/distutils/command/bdist_msi.pyi +45 -45
- package/dist/typeshed-fallback/stdlib/distutils/command/bdist_rpm.pyi +52 -52
- package/dist/typeshed-fallback/stdlib/distutils/command/bdist_wininst.pyi +16 -16
- package/dist/typeshed-fallback/stdlib/distutils/command/build.pyi +33 -33
- package/dist/typeshed-fallback/stdlib/distutils/command/build_clib.pyi +27 -27
- package/dist/typeshed-fallback/stdlib/distutils/command/build_ext.pyi +50 -50
- package/dist/typeshed-fallback/stdlib/distutils/command/build_py.pyi +44 -44
- package/dist/typeshed-fallback/stdlib/distutils/command/build_scripts.pyi +24 -24
- package/dist/typeshed-fallback/stdlib/distutils/command/check.pyi +39 -39
- package/dist/typeshed-fallback/stdlib/distutils/command/clean.pyi +17 -17
- package/dist/typeshed-fallback/stdlib/distutils/command/config.pyi +84 -84
- package/dist/typeshed-fallback/stdlib/distutils/command/install.pyi +65 -65
- package/dist/typeshed-fallback/stdlib/distutils/command/install_data.pyi +19 -19
- package/dist/typeshed-fallback/stdlib/distutils/command/install_egg_info.pyi +18 -18
- package/dist/typeshed-fallback/stdlib/distutils/command/install_headers.pyi +16 -16
- package/dist/typeshed-fallback/stdlib/distutils/command/install_lib.pyi +25 -25
- package/dist/typeshed-fallback/stdlib/distutils/command/install_scripts.pyi +18 -18
- package/dist/typeshed-fallback/stdlib/distutils/command/register.pyi +20 -20
- package/dist/typeshed-fallback/stdlib/distutils/command/sdist.pyi +44 -44
- package/dist/typeshed-fallback/stdlib/distutils/command/upload.pyi +17 -17
- package/dist/typeshed-fallback/stdlib/distutils/config.pyi +17 -17
- package/dist/typeshed-fallback/stdlib/distutils/core.pyi +57 -57
- package/dist/typeshed-fallback/stdlib/distutils/cygwinccompiler.pyi +20 -20
- package/dist/typeshed-fallback/stdlib/distutils/debug.pyi +1 -1
- package/dist/typeshed-fallback/stdlib/distutils/dep_util.pyi +14 -14
- package/dist/typeshed-fallback/stdlib/distutils/dir_util.pyi +23 -23
- package/dist/typeshed-fallback/stdlib/distutils/dist.pyi +149 -149
- package/dist/typeshed-fallback/stdlib/distutils/errors.pyi +19 -19
- package/dist/typeshed-fallback/stdlib/distutils/extension.pyi +36 -36
- package/dist/typeshed-fallback/stdlib/distutils/fancy_getopt.pyi +34 -34
- package/dist/typeshed-fallback/stdlib/distutils/file_util.pyi +38 -38
- package/dist/typeshed-fallback/stdlib/distutils/filelist.pyi +58 -58
- package/dist/typeshed-fallback/stdlib/distutils/log.pyi +25 -25
- package/dist/typeshed-fallback/stdlib/distutils/msvccompiler.pyi +3 -3
- package/dist/typeshed-fallback/stdlib/distutils/spawn.pyi +6 -6
- package/dist/typeshed-fallback/stdlib/distutils/sysconfig.pyi +33 -33
- package/dist/typeshed-fallback/stdlib/distutils/text_file.pyi +21 -21
- package/dist/typeshed-fallback/stdlib/distutils/unixccompiler.pyi +3 -3
- package/dist/typeshed-fallback/stdlib/distutils/util.pyi +50 -50
- package/dist/typeshed-fallback/stdlib/distutils/version.pyi +38 -36
- package/dist/typeshed-fallback/stdlib/dummy_threading.pyi +2 -2
- package/dist/typeshed-fallback/stdlib/email/_header_value_parser.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/email/charset.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/email/header.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/email/headerregistry.pyi +6 -1
- package/dist/typeshed-fallback/stdlib/enum.pyi +8 -1
- package/dist/typeshed-fallback/stdlib/filecmp.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/fileinput.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/formatter.pyi +88 -88
- package/dist/typeshed-fallback/stdlib/fractions.pyi +6 -2
- package/dist/typeshed-fallback/stdlib/functools.pyi +65 -13
- package/dist/typeshed-fallback/stdlib/graphlib.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/gzip.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/hashlib.pyi +42 -14
- package/dist/typeshed-fallback/stdlib/heapq.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/hmac.pyi +30 -2
- package/dist/typeshed-fallback/stdlib/http/cookies.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/imp.pyi +62 -62
- package/dist/typeshed-fallback/stdlib/importlib/abc.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/importlib/machinery.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/importlib/metadata/__init__.pyi +79 -15
- package/dist/typeshed-fallback/stdlib/importlib/metadata/_meta.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/importlib/resources/simple.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/io.pyi +428 -44
- package/dist/typeshed-fallback/stdlib/ipaddress.pyi +153 -28
- package/dist/typeshed-fallback/stdlib/itertools.pyi +5 -1
- package/dist/typeshed-fallback/stdlib/json/encoder.pyi +14 -2
- package/dist/typeshed-fallback/stdlib/keyword.pyi +6 -2
- package/dist/typeshed-fallback/stdlib/lib2to3/pytree.pyi +12 -2
- package/dist/typeshed-fallback/stdlib/logging/__init__.pyi +17 -3
- package/dist/typeshed-fallback/stdlib/lzma.pyi +107 -9
- package/dist/typeshed-fallback/stdlib/mailbox.pyi +14 -2
- package/dist/typeshed-fallback/stdlib/math.pyi +424 -424
- package/dist/typeshed-fallback/stdlib/mmap.pyi +160 -160
- package/dist/typeshed-fallback/stdlib/msilib/__init__.pyi +177 -177
- package/dist/typeshed-fallback/stdlib/msilib/schema.pyi +94 -94
- package/dist/typeshed-fallback/stdlib/msilib/sequence.pyi +13 -13
- package/dist/typeshed-fallback/stdlib/msilib/text.pyi +7 -7
- package/dist/typeshed-fallback/stdlib/multiprocessing/connection.pyi +9 -3
- package/dist/typeshed-fallback/stdlib/multiprocessing/context.pyi +12 -2
- package/dist/typeshed-fallback/stdlib/multiprocessing/dummy/__init__.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/multiprocessing/managers.pyi +10 -2
- package/dist/typeshed-fallback/stdlib/multiprocessing/pool.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/multiprocessing/popen_spawn_win32.pyi +30 -30
- package/dist/typeshed-fallback/stdlib/multiprocessing/process.pyi +15 -4
- package/dist/typeshed-fallback/stdlib/multiprocessing/queues.pyi +14 -2
- package/dist/typeshed-fallback/stdlib/multiprocessing/shared_memory.pyi +19 -5
- package/dist/typeshed-fallback/stdlib/nis.pyi +31 -4
- package/dist/typeshed-fallback/stdlib/numbers.pyi +26 -6
- package/dist/typeshed-fallback/stdlib/opcode.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/optparse.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/os/__init__.pyi +1447 -217
- package/dist/typeshed-fallback/stdlib/pathlib.pyi +42 -11
- package/dist/typeshed-fallback/stdlib/pickle.pyi +200 -12
- package/dist/typeshed-fallback/stdlib/posixpath.pyi +6 -2
- package/dist/typeshed-fallback/stdlib/pyexpat/errors.pyi +2 -0
- package/dist/typeshed-fallback/stdlib/pyexpat/model.pyi +2 -0
- package/dist/typeshed-fallback/stdlib/queue.pyi +57 -9
- package/dist/typeshed-fallback/stdlib/re.pyi +219 -57
- package/dist/typeshed-fallback/stdlib/sched.pyi +8 -1
- package/dist/typeshed-fallback/stdlib/signal.pyi +95 -19
- package/dist/typeshed-fallback/stdlib/smtpd.pyi +91 -91
- package/dist/typeshed-fallback/stdlib/socket.pyi +12 -2
- package/dist/typeshed-fallback/stdlib/sqlite3/dbapi2.pyi +417 -83
- package/dist/typeshed-fallback/stdlib/ssl.pyi +133 -22
- package/dist/typeshed-fallback/stdlib/statistics.pyi +20 -5
- package/dist/typeshed-fallback/stdlib/struct.pyi +114 -13
- package/dist/typeshed-fallback/stdlib/subprocess.pyi +14 -2
- package/dist/typeshed-fallback/stdlib/symbol.pyi +93 -93
- package/dist/typeshed-fallback/stdlib/symtable.pyi +30 -1
- package/dist/typeshed-fallback/stdlib/sys/__init__.pyi +7 -3
- package/dist/typeshed-fallback/stdlib/tarfile.pyi +6 -2
- package/dist/typeshed-fallback/stdlib/tempfile.pyi +17 -3
- package/dist/typeshed-fallback/stdlib/threading.pyi +68 -7
- package/dist/typeshed-fallback/stdlib/tkinter/__init__.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/turtle.pyi +11 -3
- package/dist/typeshed-fallback/stdlib/types.pyi +306 -79
- package/dist/typeshed-fallback/stdlib/typing.pyi +310 -31
- package/dist/typeshed-fallback/stdlib/typing_extensions.pyi +42 -11
- package/dist/typeshed-fallback/stdlib/unittest/__init__.pyi +6 -1
- package/dist/typeshed-fallback/stdlib/unittest/case.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/unittest/mock.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/urllib/parse.pyi +51 -3
- package/dist/typeshed-fallback/stdlib/weakref.pyi +6 -2
- package/dist/typeshed-fallback/stdlib/winsound.pyi +44 -28
- package/dist/typeshed-fallback/stdlib/xml/dom/minicompat.pyi +6 -2
- package/dist/typeshed-fallback/stdlib/xml/dom/minidom.pyi +33 -11
- package/dist/typeshed-fallback/stdlib/xml/etree/ElementTree.pyi +30 -10
- package/dist/typeshed-fallback/stdlib/xml/parsers/expat/errors.pyi +2 -0
- package/dist/typeshed-fallback/stdlib/xml/parsers/expat/model.pyi +2 -0
- package/dist/typeshed-fallback/stdlib/xxlimited.pyi +19 -4
- package/dist/typeshed-fallback/stdlib/zipimport.pyi +31 -0
- package/dist/typeshed-fallback/stdlib/zlib.pyi +157 -157
- package/dist/typeshed-fallback/stdlib/zoneinfo/__init__.pyi +18 -6
- package/dist/typeshed-fallback/stubs/assertpy/assertpy/extracting.pyi +2 -2
- package/dist/typeshed-fallback/stubs/docker/docker/_types.pyi +18 -1
- package/dist/typeshed-fallback/stubs/docker/docker/api/container.pyi +5 -19
- package/dist/typeshed-fallback/stubs/docker/docker/api/daemon.pyi +2 -1
- package/dist/typeshed-fallback/stubs/docker/docker/models/containers.pyi +268 -6
- package/dist/typeshed-fallback/stubs/docker/docker/types/containers.pyi +3 -7
- package/dist/typeshed-fallback/stubs/docker/docker/types/daemon.pyi +10 -4
- package/dist/typeshed-fallback/stubs/docutils/docutils/parsers/rst/states.pyi +47 -0
- package/dist/typeshed-fallback/stubs/gdb/gdb/__init__.pyi +1 -1
- package/dist/typeshed-fallback/stubs/networkx/networkx/algorithms/shortest_paths/generic.pyi +1 -1
- package/dist/typeshed-fallback/stubs/openpyxl/METADATA.toml +1 -1
- package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/packaging/extended.pyi +0 -2
- package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/styles/named_styles.pyi +2 -1
- package/dist/typeshed-fallback/stubs/pygit2/METADATA.toml +1 -1
- package/dist/typeshed-fallback/stubs/pytest-lazy-fixture/pytest_lazyfixture.pyi +2 -2
- package/dist/typeshed-fallback/stubs/python-crontab/METADATA.toml +1 -1
- package/dist/typeshed-fallback/stubs/reportlab/METADATA.toml +1 -1
- package/dist/typeshed-fallback/stubs/reportlab/reportlab/lib/rl_safe_eval.pyi +23 -11
- package/dist/typeshed-fallback/stubs/reportlab/reportlab/pdfbase/pdfdoc.pyi +6 -0
- package/dist/typeshed-fallback/stubs/setuptools/METADATA.toml +1 -1
- package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/archive_util.pyi +8 -8
- package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/ccompiler.pyi +11 -17
- package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/cmd.pyi +11 -11
- package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/command/build_py.pyi +1 -2
- package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/filelist.pyi +4 -12
- package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/sysconfig.pyi +2 -4
- package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/util.pyi +5 -8
- package/dist/typeshed-fallback/stubs/str2bool/METADATA.toml +2 -0
- package/dist/typeshed-fallback/stubs/str2bool/str2bool/__init__.pyi +7 -0
- package/package.json +1 -1
|
@@ -1,213 +1,213 @@
|
|
|
1
|
-
r"""
|
|
2
|
-
CSV parsing and writing.
|
|
3
|
-
|
|
4
|
-
This module provides classes that assist in the reading and writing
|
|
5
|
-
of Comma Separated Value (CSV) files, and implements the interface
|
|
6
|
-
described by PEP 305. Although many CSV files are simple to parse,
|
|
7
|
-
the format is not formally defined by a stable specification and
|
|
8
|
-
is subtle enough that parsing lines of a CSV file with something
|
|
9
|
-
like line.split(",") is bound to fail. The module supports three
|
|
10
|
-
basic APIs: reading, writing, and registration of dialects.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
DIALECT REGISTRATION:
|
|
14
|
-
|
|
15
|
-
Readers and writers support a dialect argument, which is a convenient
|
|
16
|
-
handle on a group of settings. When the dialect argument is a string,
|
|
17
|
-
it identifies one of the dialects previously registered with the module.
|
|
18
|
-
If it is a class or instance, the attributes of the argument are used as
|
|
19
|
-
the settings for the reader or writer:
|
|
20
|
-
|
|
21
|
-
class excel:
|
|
22
|
-
delimiter = ','
|
|
23
|
-
quotechar = '"'
|
|
24
|
-
escapechar = None
|
|
25
|
-
doublequote = True
|
|
26
|
-
skipinitialspace = False
|
|
27
|
-
lineterminator = '\r\n'
|
|
28
|
-
quoting = QUOTE_MINIMAL
|
|
29
|
-
|
|
30
|
-
SETTINGS:
|
|
31
|
-
|
|
32
|
-
* quotechar - specifies a one-character string to use as the
|
|
33
|
-
quoting character. It defaults to '"'.
|
|
34
|
-
* delimiter - specifies a one-character string to use as the
|
|
35
|
-
field separator. It defaults to ','.
|
|
36
|
-
* skipinitialspace - specifies how to interpret whitespace which
|
|
37
|
-
immediately follows a delimiter. It defaults to False, which
|
|
38
|
-
means that whitespace immediately following a delimiter is part
|
|
39
|
-
of the following field.
|
|
40
|
-
* lineterminator - specifies the character sequence which should
|
|
41
|
-
terminate rows.
|
|
42
|
-
* quoting - controls when quotes should be generated by the writer.
|
|
43
|
-
It can take on any of the following module constants:
|
|
44
|
-
|
|
45
|
-
csv.QUOTE_MINIMAL means only when required, for example, when a
|
|
46
|
-
field contains either the quotechar or the delimiter
|
|
47
|
-
csv.QUOTE_ALL means that quotes are always placed around fields.
|
|
48
|
-
csv.QUOTE_NONNUMERIC means that quotes are always placed around
|
|
49
|
-
fields which do not parse as integers or floating point
|
|
50
|
-
numbers.
|
|
51
|
-
csv.QUOTE_NONE means that quotes are never placed around fields.
|
|
52
|
-
* escapechar - specifies a one-character string used to escape
|
|
53
|
-
the delimiter when quoting is set to QUOTE_NONE.
|
|
54
|
-
* doublequote - controls the handling of quotes inside fields. When
|
|
55
|
-
True, two consecutive quotes are interpreted as one during read,
|
|
56
|
-
and when writing, each quote character embedded in the data is
|
|
57
|
-
written as two quotes
|
|
58
|
-
"""
|
|
59
|
-
|
|
60
|
-
import sys
|
|
61
|
-
from _typeshed import SupportsWrite
|
|
62
|
-
from collections.abc import Iterable, Iterator
|
|
63
|
-
from typing import Any, Final, Literal
|
|
64
|
-
from typing_extensions import TypeAlias
|
|
65
|
-
|
|
66
|
-
__version__: Final[str]
|
|
67
|
-
|
|
68
|
-
QUOTE_ALL: Literal[1]
|
|
69
|
-
QUOTE_MINIMAL: Literal[0]
|
|
70
|
-
QUOTE_NONE: Literal[3]
|
|
71
|
-
QUOTE_NONNUMERIC: Literal[2]
|
|
72
|
-
if sys.version_info >= (3, 12):
|
|
73
|
-
QUOTE_STRINGS: Literal[4]
|
|
74
|
-
QUOTE_NOTNULL: Literal[5]
|
|
75
|
-
|
|
76
|
-
# Ideally this would be `QUOTE_ALL | QUOTE_MINIMAL | QUOTE_NONE | QUOTE_NONNUMERIC`
|
|
77
|
-
# However, using literals in situations like these can cause false-positives (see #7258)
|
|
78
|
-
_QuotingType: TypeAlias = int
|
|
79
|
-
|
|
80
|
-
class Error(Exception): ...
|
|
81
|
-
|
|
82
|
-
class Dialect:
|
|
83
|
-
"""
|
|
84
|
-
CSV dialect
|
|
85
|
-
|
|
86
|
-
The Dialect type records CSV parsing and generation options.
|
|
87
|
-
"""
|
|
88
|
-
delimiter: str
|
|
89
|
-
quotechar: str | None
|
|
90
|
-
escapechar: str | None
|
|
91
|
-
doublequote: bool
|
|
92
|
-
skipinitialspace: bool
|
|
93
|
-
lineterminator: str
|
|
94
|
-
quoting: _QuotingType
|
|
95
|
-
strict: bool
|
|
96
|
-
def __init__(self) -> None: ...
|
|
97
|
-
|
|
98
|
-
_DialectLike: TypeAlias = str | Dialect | type[Dialect]
|
|
99
|
-
|
|
100
|
-
class _reader(Iterator[list[str]]):
|
|
101
|
-
@property
|
|
102
|
-
def dialect(self) -> Dialect: ...
|
|
103
|
-
line_num: int
|
|
104
|
-
def __next__(self) -> list[str]: ...
|
|
105
|
-
|
|
106
|
-
class _writer:
|
|
107
|
-
@property
|
|
108
|
-
def dialect(self) -> Dialect: ...
|
|
109
|
-
def writerow(self, row: Iterable[Any]) -> Any: ...
|
|
110
|
-
def writerows(self, rows: Iterable[Iterable[Any]]) -> None: ...
|
|
111
|
-
|
|
112
|
-
def writer(
|
|
113
|
-
csvfile: SupportsWrite[str],
|
|
114
|
-
dialect: _DialectLike = "excel",
|
|
115
|
-
*,
|
|
116
|
-
delimiter: str = ",",
|
|
117
|
-
quotechar: str | None = '"',
|
|
118
|
-
escapechar: str | None = None,
|
|
119
|
-
doublequote: bool = True,
|
|
120
|
-
skipinitialspace: bool = False,
|
|
121
|
-
lineterminator: str = "\r\n",
|
|
122
|
-
quoting: _QuotingType = 0,
|
|
123
|
-
strict: bool = False,
|
|
124
|
-
) -> _writer:
|
|
125
|
-
"""
|
|
126
|
-
csv_writer = csv.writer(fileobj [, dialect='excel']
|
|
127
|
-
[optional keyword args])
|
|
128
|
-
for row in sequence:
|
|
129
|
-
csv_writer.writerow(row)
|
|
130
|
-
|
|
131
|
-
[or]
|
|
132
|
-
|
|
133
|
-
csv_writer = csv.writer(fileobj [, dialect='excel']
|
|
134
|
-
[optional keyword args])
|
|
135
|
-
csv_writer.writerows(rows)
|
|
136
|
-
|
|
137
|
-
The "fileobj" argument can be any object that supports the file API.
|
|
138
|
-
"""
|
|
139
|
-
...
|
|
140
|
-
def reader(
|
|
141
|
-
csvfile: Iterable[str],
|
|
142
|
-
dialect: _DialectLike = "excel",
|
|
143
|
-
*,
|
|
144
|
-
delimiter: str = ",",
|
|
145
|
-
quotechar: str | None = '"',
|
|
146
|
-
escapechar: str | None = None,
|
|
147
|
-
doublequote: bool = True,
|
|
148
|
-
skipinitialspace: bool = False,
|
|
149
|
-
lineterminator: str = "\r\n",
|
|
150
|
-
quoting: _QuotingType = 0,
|
|
151
|
-
strict: bool = False,
|
|
152
|
-
) -> _reader:
|
|
153
|
-
"""
|
|
154
|
-
csv_reader = reader(iterable [, dialect='excel']
|
|
155
|
-
[optional keyword args])
|
|
156
|
-
for row in csv_reader:
|
|
157
|
-
process(row)
|
|
158
|
-
|
|
159
|
-
The "iterable" argument can be any object that returns a line
|
|
160
|
-
of input for each iteration, such as a file object or a list. The
|
|
161
|
-
optional "dialect" parameter is discussed below. The function
|
|
162
|
-
also accepts optional keyword arguments which override settings
|
|
163
|
-
provided by the dialect.
|
|
164
|
-
|
|
165
|
-
The returned object is an iterator. Each iteration returns a row
|
|
166
|
-
of the CSV file (which can span multiple input lines).
|
|
167
|
-
"""
|
|
168
|
-
...
|
|
169
|
-
def register_dialect(
|
|
170
|
-
name: str,
|
|
171
|
-
dialect: type[Dialect] = ...,
|
|
172
|
-
*,
|
|
173
|
-
delimiter: str = ",",
|
|
174
|
-
quotechar: str | None = '"',
|
|
175
|
-
escapechar: str | None = None,
|
|
176
|
-
doublequote: bool = True,
|
|
177
|
-
skipinitialspace: bool = False,
|
|
178
|
-
lineterminator: str = "\r\n",
|
|
179
|
-
quoting: _QuotingType = 0,
|
|
180
|
-
strict: bool = False,
|
|
181
|
-
) -> None:
|
|
182
|
-
"""
|
|
183
|
-
Create a mapping from a string name to a dialect class.
|
|
184
|
-
dialect = csv.register_dialect(name[, dialect[, **fmtparams]])
|
|
185
|
-
"""
|
|
186
|
-
...
|
|
187
|
-
def unregister_dialect(name: str) -> None:
|
|
188
|
-
"""
|
|
189
|
-
Delete the name/dialect mapping associated with a string name.
|
|
190
|
-
csv.unregister_dialect(name)
|
|
191
|
-
"""
|
|
192
|
-
...
|
|
193
|
-
def get_dialect(name: str) -> Dialect:
|
|
194
|
-
"""
|
|
195
|
-
Return the dialect instance associated with name.
|
|
196
|
-
dialect = csv.get_dialect(name)
|
|
197
|
-
"""
|
|
198
|
-
...
|
|
199
|
-
def list_dialects() -> list[str]:
|
|
200
|
-
"""
|
|
201
|
-
Return a list of all know dialect names.
|
|
202
|
-
names = csv.list_dialects()
|
|
203
|
-
"""
|
|
204
|
-
...
|
|
205
|
-
def field_size_limit(new_limit: int = ...) -> int:
|
|
206
|
-
"""
|
|
207
|
-
Sets an upper limit on parsed fields.
|
|
208
|
-
csv.field_size_limit([limit])
|
|
209
|
-
|
|
210
|
-
Returns old limit. If limit is not given, no new limit is set and
|
|
211
|
-
the old limit is returned
|
|
212
|
-
"""
|
|
213
|
-
...
|
|
1
|
+
r"""
|
|
2
|
+
CSV parsing and writing.
|
|
3
|
+
|
|
4
|
+
This module provides classes that assist in the reading and writing
|
|
5
|
+
of Comma Separated Value (CSV) files, and implements the interface
|
|
6
|
+
described by PEP 305. Although many CSV files are simple to parse,
|
|
7
|
+
the format is not formally defined by a stable specification and
|
|
8
|
+
is subtle enough that parsing lines of a CSV file with something
|
|
9
|
+
like line.split(",") is bound to fail. The module supports three
|
|
10
|
+
basic APIs: reading, writing, and registration of dialects.
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
DIALECT REGISTRATION:
|
|
14
|
+
|
|
15
|
+
Readers and writers support a dialect argument, which is a convenient
|
|
16
|
+
handle on a group of settings. When the dialect argument is a string,
|
|
17
|
+
it identifies one of the dialects previously registered with the module.
|
|
18
|
+
If it is a class or instance, the attributes of the argument are used as
|
|
19
|
+
the settings for the reader or writer:
|
|
20
|
+
|
|
21
|
+
class excel:
|
|
22
|
+
delimiter = ','
|
|
23
|
+
quotechar = '"'
|
|
24
|
+
escapechar = None
|
|
25
|
+
doublequote = True
|
|
26
|
+
skipinitialspace = False
|
|
27
|
+
lineterminator = '\r\n'
|
|
28
|
+
quoting = QUOTE_MINIMAL
|
|
29
|
+
|
|
30
|
+
SETTINGS:
|
|
31
|
+
|
|
32
|
+
* quotechar - specifies a one-character string to use as the
|
|
33
|
+
quoting character. It defaults to '"'.
|
|
34
|
+
* delimiter - specifies a one-character string to use as the
|
|
35
|
+
field separator. It defaults to ','.
|
|
36
|
+
* skipinitialspace - specifies how to interpret whitespace which
|
|
37
|
+
immediately follows a delimiter. It defaults to False, which
|
|
38
|
+
means that whitespace immediately following a delimiter is part
|
|
39
|
+
of the following field.
|
|
40
|
+
* lineterminator - specifies the character sequence which should
|
|
41
|
+
terminate rows.
|
|
42
|
+
* quoting - controls when quotes should be generated by the writer.
|
|
43
|
+
It can take on any of the following module constants:
|
|
44
|
+
|
|
45
|
+
csv.QUOTE_MINIMAL means only when required, for example, when a
|
|
46
|
+
field contains either the quotechar or the delimiter
|
|
47
|
+
csv.QUOTE_ALL means that quotes are always placed around fields.
|
|
48
|
+
csv.QUOTE_NONNUMERIC means that quotes are always placed around
|
|
49
|
+
fields which do not parse as integers or floating point
|
|
50
|
+
numbers.
|
|
51
|
+
csv.QUOTE_NONE means that quotes are never placed around fields.
|
|
52
|
+
* escapechar - specifies a one-character string used to escape
|
|
53
|
+
the delimiter when quoting is set to QUOTE_NONE.
|
|
54
|
+
* doublequote - controls the handling of quotes inside fields. When
|
|
55
|
+
True, two consecutive quotes are interpreted as one during read,
|
|
56
|
+
and when writing, each quote character embedded in the data is
|
|
57
|
+
written as two quotes
|
|
58
|
+
"""
|
|
59
|
+
|
|
60
|
+
import sys
|
|
61
|
+
from _typeshed import SupportsWrite
|
|
62
|
+
from collections.abc import Iterable, Iterator
|
|
63
|
+
from typing import Any, Final, Literal
|
|
64
|
+
from typing_extensions import TypeAlias
|
|
65
|
+
|
|
66
|
+
__version__: Final[str]
|
|
67
|
+
|
|
68
|
+
QUOTE_ALL: Literal[1]
|
|
69
|
+
QUOTE_MINIMAL: Literal[0]
|
|
70
|
+
QUOTE_NONE: Literal[3]
|
|
71
|
+
QUOTE_NONNUMERIC: Literal[2]
|
|
72
|
+
if sys.version_info >= (3, 12):
|
|
73
|
+
QUOTE_STRINGS: Literal[4]
|
|
74
|
+
QUOTE_NOTNULL: Literal[5]
|
|
75
|
+
|
|
76
|
+
# Ideally this would be `QUOTE_ALL | QUOTE_MINIMAL | QUOTE_NONE | QUOTE_NONNUMERIC`
|
|
77
|
+
# However, using literals in situations like these can cause false-positives (see #7258)
|
|
78
|
+
_QuotingType: TypeAlias = int
|
|
79
|
+
|
|
80
|
+
class Error(Exception): ...
|
|
81
|
+
|
|
82
|
+
class Dialect:
|
|
83
|
+
"""
|
|
84
|
+
CSV dialect
|
|
85
|
+
|
|
86
|
+
The Dialect type records CSV parsing and generation options.
|
|
87
|
+
"""
|
|
88
|
+
delimiter: str
|
|
89
|
+
quotechar: str | None
|
|
90
|
+
escapechar: str | None
|
|
91
|
+
doublequote: bool
|
|
92
|
+
skipinitialspace: bool
|
|
93
|
+
lineterminator: str
|
|
94
|
+
quoting: _QuotingType
|
|
95
|
+
strict: bool
|
|
96
|
+
def __init__(self) -> None: ...
|
|
97
|
+
|
|
98
|
+
_DialectLike: TypeAlias = str | Dialect | type[Dialect]
|
|
99
|
+
|
|
100
|
+
class _reader(Iterator[list[str]]):
|
|
101
|
+
@property
|
|
102
|
+
def dialect(self) -> Dialect: ...
|
|
103
|
+
line_num: int
|
|
104
|
+
def __next__(self) -> list[str]: ...
|
|
105
|
+
|
|
106
|
+
class _writer:
|
|
107
|
+
@property
|
|
108
|
+
def dialect(self) -> Dialect: ...
|
|
109
|
+
def writerow(self, row: Iterable[Any]) -> Any: ...
|
|
110
|
+
def writerows(self, rows: Iterable[Iterable[Any]]) -> None: ...
|
|
111
|
+
|
|
112
|
+
def writer(
|
|
113
|
+
csvfile: SupportsWrite[str],
|
|
114
|
+
dialect: _DialectLike = "excel",
|
|
115
|
+
*,
|
|
116
|
+
delimiter: str = ",",
|
|
117
|
+
quotechar: str | None = '"',
|
|
118
|
+
escapechar: str | None = None,
|
|
119
|
+
doublequote: bool = True,
|
|
120
|
+
skipinitialspace: bool = False,
|
|
121
|
+
lineterminator: str = "\r\n",
|
|
122
|
+
quoting: _QuotingType = 0,
|
|
123
|
+
strict: bool = False,
|
|
124
|
+
) -> _writer:
|
|
125
|
+
"""
|
|
126
|
+
csv_writer = csv.writer(fileobj [, dialect='excel']
|
|
127
|
+
[optional keyword args])
|
|
128
|
+
for row in sequence:
|
|
129
|
+
csv_writer.writerow(row)
|
|
130
|
+
|
|
131
|
+
[or]
|
|
132
|
+
|
|
133
|
+
csv_writer = csv.writer(fileobj [, dialect='excel']
|
|
134
|
+
[optional keyword args])
|
|
135
|
+
csv_writer.writerows(rows)
|
|
136
|
+
|
|
137
|
+
The "fileobj" argument can be any object that supports the file API.
|
|
138
|
+
"""
|
|
139
|
+
...
|
|
140
|
+
def reader(
|
|
141
|
+
csvfile: Iterable[str],
|
|
142
|
+
dialect: _DialectLike = "excel",
|
|
143
|
+
*,
|
|
144
|
+
delimiter: str = ",",
|
|
145
|
+
quotechar: str | None = '"',
|
|
146
|
+
escapechar: str | None = None,
|
|
147
|
+
doublequote: bool = True,
|
|
148
|
+
skipinitialspace: bool = False,
|
|
149
|
+
lineterminator: str = "\r\n",
|
|
150
|
+
quoting: _QuotingType = 0,
|
|
151
|
+
strict: bool = False,
|
|
152
|
+
) -> _reader:
|
|
153
|
+
"""
|
|
154
|
+
csv_reader = reader(iterable [, dialect='excel']
|
|
155
|
+
[optional keyword args])
|
|
156
|
+
for row in csv_reader:
|
|
157
|
+
process(row)
|
|
158
|
+
|
|
159
|
+
The "iterable" argument can be any object that returns a line
|
|
160
|
+
of input for each iteration, such as a file object or a list. The
|
|
161
|
+
optional "dialect" parameter is discussed below. The function
|
|
162
|
+
also accepts optional keyword arguments which override settings
|
|
163
|
+
provided by the dialect.
|
|
164
|
+
|
|
165
|
+
The returned object is an iterator. Each iteration returns a row
|
|
166
|
+
of the CSV file (which can span multiple input lines).
|
|
167
|
+
"""
|
|
168
|
+
...
|
|
169
|
+
def register_dialect(
|
|
170
|
+
name: str,
|
|
171
|
+
dialect: type[Dialect] = ...,
|
|
172
|
+
*,
|
|
173
|
+
delimiter: str = ",",
|
|
174
|
+
quotechar: str | None = '"',
|
|
175
|
+
escapechar: str | None = None,
|
|
176
|
+
doublequote: bool = True,
|
|
177
|
+
skipinitialspace: bool = False,
|
|
178
|
+
lineterminator: str = "\r\n",
|
|
179
|
+
quoting: _QuotingType = 0,
|
|
180
|
+
strict: bool = False,
|
|
181
|
+
) -> None:
|
|
182
|
+
"""
|
|
183
|
+
Create a mapping from a string name to a dialect class.
|
|
184
|
+
dialect = csv.register_dialect(name[, dialect[, **fmtparams]])
|
|
185
|
+
"""
|
|
186
|
+
...
|
|
187
|
+
def unregister_dialect(name: str) -> None:
|
|
188
|
+
"""
|
|
189
|
+
Delete the name/dialect mapping associated with a string name.
|
|
190
|
+
csv.unregister_dialect(name)
|
|
191
|
+
"""
|
|
192
|
+
...
|
|
193
|
+
def get_dialect(name: str) -> Dialect:
|
|
194
|
+
"""
|
|
195
|
+
Return the dialect instance associated with name.
|
|
196
|
+
dialect = csv.get_dialect(name)
|
|
197
|
+
"""
|
|
198
|
+
...
|
|
199
|
+
def list_dialects() -> list[str]:
|
|
200
|
+
"""
|
|
201
|
+
Return a list of all know dialect names.
|
|
202
|
+
names = csv.list_dialects()
|
|
203
|
+
"""
|
|
204
|
+
...
|
|
205
|
+
def field_size_limit(new_limit: int = ...) -> int:
|
|
206
|
+
"""
|
|
207
|
+
Sets an upper limit on parsed fields.
|
|
208
|
+
csv.field_size_limit([limit])
|
|
209
|
+
|
|
210
|
+
Returns old limit. If limit is not given, no new limit is set and
|
|
211
|
+
the old limit is returned
|
|
212
|
+
"""
|
|
213
|
+
...
|
|
@@ -15,7 +15,6 @@ __version__: Final[str]
|
|
|
15
15
|
__libmpdec_version__: Final[str]
|
|
16
16
|
|
|
17
17
|
class DecimalTuple(NamedTuple):
|
|
18
|
-
"""DecimalTuple(sign, digits, exponent)"""
|
|
19
18
|
sign: int
|
|
20
19
|
digits: tuple[int, ...]
|
|
21
20
|
exponent: int | Literal["n", "N", "F"]
|
|
@@ -89,12 +88,6 @@ else:
|
|
|
89
88
|
...
|
|
90
89
|
|
|
91
90
|
class Decimal:
|
|
92
|
-
"""
|
|
93
|
-
Construct a new Decimal object. 'value' can be an integer, string, tuple,
|
|
94
|
-
or another Decimal object. If no value is given, return Decimal('0'). The
|
|
95
|
-
context does not affect the conversion and is only passed to determine if
|
|
96
|
-
the InvalidOperation trap is active.
|
|
97
|
-
"""
|
|
98
91
|
def __new__(cls, value: _DecimalNew = ..., context: Context | None = ...) -> Self: ...
|
|
99
92
|
@classmethod
|
|
100
93
|
def from_float(cls, f: float, /) -> Self:
|
|
@@ -614,17 +607,6 @@ class _ContextManager:
|
|
|
614
607
|
_TrapType: TypeAlias = type[DecimalException]
|
|
615
608
|
|
|
616
609
|
class Context:
|
|
617
|
-
"""
|
|
618
|
-
The context affects almost all operations and controls rounding,
|
|
619
|
-
Over/Underflow, raising of exceptions and much more. A new context
|
|
620
|
-
can be constructed as follows:
|
|
621
|
-
|
|
622
|
-
>>> c = Context(prec=28, Emin=-425000000, Emax=425000000,
|
|
623
|
-
... rounding=ROUND_HALF_EVEN, capitals=1, clamp=1,
|
|
624
|
-
... traps=[InvalidOperation, DivisionByZero, Overflow],
|
|
625
|
-
... flags=[])
|
|
626
|
-
>>>
|
|
627
|
-
"""
|
|
628
610
|
# TODO: Context doesn't allow you to delete *any* attributes from instances of the class at runtime,
|
|
629
611
|
# even settable attributes like `prec` and `rounding`,
|
|
630
612
|
# but that's inexpressable in the stub.
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
from collections.abc import Callable
|
|
2
|
-
from types import TracebackType
|
|
3
|
-
from typing import Any, NoReturn, overload
|
|
4
|
-
from typing_extensions import TypeVarTuple, Unpack
|
|
5
|
-
|
|
6
|
-
__all__ = ["error", "start_new_thread", "exit", "get_ident", "allocate_lock", "interrupt_main", "LockType", "RLock"]
|
|
7
|
-
|
|
8
|
-
_Ts = TypeVarTuple("_Ts")
|
|
9
|
-
|
|
10
|
-
TIMEOUT_MAX: int
|
|
11
|
-
error = RuntimeError
|
|
12
|
-
|
|
13
|
-
@overload
|
|
14
|
-
def start_new_thread(function: Callable[[Unpack[_Ts]], object], args: tuple[Unpack[_Ts]]) -> None: ...
|
|
15
|
-
@overload
|
|
16
|
-
def start_new_thread(function: Callable[..., object], args: tuple[Any, ...], kwargs: dict[str, Any]) -> None: ...
|
|
17
|
-
def exit() -> NoReturn: ...
|
|
18
|
-
def get_ident() -> int: ...
|
|
19
|
-
def allocate_lock() -> LockType: ...
|
|
20
|
-
def stack_size(size: int | None = None) -> int: ...
|
|
21
|
-
|
|
22
|
-
class LockType:
|
|
23
|
-
locked_status: bool
|
|
24
|
-
def acquire(self, waitflag: bool | None = None, timeout: int = -1) -> bool: ...
|
|
25
|
-
def __enter__(self, waitflag: bool | None = None, timeout: int = -1) -> bool: ...
|
|
26
|
-
def __exit__(self, typ: type[BaseException] | None, val: BaseException | None, tb: TracebackType | None) -> None: ...
|
|
27
|
-
def release(self) -> bool: ...
|
|
28
|
-
def locked(self) -> bool: ...
|
|
29
|
-
|
|
30
|
-
class RLock(LockType):
|
|
31
|
-
def release(self) -> None: ... # type: ignore[override]
|
|
32
|
-
|
|
33
|
-
def interrupt_main() -> None: ...
|
|
1
|
+
from collections.abc import Callable
|
|
2
|
+
from types import TracebackType
|
|
3
|
+
from typing import Any, NoReturn, overload
|
|
4
|
+
from typing_extensions import TypeVarTuple, Unpack
|
|
5
|
+
|
|
6
|
+
__all__ = ["error", "start_new_thread", "exit", "get_ident", "allocate_lock", "interrupt_main", "LockType", "RLock"]
|
|
7
|
+
|
|
8
|
+
_Ts = TypeVarTuple("_Ts")
|
|
9
|
+
|
|
10
|
+
TIMEOUT_MAX: int
|
|
11
|
+
error = RuntimeError
|
|
12
|
+
|
|
13
|
+
@overload
|
|
14
|
+
def start_new_thread(function: Callable[[Unpack[_Ts]], object], args: tuple[Unpack[_Ts]]) -> None: ...
|
|
15
|
+
@overload
|
|
16
|
+
def start_new_thread(function: Callable[..., object], args: tuple[Any, ...], kwargs: dict[str, Any]) -> None: ...
|
|
17
|
+
def exit() -> NoReturn: ...
|
|
18
|
+
def get_ident() -> int: ...
|
|
19
|
+
def allocate_lock() -> LockType: ...
|
|
20
|
+
def stack_size(size: int | None = None) -> int: ...
|
|
21
|
+
|
|
22
|
+
class LockType:
|
|
23
|
+
locked_status: bool
|
|
24
|
+
def acquire(self, waitflag: bool | None = None, timeout: int = -1) -> bool: ...
|
|
25
|
+
def __enter__(self, waitflag: bool | None = None, timeout: int = -1) -> bool: ...
|
|
26
|
+
def __exit__(self, typ: type[BaseException] | None, val: BaseException | None, tb: TracebackType | None) -> None: ...
|
|
27
|
+
def release(self) -> bool: ...
|
|
28
|
+
def locked(self) -> bool: ...
|
|
29
|
+
|
|
30
|
+
class RLock(LockType):
|
|
31
|
+
def release(self) -> None: ... # type: ignore[override]
|
|
32
|
+
|
|
33
|
+
def interrupt_main() -> None: ...
|