mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-19 10:21:14 +08:00
csv: annotate keyword arguments in various functions and methods (#7788)
This commit is contained in:
@@ -41,9 +41,45 @@ class _writer:
|
||||
def writerow(self, row: Iterable[Any]) -> Any: ...
|
||||
def writerows(self, rows: Iterable[Iterable[Any]]) -> None: ...
|
||||
|
||||
def writer(csvfile: SupportsWrite[str], dialect: _DialectLike = ..., **fmtparams: Any) -> _writer: ...
|
||||
def reader(csvfile: Iterable[str], dialect: _DialectLike = ..., **fmtparams: Any) -> _reader: ...
|
||||
def register_dialect(name: str, dialect: Any = ..., **fmtparams: Any) -> None: ...
|
||||
def writer(
|
||||
csvfile: SupportsWrite[str],
|
||||
dialect: _DialectLike = ...,
|
||||
*,
|
||||
delimiter: str = ...,
|
||||
quotechar: str | None = ...,
|
||||
escapechar: str | None = ...,
|
||||
doublequote: bool = ...,
|
||||
skipinitialspace: bool = ...,
|
||||
lineterminator: str = ...,
|
||||
quoting: _QuotingType = ...,
|
||||
strict: bool = ...,
|
||||
) -> _writer: ...
|
||||
def reader(
|
||||
csvfile: Iterable[str],
|
||||
dialect: _DialectLike = ...,
|
||||
*,
|
||||
delimiter: str = ...,
|
||||
quotechar: str | None = ...,
|
||||
escapechar: str | None = ...,
|
||||
doublequote: bool = ...,
|
||||
skipinitialspace: bool = ...,
|
||||
lineterminator: str = ...,
|
||||
quoting: _QuotingType = ...,
|
||||
strict: bool = ...,
|
||||
) -> _reader: ...
|
||||
def register_dialect(
|
||||
name: str,
|
||||
dialect: Any = ...,
|
||||
*,
|
||||
delimiter: str = ...,
|
||||
quotechar: str | None = ...,
|
||||
escapechar: str | None = ...,
|
||||
doublequote: bool = ...,
|
||||
skipinitialspace: bool = ...,
|
||||
lineterminator: str = ...,
|
||||
quoting: _QuotingType = ...,
|
||||
strict: bool = ...,
|
||||
) -> None: ...
|
||||
def unregister_dialect(name: str) -> None: ...
|
||||
def get_dialect(name: str) -> Dialect: ...
|
||||
def list_dialects() -> list[str]: ...
|
||||
|
||||
@@ -91,8 +91,15 @@ class DictReader(Generic[_T], Iterator[_DictReadMapping[_T, str]]):
|
||||
restkey: str | None = ...,
|
||||
restval: str | None = ...,
|
||||
dialect: _DialectLike = ...,
|
||||
*args: Any,
|
||||
**kwds: Any,
|
||||
*,
|
||||
delimiter: str = ...,
|
||||
quotechar: str | None = ...,
|
||||
escapechar: str | None = ...,
|
||||
doublequote: bool = ...,
|
||||
skipinitialspace: bool = ...,
|
||||
lineterminator: str = ...,
|
||||
quoting: _QuotingType = ...,
|
||||
strict: bool = ...,
|
||||
) -> None: ...
|
||||
@overload
|
||||
def __init__(
|
||||
@@ -102,8 +109,15 @@ class DictReader(Generic[_T], Iterator[_DictReadMapping[_T, str]]):
|
||||
restkey: str | None = ...,
|
||||
restval: str | None = ...,
|
||||
dialect: _DialectLike = ...,
|
||||
*args: Any,
|
||||
**kwds: Any,
|
||||
*,
|
||||
delimiter: str = ...,
|
||||
quotechar: str | None = ...,
|
||||
escapechar: str | None = ...,
|
||||
doublequote: bool = ...,
|
||||
skipinitialspace: bool = ...,
|
||||
lineterminator: str = ...,
|
||||
quoting: _QuotingType = ...,
|
||||
strict: bool = ...,
|
||||
) -> None: ...
|
||||
def __iter__(self: Self) -> Self: ...
|
||||
def __next__(self) -> _DictReadMapping[_T, str]: ...
|
||||
@@ -120,8 +134,15 @@ class DictWriter(Generic[_T]):
|
||||
restval: Any | None = ...,
|
||||
extrasaction: Literal["raise", "ignore"] = ...,
|
||||
dialect: _DialectLike = ...,
|
||||
*args: Any,
|
||||
**kwds: Any,
|
||||
*,
|
||||
delimiter: str = ...,
|
||||
quotechar: str | None = ...,
|
||||
escapechar: str | None = ...,
|
||||
doublequote: bool = ...,
|
||||
skipinitialspace: bool = ...,
|
||||
lineterminator: str = ...,
|
||||
quoting: _QuotingType = ...,
|
||||
strict: bool = ...,
|
||||
) -> None: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
def writeheader(self) -> Any: ...
|
||||
|
||||
@@ -78,6 +78,8 @@ csv.Dialect.doublequote
|
||||
csv.Dialect.lineterminator
|
||||
csv.Dialect.quoting
|
||||
csv.Dialect.skipinitialspace
|
||||
csv.DictReader.__init__ # runtime sig has *args but will error if more than 5 positional args are supplied
|
||||
csv.DictWriter.__init__ # runtime sig has *args but will error if more than 5 positional args are supplied
|
||||
ctypes.Array.__iter__ # mypy doesn't support using __getitem__ instead of __iter__ so this is here https://github.com/python/mypy/issues/2220
|
||||
ctypes.Array._type_ # _type_ and _length_ are abstract, https://github.com/python/typeshed/pull/6361
|
||||
ctypes.Array._length_
|
||||
|
||||
Reference in New Issue
Block a user