Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions stubs/boltons/boltons/fileutils.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from _typeshed import BytesPath, StrOrBytesPath, StrPath
from collections.abc import Callable, Generator, Iterable
from os import PathLike
from types import TracebackType
from typing import IO, Any, TypeVar, overload
from typing_extensions import Never, Self
Expand All @@ -9,7 +8,7 @@ _StrPathT = TypeVar("_StrPathT", bound=StrPath)
_BytesPathT = TypeVar("_BytesPathT", bound=BytesPath)

def mkdir_p(path: StrOrBytesPath) -> None: ...
def rotate_file(filename: PathLike[str], *, keep: int = 5) -> None: ...
def rotate_file(filename: StrPath, *, keep: int = 5) -> None: ...

class FilePerms:
user: str
Expand All @@ -22,7 +21,7 @@ class FilePerms:
def from_path(cls, path: StrOrBytesPath) -> Self: ...
def __int__(self) -> int: ...

def atomic_save(dest_path: str, **kwargs) -> AtomicSaver: ...
def atomic_save(dest_path: StrPath, **kwargs) -> AtomicSaver: ...

class AtomicSaver:
dest_path: str
Expand All @@ -37,10 +36,10 @@ class AtomicSaver:
part_path: str
mode: str
open_flags: int
part_file: str | None
def __init__(self, dest_path: str, **kwargs) -> None: ...
part_file: IO[Any] | None
def __init__(self, dest_path: StrPath, **kwargs) -> None: ...
def setup(self) -> None: ...
def __enter__(self) -> IO[Any] | None: ...
def __enter__(self) -> IO[Any]: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
Expand Down
35 changes: 24 additions & 11 deletions stubs/boltons/boltons/queueutils.pyi
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
from typing import TypeAlias

class BasePriorityQueue:
def __init__(self, **kw) -> None: ...
def add(self, task, priority: int | None = None) -> None: ...
def remove(self, task) -> None: ...
def peek(self, default=...): ...
def pop(self, default=...): ...
from collections.abc import Hashable
from typing import Any, Generic, TypeAlias, TypeVar, overload

_TaskT = TypeVar("_TaskT", bound=Hashable, default=Any)
_DefaultT = TypeVar("_DefaultT")

class BasePriorityQueue(Generic[_TaskT]):
def __init__(self, **kw: Any) -> None: ...
def add(self, task: _TaskT, priority: float | None = None) -> None: ...
def remove(self, task: _TaskT) -> None: ...

@overload
def peek(self) -> _TaskT: ...
@overload
def peek(self, default: _DefaultT) -> _TaskT | _DefaultT: ...

@overload
def pop(self) -> _TaskT: ...
@overload
def pop(self, default: _DefaultT) -> _TaskT | _DefaultT: ...

def __len__(self) -> int: ...

class HeapPriorityQueue(BasePriorityQueue): ...
class SortedPriorityQueue(BasePriorityQueue): ...
class HeapPriorityQueue(BasePriorityQueue[_TaskT]): ...
class SortedPriorityQueue(BasePriorityQueue[_TaskT]): ...

PriorityQueue: TypeAlias = SortedPriorityQueue
PriorityQueue: TypeAlias = SortedPriorityQueue[_TaskT]

__all__ = ["PriorityQueue", "BasePriorityQueue", "HeapPriorityQueue", "SortedPriorityQueue"]
Loading