mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-30 14:45:23 +08:00
apply black and isort (#4287)
* apply black and isort * move some type ignores
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import sys
|
||||
from types import TracebackType
|
||||
from typing import Iterator, Optional, Type, Union, MutableMapping
|
||||
from typing import Iterator, MutableMapping, Optional, Type, Union
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
@@ -16,10 +16,11 @@ class _Database(MutableMapping[_KeyType, bytes]):
|
||||
def __len__(self) -> int: ...
|
||||
def __del__(self) -> None: ...
|
||||
def __enter__(self) -> _Database: ...
|
||||
def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]) -> None: ...
|
||||
def __exit__(
|
||||
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
|
||||
) -> None: ...
|
||||
|
||||
class error(Exception): ...
|
||||
|
||||
def whichdb(filename: str) -> str: ...
|
||||
|
||||
def open(file: str, flag: Literal['r', 'w', 'c', 'n'] = ..., mode: int = ...) -> _Database: ...
|
||||
def open(file: str, flag: Literal["r", "w", "c", "n"] = ..., mode: int = ...) -> _Database: ...
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
|
||||
import sys
|
||||
from typing import Union, MutableMapping, Iterator, Optional, Type
|
||||
from types import TracebackType
|
||||
from typing import Iterator, MutableMapping, Optional, Type, Union
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from typing import Final
|
||||
@@ -14,7 +13,6 @@ _ValueType = Union[str, bytes]
|
||||
error = OSError
|
||||
|
||||
class _Database(MutableMapping[_KeyType, bytes]):
|
||||
|
||||
def __init__(self, filebasename: str, mode: str, flag: str = ...) -> None: ...
|
||||
def sync(self) -> None: ...
|
||||
def iterkeys(self) -> Iterator[bytes]: ... # undocumented
|
||||
@@ -26,6 +24,8 @@ class _Database(MutableMapping[_KeyType, bytes]):
|
||||
def __len__(self) -> int: ...
|
||||
def __del__(self) -> None: ...
|
||||
def __enter__(self) -> _Database: ...
|
||||
def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]) -> None: ...
|
||||
def __exit__(
|
||||
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
|
||||
) -> None: ...
|
||||
|
||||
def open(file: str, flag: str = ..., mode: int = ...) -> _Database: ...
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
from typing import Union, Optional, Type, Iterator, overload, List, TypeVar, Generic
|
||||
from types import TracebackType
|
||||
from typing import Generic, Iterator, List, Optional, Type, TypeVar, Union, overload
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_T = TypeVar("_T")
|
||||
_KeyType = Union[str, bytes]
|
||||
_ValueType = Union[str, bytes]
|
||||
|
||||
@@ -20,15 +19,15 @@ class _gdbm:
|
||||
def __delitem__(self, key: _KeyType) -> None: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __enter__(self) -> _gdbm: ...
|
||||
def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]) -> None: ...
|
||||
|
||||
def __exit__(
|
||||
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
|
||||
) -> None: ...
|
||||
@overload
|
||||
def get(self, k: _KeyType) -> Optional[bytes]: ...
|
||||
@overload
|
||||
def get(self, k: _KeyType, default: Union[bytes, _T]) -> Union[bytes, _T]: ...
|
||||
def keys(self) -> List[bytes]: ...
|
||||
def setdefault(self, k: _KeyType, default: _ValueType = ...) -> bytes: ...
|
||||
|
||||
# Don't exist at runtime
|
||||
__new__: None # type: ignore
|
||||
__init__: None # type: ignore
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
from typing import Generic, Union, Iterator, Optional, Type, TypeVar, overload, List
|
||||
from types import TracebackType
|
||||
from typing import Generic, Iterator, List, Optional, Type, TypeVar, Union, overload
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_T = TypeVar("_T")
|
||||
_KeyType = Union[str, bytes]
|
||||
_ValueType = Union[str, bytes]
|
||||
|
||||
@@ -12,7 +11,6 @@ library: str = ...
|
||||
|
||||
# Actual typename dbm, not exposed by the implementation
|
||||
class _dbm:
|
||||
|
||||
def close(self) -> None: ...
|
||||
def __getitem__(self, item: _KeyType) -> bytes: ...
|
||||
def __setitem__(self, key: _KeyType, value: _ValueType) -> None: ...
|
||||
@@ -20,15 +18,15 @@ class _dbm:
|
||||
def __len__(self) -> int: ...
|
||||
def __del__(self) -> None: ...
|
||||
def __enter__(self) -> _dbm: ...
|
||||
def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]) -> None: ...
|
||||
|
||||
def __exit__(
|
||||
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
|
||||
) -> None: ...
|
||||
@overload
|
||||
def get(self, k: _KeyType) -> Optional[bytes]: ...
|
||||
@overload
|
||||
def get(self, k: _KeyType, default: Union[bytes, _T]) -> Union[bytes, _T]: ...
|
||||
def keys(self) -> List[bytes]: ...
|
||||
def setdefault(self, k: _KeyType, default: _ValueType = ...) -> bytes: ...
|
||||
|
||||
# Don't exist at runtime
|
||||
__new__: None # type: ignore
|
||||
__init__: None # type: ignore
|
||||
|
||||
Reference in New Issue
Block a user