mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 12:44:28 +08:00
@@ -5,6 +5,12 @@
|
||||
import sys
|
||||
from typing import (Any, BinaryIO, Generic, Iterable, Iterator, List, MutableSequence,
|
||||
overload, Text, Tuple, TypeVar, Union)
|
||||
from typing_extensions import Literal
|
||||
|
||||
_IntTypeCode = Literal['b', 'B', 'h', 'H', 'i', 'I', 'l', 'L', 'q', 'Q']
|
||||
_FloatTypeCode = Literal['f', 'd']
|
||||
_UnicodeTypeCode = Literal['u']
|
||||
_TypeCode = Union[_IntTypeCode, _FloatTypeCode, _UnicodeTypeCode]
|
||||
|
||||
_T = TypeVar('_T', int, float, Text)
|
||||
|
||||
@@ -12,8 +18,18 @@ if sys.version_info >= (3,):
|
||||
typecodes: str
|
||||
|
||||
class array(MutableSequence[_T], Generic[_T]):
|
||||
typecode: str
|
||||
typecode: _TypeCode
|
||||
itemsize: int
|
||||
@overload
|
||||
def __init__(self: array[int], typecode: _IntTypeCode,
|
||||
__initializer: Union[bytes, Iterable[_T]] = ...) -> None: ...
|
||||
@overload
|
||||
def __init__(self: array[float], typecode: _FloatTypeCode,
|
||||
__initializer: Union[bytes, Iterable[_T]] = ...) -> None: ...
|
||||
@overload
|
||||
def __init__(self: array[Text], typecode: _UnicodeTypeCode,
|
||||
__initializer: Union[bytes, Iterable[_T]] = ...) -> None: ...
|
||||
@overload
|
||||
def __init__(self, typecode: str,
|
||||
__initializer: Union[bytes, Iterable[_T]] = ...) -> None: ...
|
||||
def append(self, __v: _T) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user