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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
# © Copyright 2020-2025 Mikołaj Kuranowski
# SPDX-License-Identifier: MIT
import sys
from typing import TYPE_CHECKING, Any, Literal, Optional, Protocol, Type, TypedDict, Union
from typing_extensions import NotRequired
if TYPE_CHECKING:
import csv
if sys.version_info < (3, 12):
_QuotingType = Literal[0, 1, 2, 3]
else:
_QuotingType = Literal[0, 1, 2, 3, 4, 5]
class WithAsyncWrite(Protocol):
async def write(self, __b: str) -> Any: ...
class WithAsyncRead(Protocol):
async def read(self, __size: int) -> str: ...
class DialectLike(Protocol):
delimiter: str
quotechar: Optional[str]
escapechar: Optional[str]
doublequote: bool
skipinitialspace: bool
quoting: _QuotingType
strict: bool
CsvDialectArg = Union[str, "csv.Dialect", Type["csv.Dialect"]]
class CsvDialectKwargs(TypedDict):
delimiter: NotRequired[str]
quotechar: NotRequired[Optional[str]]
escapechar: NotRequired[Optional[str]]
doublequote: NotRequired[bool]
skipinitialspace: NotRequired[bool]
lineterminator: NotRequired[str]
quoting: NotRequired[_QuotingType]
strict: NotRequired[bool]
|