1 from _typeshed import Self
2 from types import TracebackType
3 from typing import Iterator, MutableMapping, Tuple, Type, Union
4 from typing_extensions import Literal
6 _KeyType = Union[str, bytes]
7 _ValueType = Union[str, bytes]
75 class _Database(MutableMapping[_KeyType, bytes]):
76 def close(self) -> None: ...
77 def __getitem__(self, key: _KeyType) -> bytes: ...
78 def __setitem__(self, key: _KeyType, value: _ValueType) -> None: ...
79 def __delitem__(self, key: _KeyType) -> None: ...
80 def __iter__(self) -> Iterator[bytes]: ...
81 def __len__(self) -> int: ...
82 def __del__(self) -> None: ...
83 def __enter__(self: Self) -> Self: ...
85 self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
88 class _error(Exception): ...
90 error = Tuple[Type[_error], Type[OSError]]
92 def whichdb(filename: str) -> str: ...
93 def open(file: str, flag: _TFlags = ..., mode: int = ...) -> _Database: ...