mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-19 10:21:14 +08:00
Update shelve.open and dbm.open to support path-like objects (#11881)
Closes #11856
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import sys
|
||||
from _typeshed import StrOrBytesPath
|
||||
from collections.abc import Iterator, MutableMapping
|
||||
from types import TracebackType
|
||||
from typing_extensions import Self, TypeAlias
|
||||
@@ -28,4 +30,8 @@ class _Database(MutableMapping[_KeyType, bytes]):
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> None: ...
|
||||
|
||||
def open(file: str, flag: str = "c", mode: int = 0o666) -> _Database: ...
|
||||
if sys.version_info >= (3, 11):
|
||||
def open(file: StrOrBytesPath, flag: str = "c", mode: int = 0o666) -> _Database: ...
|
||||
|
||||
else:
|
||||
def open(file: str, flag: str = "c", mode: int = 0o666) -> _Database: ...
|
||||
|
||||
Reference in New Issue
Block a user