1 from _typeshed import Self
2 from collections.abc import Iterator, MutableMapping
3 from types import TracebackType
4 from typing import Type, TypeVar, overload
9 class Shelf(MutableMapping[str, _VT]):
11 self, dict: MutableMapping[bytes, bytes], protocol: int | None = ..., writeback: bool = ..., keyencoding: str = ...
13 def __iter__(self) -> Iterator[str]: ...
14 def __len__(self) -> int: ...
16 def get(self, key: str) -> _VT | None: ...
18 def get(self, key: str, default: _T) -> _VT | _T: ...
19 def __getitem__(self, key: str) -> _VT: ...
20 def __setitem__(self, key: str, value: _VT) -> None: ...
21 def __delitem__(self, key: str) -> None: ...
22 def __enter__(self: Self) -> Self: ...
24 self, type: Type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
26 def close(self) -> None: ...
27 def sync(self) -> None: ...
29 class BsdDbShelf(Shelf[_VT]):
30 def set_location(self, key: str) -> tuple[str, _VT]: ...
31 def next(self) -> tuple[str, _VT]: ...
32 def previous(self) -> tuple[str, _VT]: ...
33 def first(self) -> tuple[str, _VT]: ...
34 def last(self) -> tuple[str, _VT]: ...
36 class DbfilenameShelf(Shelf[_VT]):
37 def __init__(self, filename: str, flag: str = ..., protocol: int | None = ..., writeback: bool = ...) -> None: ...
39 def open(filename: str, flag: str = ..., protocol: int | None = ..., writeback: bool = ...) -> Shelf[object]: ...