massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stdlib / shelve.pyi
1 from _typeshed import Self
2 from collections.abc import Iterator, MutableMapping
3 from types import TracebackType
4 from typing import Type, TypeVar, overload
5
6 _T = TypeVar("_T")
7 _VT = TypeVar("_VT")
8
9 class Shelf(MutableMapping[str, _VT]):
10     def __init__(
11         self, dict: MutableMapping[bytes, bytes], protocol: int | None = ..., writeback: bool = ..., keyencoding: str = ...
12     ) -> None: ...
13     def __iter__(self) -> Iterator[str]: ...
14     def __len__(self) -> int: ...
15     @overload
16     def get(self, key: str) -> _VT | None: ...
17     @overload
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: ...
23     def __exit__(
24         self, type: Type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
25     ) -> None: ...
26     def close(self) -> None: ...
27     def sync(self) -> None: ...
28
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]: ...
35
36 class DbfilenameShelf(Shelf[_VT]):
37     def __init__(self, filename: str, flag: str = ..., protocol: int | None = ..., writeback: bool = ...) -> None: ...
38
39 def open(filename: str, flag: str = ..., protocol: int | None = ..., writeback: bool = ...) -> Shelf[object]: ...