mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 21:46:42 +08:00
Full signature for namedtuple (#541)
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
# NOTE: These are incomplete!
|
||||
|
||||
from typing import (
|
||||
Any, Dict, Generic, TypeVar, Iterable, Tuple, Callable, Mapping, overload, Iterator,
|
||||
Any, Dict, Generic, TypeVar, Iterable, Tuple, Callable, Mapping, overload, Iterator, Type,
|
||||
Sized, Optional, List, Set, Sequence, Union, Reversible, MutableMapping, MutableSequence
|
||||
)
|
||||
import typing
|
||||
@@ -17,7 +17,8 @@ _KT = TypeVar('_KT')
|
||||
_VT = TypeVar('_VT')
|
||||
|
||||
# namedtuple is special-cased in the type checker; the initializer is ignored.
|
||||
namedtuple = ... # type: Any
|
||||
def namedtuple(typename: str, field_names: Union[str, Iterable[Any]], *,
|
||||
verbose: bool = ..., rename: bool = ...) -> Type[tuple]: ...
|
||||
|
||||
class deque(Sized, Iterable[_T], Reversible[_T], Generic[_T]):
|
||||
def __init__(self, iterable: Iterable[_T] = ...,
|
||||
|
||||
@@ -15,7 +15,6 @@ Callable = object()
|
||||
Type = object()
|
||||
builtinclass = object()
|
||||
_promote = object()
|
||||
NamedTuple = object()
|
||||
NewType = object()
|
||||
|
||||
# Type aliases
|
||||
@@ -350,3 +349,9 @@ class Pattern(Generic[AnyStr]):
|
||||
# Functions
|
||||
|
||||
def get_type_hints(obj: Callable) -> dict[str, Any]: ...
|
||||
|
||||
# Type constructors
|
||||
|
||||
# NamedTuple is special-cased in the type checker; the initializer is ignored.
|
||||
def NamedTuple(typename: str, fields: Iterable[Tuple[str, Any]], *,
|
||||
verbose: bool = ..., rename: bool = ...) -> Type[tuple]: ...
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
# These are not exported.
|
||||
from typing import (
|
||||
TypeVar, Iterable, Generic, Iterator, Dict, overload,
|
||||
Mapping, List, Tuple, Callable, Sized,
|
||||
Mapping, List, Tuple, Callable, Sized, Any, Type,
|
||||
Optional, Union
|
||||
)
|
||||
# These are exported.
|
||||
@@ -25,7 +25,8 @@ _VT = TypeVar('_VT')
|
||||
|
||||
|
||||
# namedtuple is special-cased in the type checker; the initializer is ignored.
|
||||
namedtuple = object()
|
||||
def namedtuple(typename: str, field_names: Union[str, Iterable[Any]], *,
|
||||
verbose: bool = ..., rename: bool = ..., module: str = None) -> Type[tuple]: ...
|
||||
|
||||
class UserDict(MutableMapping): ...
|
||||
class UserList(MutableSequence): ...
|
||||
|
||||
@@ -16,7 +16,6 @@ Callable = object()
|
||||
Type = object()
|
||||
builtinclass = object()
|
||||
_promote = object()
|
||||
NamedTuple = object()
|
||||
no_type_check = object()
|
||||
NewType = object()
|
||||
|
||||
@@ -420,3 +419,9 @@ class Pattern(Generic[AnyStr]):
|
||||
# Functions
|
||||
|
||||
def get_type_hints(obj: Callable) -> dict[str, Any]: ...
|
||||
|
||||
# Type constructors
|
||||
|
||||
# NamedTuple is special-cased in the type checker; the initializer is ignored.
|
||||
def NamedTuple(typename: str, fields: Iterable[Tuple[str, Any]], *,
|
||||
verbose: bool = ..., rename: bool = ..., module: str = None) -> Type[tuple]: ...
|
||||
|
||||
Reference in New Issue
Block a user