using another style for optional arg

This commit is contained in:
Prodesire 2018-03-01 18:48:32 +08:00
parent baad7f8d55
commit 21571acc9f
3 changed files with 9 additions and 9 deletions

View File

@ -1,22 +1,22 @@
"""Stubs for cmd""" """Stubs for cmd"""
from typing import Optional, Tuple, List, Union from typing import Tuple, List, Union
class TimeoutExpired(Exception): class TimeoutExpired(Exception):
def __init__(self, cmd: str, def __init__(self, cmd: str,
timeout: Union[int, float], timeout: Union[int, float],
output: Optional[str]=..., output: dict=None,
stderr: Optional[str]=...) -> None: ... stderr: dict=None) -> None: ...
def run(cmd: str, def run(cmd: str,
shell: bool=..., shell: bool=...,
env: Optional[dict]=..., env: dict=None,
timeout: Union[int, float]=..., timeout: Union[int, float]=...,
timeinterval: Union[int, float]=...) -> Tuple[int, str]: ... timeinterval: Union[int, float]=...) -> Tuple[int, str]: ...
def run_with_en_env(cmd: str, def run_with_en_env(cmd: str,
shell: bool=..., shell: bool=...,
env: Optional[dict]=..., env: dict=None,
timeout: Union[int, float]=..., timeout: Union[int, float]=...,
timeinterval: Union[int, float]=...) -> Tuple[int, str]: ... timeinterval: Union[int, float]=...) -> Tuple[int, str]: ...
def terminate(pid: int) -> None: ... def terminate(pid: int) -> None: ...

View File

@ -1,8 +1,8 @@
import collections import collections
from typing import Iterable, Tuple, Any, Optional from typing import Iterable, Tuple, Any
class CaseInsensitiveDict(collections.MutableMapping): class CaseInsensitiveDict(collections.MutableMapping):
_store = ... # type: dict _store = ... # type: dict
def __init__(self, data: Optional[dict], **kwargs) -> None: ... def __init__(self, data: dict=None, **kwargs) -> None: ...
def lower_items(self) -> Iterable[Tuple[str, Any]]: ... def lower_items(self) -> Iterable[Tuple[str, Any]]: ...

View File

@ -1,7 +1,7 @@
from typing import Optional, Callable, Any, Hashable, Iterable from typing import Callable, Any, Hashable, Iterable
KeyFunc = Callable[[Any], Hashable] KeyFunc = Callable[[Any], Hashable]
def uniq(seq: Iterable[Any], key: Optional[KeyFunc]) -> list: ... def uniq(seq: Iterable[Any], key: KeyFunc=None) -> list: ...
def tolist(obj: Any) -> list: ... def tolist(obj: Any) -> list: ...
def flatten(seq: Iterable[Any]) -> Iterable[Any]: ... def flatten(seq: Iterable[Any]) -> Iterable[Any]: ...