minor namedtuple fixes (#2227)

- The extra arguments aren't keyword-only in 2.7.
- Added the `defaults` argument in 3.7 (https://docs.python.org/3.7/library/collections.html#collections.namedtuple).
This commit is contained in:
Jelle Zijlstra
2018-08-18 19:47:10 -07:00
committed by Ivan Levkivskyi
parent c3b5513475
commit 9e023e7586
2 changed files with 2 additions and 11 deletions

View File

@@ -1,7 +1,3 @@
# Stubs for collections
# Based on http://docs.python.org/3.2/library/collections.html
# These are not exported.
import sys
import typing
@@ -54,7 +50,7 @@ _VT = TypeVar('_VT')
# namedtuple is special-cased in the type checker; the initializer is ignored.
if sys.version_info >= (3, 7):
def namedtuple(typename: str, field_names: Union[str, Iterable[str]], *,
rename: bool = ..., module: Optional[str] = ...) -> Type[tuple]: ...
rename: bool = ..., module: Optional[str] = ..., defaults: Optional[Iterable[Any]] = ...) -> Type[tuple]: ...
elif sys.version_info >= (3, 6):
def namedtuple(typename: str, field_names: Union[str, Iterable[str]], *,
verbose: bool = ..., rename: bool = ..., module: Optional[str] = ...) -> Type[tuple]: ...