mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 13:04:46 +08:00
Added missing type annotations and type arguments (#5070)
Co-authored-by: Eric Traut <erictr@microsoft.com> Co-authored-by: Shantanu <hauntsaninja@users.noreply.github.com>
This commit is contained in:
@@ -14,25 +14,15 @@
|
||||
"stubs/backports",
|
||||
"stubs/backports_abc",
|
||||
"stubs/boto",
|
||||
"stubs/cachetools",
|
||||
"stubs/chardet",
|
||||
"stubs/click",
|
||||
"stubs/cryptography",
|
||||
"stubs/dateparser",
|
||||
"stubs/DateTimeRange",
|
||||
"stubs/decorator",
|
||||
"stubs/docutils",
|
||||
"stubs/fb303",
|
||||
"stubs/Flask",
|
||||
"stubs/frozendict",
|
||||
"stubs/Jinja2",
|
||||
"stubs/kazoo",
|
||||
"stubs/Markdown",
|
||||
"stubs/MarkupSafe",
|
||||
"stubs/mock",
|
||||
"stubs/nmap",
|
||||
"stubs/openssl-python",
|
||||
"stubs/polib",
|
||||
"stubs/paramiko",
|
||||
"stubs/protobuf",
|
||||
"stubs/pymssql",
|
||||
@@ -91,4 +81,4 @@
|
||||
"reportOverlappingOverload": "none",
|
||||
"reportPropertyTypeMismatch": "none",
|
||||
"reportSelfClsParameterName": "none"
|
||||
}
|
||||
}
|
||||
@@ -106,7 +106,7 @@ class SSLProtocol(protocols.Protocol):
|
||||
loop: events.AbstractEventLoop,
|
||||
app_protocol: protocols.BaseProtocol,
|
||||
sslcontext: ssl.SSLContext,
|
||||
waiter: futures.Future,
|
||||
waiter: futures.Future[Any],
|
||||
server_side: bool = ...,
|
||||
server_hostname: Optional[str] = ...,
|
||||
call_connection_made: bool = ...,
|
||||
|
||||
@@ -16,13 +16,13 @@ class DateTimeRange(object):
|
||||
start_time_format: str = ...,
|
||||
end_time_format: str = ...,
|
||||
) -> None: ...
|
||||
def __eq__(self, other) -> bool: ...
|
||||
def __ne__(self, other) -> bool: ...
|
||||
def __add__(self, other) -> DateTimeRange: ...
|
||||
def __iadd__(self, other) -> DateTimeRange: ...
|
||||
def __sub__(self, other) -> DateTimeRange: ...
|
||||
def __isub__(self, other) -> DateTimeRange: ...
|
||||
def __contains__(self, x) -> bool: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def __ne__(self, other: object) -> bool: ...
|
||||
def __add__(self, other: datetime.timedelta) -> DateTimeRange: ...
|
||||
def __iadd__(self, other: datetime.timedelta) -> DateTimeRange: ...
|
||||
def __sub__(self, other: datetime.timedelta) -> DateTimeRange: ...
|
||||
def __isub__(self, other: datetime.timedelta) -> DateTimeRange: ...
|
||||
def __contains__(self, x: Union[datetime.timedelta, DateTimeRange, str]) -> bool: ...
|
||||
@property
|
||||
def start_datetime(self) -> datetime.datetime: ...
|
||||
@property
|
||||
@@ -32,7 +32,7 @@ class DateTimeRange(object):
|
||||
def is_set(self) -> bool: ...
|
||||
def validate_time_inversion(self) -> None: ...
|
||||
def is_valid_timerange(self) -> bool: ...
|
||||
def is_intersection(self, x) -> bool: ...
|
||||
def is_intersection(self, x: DateTimeRange) -> bool: ...
|
||||
def get_start_time_str(self) -> str: ...
|
||||
def get_end_time_str(self) -> str: ...
|
||||
def get_timedelta_second(self) -> float: ...
|
||||
|
||||
@@ -14,7 +14,7 @@ class Markup(text_type):
|
||||
def __mul__(self, num: int) -> Markup: ...
|
||||
def __rmul__(self, num: int) -> Markup: ...
|
||||
def __mod__(self, *args: Any) -> Markup: ...
|
||||
def join(self, seq: Iterable[text_type]): ...
|
||||
def join(self, seq: Iterable[text_type]) -> text_type: ...
|
||||
def split(self, sep: Optional[text_type] = ..., maxsplit: int = ...) -> List[text_type]: ...
|
||||
def rsplit(self, sep: Optional[text_type] = ..., maxsplit: int = ...) -> List[text_type]: ...
|
||||
def splitlines(self, keepends: bool = ...) -> List[text_type]: ...
|
||||
@@ -24,8 +24,8 @@ class Markup(text_type):
|
||||
def escape(cls, s: text_type) -> Markup: ... # noqa: F811
|
||||
def partition(self, sep: text_type) -> Tuple[Markup, Markup, Markup]: ...
|
||||
def rpartition(self, sep: text_type) -> Tuple[Markup, Markup, Markup]: ...
|
||||
def format(self, *args, **kwargs) -> Markup: ...
|
||||
def __html_format__(self, format_spec) -> Markup: ...
|
||||
def format(self, *args: Any, **kwargs: Any) -> Markup: ...
|
||||
def __html_format__(self, format_spec: text_type) -> Markup: ...
|
||||
def __getslice__(self, start: int, stop: int) -> Markup: ...
|
||||
def __getitem__(self, i: Union[int, slice]) -> Markup: ...
|
||||
def capitalize(self) -> Markup: ...
|
||||
|
||||
@@ -5,7 +5,7 @@ _T = TypeVar("_T")
|
||||
_F = TypeVar("_F", bound=Callable[..., Any])
|
||||
_RET = Callable[[_F], _F]
|
||||
|
||||
def lfu_cache(maxsize: int = ..., typed: bool = ...) -> _RET: ...
|
||||
def lru_cache(maxsize: int = ..., typed: bool = ...) -> _RET: ...
|
||||
def rr_cache(maxsize: int = ..., choice: Optional[Callable[[Sequence[_T]], _T]] = ..., typed: bool = ...) -> _RET: ...
|
||||
def ttl_cache(maxsize: int = ..., ttl: float = ..., timer: float = ..., typed: bool = ...) -> _RET: ...
|
||||
def lfu_cache(maxsize: int = ..., typed: bool = ...) -> _RET[_F]: ...
|
||||
def lru_cache(maxsize: int = ..., typed: bool = ...) -> _RET[_F]: ...
|
||||
def rr_cache(maxsize: int = ..., choice: Optional[Callable[[Sequence[_T]], _T]] = ..., typed: bool = ...) -> _RET[_F]: ...
|
||||
def ttl_cache(maxsize: int = ..., ttl: float = ..., timer: float = ..., typed: bool = ...) -> _RET[_F]: ...
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from typing import Generic, Optional, TypeVar
|
||||
from types import TracebackType
|
||||
from typing import Generic, Optional, Type, TypeVar
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
@@ -6,7 +7,9 @@ class ProgressBar(Generic[_T]):
|
||||
def update(self, n_steps: int) -> None: ...
|
||||
def finish(self) -> None: ...
|
||||
def __enter__(self) -> ProgressBar[_T]: ...
|
||||
def __exit__(self, exc_type, exc_value, tb) -> None: ...
|
||||
def __exit__(
|
||||
self, exctype: Optional[Type[BaseException]], excinst: Optional[BaseException], exctb: Optional[TracebackType]
|
||||
) -> None: ...
|
||||
def __iter__(self) -> ProgressBar[_T]: ...
|
||||
def next(self) -> _T: ...
|
||||
def __next__(self) -> _T: ...
|
||||
|
||||
@@ -86,8 +86,8 @@ class Context:
|
||||
def exit(self, code: Union[int, str] = ...) -> NoReturn: ...
|
||||
def get_usage(self) -> str: ...
|
||||
def get_help(self) -> str: ...
|
||||
def invoke(self, callback: Union[Command, Callable[..., Any]], *args, **kwargs) -> Any: ...
|
||||
def forward(self, callback: Union[Command, Callable[..., Any]], *args, **kwargs) -> Any: ...
|
||||
def invoke(self, callback: Union[Command, Callable[..., Any]], *args: Any, **kwargs: Any) -> Any: ...
|
||||
def forward(self, callback: Union[Command, Callable[..., Any]], *args: Any, **kwargs: Any) -> Any: ...
|
||||
|
||||
class BaseCommand:
|
||||
allow_extra_args: bool
|
||||
@@ -98,7 +98,7 @@ class BaseCommand:
|
||||
def __init__(self, name: str, context_settings: Optional[Dict[Any, Any]] = ...) -> None: ...
|
||||
def get_usage(self, ctx: Context) -> str: ...
|
||||
def get_help(self, ctx: Context) -> str: ...
|
||||
def make_context(self, info_name: str, args: List[str], parent: Optional[Context] = ..., **extra) -> Context: ...
|
||||
def make_context(self, info_name: str, args: List[str], parent: Optional[Context] = ..., **extra: Any) -> Context: ...
|
||||
def parse_args(self, ctx: Context, args: List[str]) -> List[str]: ...
|
||||
def invoke(self, ctx: Context) -> Any: ...
|
||||
def main(
|
||||
@@ -107,9 +107,9 @@ class BaseCommand:
|
||||
prog_name: Optional[str] = ...,
|
||||
complete_var: Optional[str] = ...,
|
||||
standalone_mode: bool = ...,
|
||||
**extra,
|
||||
**extra: Any,
|
||||
) -> Any: ...
|
||||
def __call__(self, *args, **kwargs) -> Any: ...
|
||||
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
|
||||
|
||||
class Command(BaseCommand):
|
||||
callback: Optional[Callable[..., Any]]
|
||||
@@ -164,7 +164,7 @@ class MultiCommand(Command):
|
||||
subcommand_metavar: Optional[str] = ...,
|
||||
chain: bool = ...,
|
||||
result_callback: Optional[Callable[..., Any]] = ...,
|
||||
**attrs,
|
||||
**attrs: Any,
|
||||
) -> None: ...
|
||||
def resultcallback(self, replace: bool = ...) -> Callable[[_F], _F]: ...
|
||||
def format_commands(self, ctx: Context, formatter: HelpFormatter) -> None: ...
|
||||
@@ -174,14 +174,14 @@ class MultiCommand(Command):
|
||||
|
||||
class Group(MultiCommand):
|
||||
commands: Dict[str, Command]
|
||||
def __init__(self, name: Optional[str] = ..., commands: Optional[Dict[str, Command]] = ..., **attrs) -> None: ...
|
||||
def add_command(self, cmd: Command, name: Optional[str] = ...): ...
|
||||
def command(self, *args, **kwargs) -> Callable[[Callable[..., Any]], Command]: ...
|
||||
def group(self, *args, **kwargs) -> Callable[[Callable[..., Any]], Group]: ...
|
||||
def __init__(self, name: Optional[str] = ..., commands: Optional[Dict[str, Command]] = ..., **attrs: Any) -> None: ...
|
||||
def add_command(self, cmd: Command, name: Optional[str] = ...) -> None: ...
|
||||
def command(self, *args: Any, **kwargs: Any) -> Callable[[Callable[..., Any]], Command]: ...
|
||||
def group(self, *args: Any, **kwargs: Any) -> Callable[[Callable[..., Any]], Group]: ...
|
||||
|
||||
class CommandCollection(MultiCommand):
|
||||
sources: List[MultiCommand]
|
||||
def __init__(self, name: Optional[str] = ..., sources: Optional[List[MultiCommand]] = ..., **attrs) -> None: ...
|
||||
def __init__(self, name: Optional[str] = ..., sources: Optional[List[MultiCommand]] = ..., **attrs: Any) -> None: ...
|
||||
def add_source(self, multi_cmd: MultiCommand) -> None: ...
|
||||
|
||||
class _ParamType:
|
||||
@@ -277,9 +277,9 @@ class Option(Parameter):
|
||||
hidden: bool = ...,
|
||||
show_choices: bool = ...,
|
||||
show_envvar: bool = ...,
|
||||
**attrs,
|
||||
**attrs: Any,
|
||||
) -> None: ...
|
||||
def prompt_for_value(self, ctx: Context) -> Any: ...
|
||||
|
||||
class Argument(Parameter):
|
||||
def __init__(self, param_decls: Optional[List[str]] = ..., required: Optional[bool] = ..., **attrs) -> None: ...
|
||||
def __init__(self, param_decls: Optional[List[str]] = ..., required: Optional[bool] = ..., **attrs: Any) -> None: ...
|
||||
|
||||
@@ -22,12 +22,12 @@ class HelpFormatter:
|
||||
prog: str,
|
||||
args: str = ...,
|
||||
prefix: str = ...,
|
||||
): ...
|
||||
) -> None: ...
|
||||
def write_heading(self, heading: str) -> None: ...
|
||||
def write_paragraph(self) -> None: ...
|
||||
def write_text(self, text: str) -> None: ...
|
||||
def write_dl(self, rows: Iterable[Iterable[str]], col_max: int = ..., col_spacing: int = ...) -> None: ...
|
||||
def section(self, name) -> ContextManager[None]: ...
|
||||
def section(self, name: str) -> ContextManager[None]: ...
|
||||
def indentation(self) -> ContextManager[None]: ...
|
||||
def getvalue(self) -> str: ...
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ def secho(
|
||||
blink: Optional[bool] = ...,
|
||||
reverse: Optional[bool] = ...,
|
||||
reset: bool = ...,
|
||||
): ...
|
||||
) -> None: ...
|
||||
def edit(
|
||||
text: Optional[str] = ...,
|
||||
editor: Optional[str] = ...,
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
from typing import IO, Any, AnyStr, Generic, Iterator, List, Optional, Text, TypeVar
|
||||
from types import TracebackType
|
||||
from typing import IO, Any, AnyStr, Generic, Iterator, List, Optional, Text, Type, TypeVar
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
def _posixify(name: str) -> str: ...
|
||||
def safecall(func: _T) -> _T: ...
|
||||
def make_str(value: Any) -> str: ...
|
||||
def make_default_short_help(help: str, max_length: int = ...): ...
|
||||
def make_default_short_help(help: str, max_length: int = ...) -> str: ...
|
||||
|
||||
class LazyFile(object):
|
||||
name: str
|
||||
@@ -20,14 +21,18 @@ class LazyFile(object):
|
||||
def close(self) -> None: ...
|
||||
def close_intelligently(self) -> None: ...
|
||||
def __enter__(self) -> LazyFile: ...
|
||||
def __exit__(self, exc_type, exc_value, tb): ...
|
||||
def __exit__(
|
||||
self, exctype: Optional[Type[BaseException]], excinst: Optional[BaseException], exctb: Optional[TracebackType]
|
||||
) -> None: ...
|
||||
def __iter__(self) -> Iterator[Any]: ...
|
||||
|
||||
class KeepOpenFile(Generic[AnyStr]):
|
||||
_file: IO[AnyStr]
|
||||
def __init__(self, file: IO[AnyStr]) -> None: ...
|
||||
def __enter__(self) -> KeepOpenFile[AnyStr]: ...
|
||||
def __exit__(self, exc_type, exc_value, tb): ...
|
||||
def __exit__(
|
||||
self, exctype: Optional[Type[BaseException]], excinst: Optional[BaseException], exctb: Optional[TracebackType]
|
||||
) -> None: ...
|
||||
def __iter__(self) -> Iterator[AnyStr]: ...
|
||||
|
||||
def echo(
|
||||
|
||||
@@ -5,7 +5,7 @@ _C = TypeVar("_C", bound=Callable[..., Any])
|
||||
_Func = TypeVar("_Func", bound=Callable[..., Any])
|
||||
_T = TypeVar("_T")
|
||||
|
||||
def get_init(cls): ...
|
||||
def get_init(cls: type) -> None: ...
|
||||
|
||||
if sys.version_info >= (3,):
|
||||
from inspect import getfullargspec as getfullargspec, iscoroutinefunction as iscoroutinefunction
|
||||
|
||||
@@ -7,7 +7,7 @@ _VT = TypeVar("_VT")
|
||||
|
||||
class frozendict(Mapping[_KT, _VT], Generic[_KT, _VT]):
|
||||
|
||||
dict_cls: Type[Dict] = ...
|
||||
dict_cls: Type[Dict[Any, Any]] = ...
|
||||
@overload
|
||||
def __init__(self, **kwargs: _VT) -> None: ...
|
||||
@overload
|
||||
@@ -22,6 +22,6 @@ class frozendict(Mapping[_KT, _VT], Generic[_KT, _VT]):
|
||||
def __repr__(self) -> str: ...
|
||||
def __hash__(self) -> int: ...
|
||||
|
||||
class FrozenOrderedDict(frozendict):
|
||||
class FrozenOrderedDict(frozendict[_KT, _VT]):
|
||||
|
||||
dict_cls: Type[collections.OrderedDict] = ...
|
||||
dict_cls: Type[collections.OrderedDict[Any, Any]] = ...
|
||||
|
||||
@@ -70,7 +70,9 @@ class PortScanner(object):
|
||||
def has_host(self, host: str) -> bool: ...
|
||||
def csv(self) -> str: ...
|
||||
|
||||
def __scan_progressive__(self, hosts: Text, ports: Text, arguments: Text, callback: Optional[_Callback], sudo: bool) -> None: ...
|
||||
def __scan_progressive__(
|
||||
self: object, hosts: Text, ports: Text, arguments: Text, callback: Optional[_Callback], sudo: bool
|
||||
) -> None: ...
|
||||
|
||||
class PortScannerAsync(object):
|
||||
def __init__(self) -> None: ...
|
||||
|
||||
@@ -18,7 +18,7 @@ class PKey:
|
||||
def __init__(self) -> None: ...
|
||||
def to_cryptography_key(self) -> _Key: ...
|
||||
@classmethod
|
||||
def from_cryptography_key(cls, crypto_key: _Key): ...
|
||||
def from_cryptography_key(cls, crypto_key: _Key) -> PKey: ...
|
||||
def generate_key(self, type: int, bits: int) -> None: ...
|
||||
def check(self) -> bool: ...
|
||||
def type(self) -> int: ...
|
||||
@@ -175,7 +175,7 @@ class PKCS12:
|
||||
def set_ca_certificates(self, cacerts: Iterable[X509]) -> None: ...
|
||||
def set_friendlyname(self, name: bytes) -> None: ...
|
||||
def get_friendlyname(self) -> bytes: ...
|
||||
def export(self, passphrase: Optional[str] = ..., iter: int = ..., maciter: int = ...): ...
|
||||
def export(self, passphrase: Optional[str] = ..., iter: int = ..., maciter: int = ...) -> bytes: ...
|
||||
|
||||
class NetscapeSPKI:
|
||||
def __init__(self) -> None: ...
|
||||
@@ -186,9 +186,9 @@ class NetscapeSPKI:
|
||||
def set_pubkey(self, pkey: PKey) -> None: ...
|
||||
|
||||
def load_publickey(type: int, buffer: _StrLike) -> PKey: ...
|
||||
def load_privatekey(type: int, buffer: bytes, passphrase: Optional[Union[str, Callable[[int], int]]] = ...): ...
|
||||
def dump_certificate_request(type: int, req: X509Req): ...
|
||||
def load_certificate_request(type, buffer: _StrLike) -> X509Req: ...
|
||||
def load_privatekey(type: int, buffer: bytes, passphrase: Optional[Union[str, Callable[[int], int]]] = ...) -> PKey: ...
|
||||
def dump_certificate_request(type: int, req: X509Req) -> bytes: ...
|
||||
def load_certificate_request(type: int, buffer: _StrLike) -> X509Req: ...
|
||||
def sign(pkey: PKey, data: _StrLike, digest: str) -> bytes: ...
|
||||
def verify(cert: X509, signature: bytes, data: _StrLike, digest: str) -> None: ...
|
||||
def dump_crl(type: int, crl: CRL) -> bytes: ...
|
||||
|
||||
@@ -42,7 +42,7 @@ class _BaseFile(List[_TB]):
|
||||
def ordered_metadata(self) -> List[Text]: ...
|
||||
def to_binary(self) -> bytes: ...
|
||||
|
||||
class POFile(_BaseFile):
|
||||
class POFile(_BaseFile[POEntry]):
|
||||
def __unicode__(self) -> Text: ...
|
||||
def save_as_mofile(self, fpath: Text) -> None: ...
|
||||
def percent_translated(self) -> int: ...
|
||||
@@ -52,7 +52,7 @@ class POFile(_BaseFile):
|
||||
def obsolete_entries(self) -> List[POEntry]: ...
|
||||
def merge(self, refpot: POFile) -> None: ...
|
||||
|
||||
class MOFile(_BaseFile):
|
||||
class MOFile(_BaseFile[MOEntry]):
|
||||
MAGIC: int
|
||||
MAGIC_SWAPPED: int
|
||||
magic_number: Optional[int]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from typing import Any
|
||||
|
||||
class JSONEncoder(object):
|
||||
def __init__(self, *args, **kwargs): ...
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||
def encode(self, o: Any): ...
|
||||
def default(self, o: Any): ...
|
||||
def iterencode(self, o: Any, _one_shot: bool): ...
|
||||
|
||||
Reference in New Issue
Block a user