mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 05:24:52 +08:00
Merge pull request #299 from alvarocaceres/csv
csv module: make reader() and writer() return types private and non-abstract
This commit is contained in:
@@ -2,27 +2,22 @@
|
||||
#
|
||||
# NOTE: Based on a dynamically typed stub automatically generated by stubgen.
|
||||
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from typing import Any, Dict, Iterable, List, Sequence, Union
|
||||
|
||||
# Public interface of _csv.reader
|
||||
class Reader(Iterable[List[str]], metaclass=ABCMeta):
|
||||
# Public interface of _csv.reader's return type
|
||||
class _Reader(Iterable[List[str]]):
|
||||
dialect = ... # type: Dialect
|
||||
line_num = ... # type: int
|
||||
|
||||
@abstractmethod
|
||||
def next(self) -> List[str]: ...
|
||||
|
||||
_Row = Sequence[Union[str, int]]
|
||||
|
||||
# Public interface of _csv.writer
|
||||
class Writer(metaclass=ABCMeta):
|
||||
# Public interface of _csv.writer's return type
|
||||
class _Writer:
|
||||
dialect = ... # type: Dialect
|
||||
|
||||
@abstractmethod
|
||||
def writerow(self, row: _Row) -> None: ...
|
||||
|
||||
@abstractmethod
|
||||
def writerows(self, rows: Iterable[_Row]) -> None: ...
|
||||
|
||||
QUOTE_ALL = ... # type: int
|
||||
@@ -34,8 +29,8 @@ class Error(Exception): ...
|
||||
|
||||
_Dialect = Union[str, Dialect]
|
||||
|
||||
def writer(csvfile: Any, dialect: _Dialect = ..., **fmtparams) -> Writer: ...
|
||||
def reader(csvfile: Iterable[str], dialect: _Dialect = ..., **fmtparams) -> Reader: ...
|
||||
def writer(csvfile: Any, dialect: _Dialect = ..., **fmtparams) -> _Writer: ...
|
||||
def reader(csvfile: Iterable[str], dialect: _Dialect = ..., **fmtparams) -> _Reader: ...
|
||||
def register_dialect(name, dialect=..., **fmtparams): ...
|
||||
def unregister_dialect(name): ...
|
||||
def get_dialect(name: str) -> Dialect: ...
|
||||
|
||||
Reference in New Issue
Block a user