mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 05:24:52 +08:00
clean python 3 specific stuff from stdlib/@python2 stubs (#5451)
This commit is contained in:
@@ -17,12 +17,21 @@ from _csv import (
|
||||
unregister_dialect as unregister_dialect,
|
||||
writer as writer,
|
||||
)
|
||||
from typing import Any, Generic, Iterable, Iterator, List, Mapping, Optional, Sequence, Text, Type, TypeVar, overload
|
||||
|
||||
if sys.version_info >= (3, 8) or sys.version_info < (3, 6):
|
||||
from typing import Dict as _DictReadMapping
|
||||
else:
|
||||
from collections import OrderedDict as _DictReadMapping
|
||||
from typing import (
|
||||
Any,
|
||||
Dict as _DictReadMapping,
|
||||
Generic,
|
||||
Iterable,
|
||||
Iterator,
|
||||
List,
|
||||
Mapping,
|
||||
Optional,
|
||||
Sequence,
|
||||
Text,
|
||||
Type,
|
||||
TypeVar,
|
||||
overload,
|
||||
)
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
@@ -37,15 +46,6 @@ class excel(Dialect):
|
||||
class excel_tab(excel):
|
||||
delimiter: str
|
||||
|
||||
if sys.version_info >= (3,):
|
||||
class unix_dialect(Dialect):
|
||||
delimiter: str
|
||||
quotechar: str
|
||||
doublequote: bool
|
||||
skipinitialspace: bool
|
||||
lineterminator: str
|
||||
quoting: int
|
||||
|
||||
class DictReader(Generic[_T], Iterator[_DictReadMapping[_T, str]]):
|
||||
fieldnames: Optional[Sequence[_T]]
|
||||
restkey: Optional[str]
|
||||
@@ -76,10 +76,7 @@ class DictReader(Generic[_T], Iterator[_DictReadMapping[_T, str]]):
|
||||
**kwds: Any,
|
||||
) -> None: ...
|
||||
def __iter__(self) -> DictReader[_T]: ...
|
||||
if sys.version_info >= (3,):
|
||||
def __next__(self) -> _DictReadMapping[_T, str]: ...
|
||||
else:
|
||||
def next(self) -> _DictReadMapping[_T, str]: ...
|
||||
def next(self) -> _DictReadMapping[_T, str]: ...
|
||||
|
||||
class DictWriter(Generic[_T]):
|
||||
fieldnames: Sequence[_T]
|
||||
@@ -96,10 +93,7 @@ class DictWriter(Generic[_T]):
|
||||
*args: Any,
|
||||
**kwds: Any,
|
||||
) -> None: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
def writeheader(self) -> Any: ...
|
||||
else:
|
||||
def writeheader(self) -> None: ...
|
||||
def writeheader(self) -> None: ...
|
||||
def writerow(self, rowdict: Mapping[_T, Any]) -> Any: ...
|
||||
def writerows(self, rowdicts: Iterable[Mapping[_T, Any]]) -> None: ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user