Skip to content

Commit b357be4

Browse files
authored
[boltons] Update to 26.1.* (#16058)
1 parent 35c51b4 commit b357be4

6 files changed

Lines changed: 28 additions & 15 deletions

File tree

stubs/boltons/METADATA.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
version = "25.0.*"
1+
version = "26.1.*"
22
upstream-repository = "https://github.com/mahmoud/boltons"

stubs/boltons/boltons/__init__.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from typing import Final
2+
3+
__version__: Final[str]

stubs/boltons/boltons/dictutils.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ _VT = TypeVar("_VT")
88
_T = TypeVar("_T")
99

1010
class OrderedMultiDict(dict[_KT, _VT]):
11+
def __reduce__(self) -> tuple[type[Self], tuple[()], list[tuple[_KT, _VT]]]: ...
1112
def add(self, k: _KT, v: _VT) -> None: ...
1213
def addlist(self, k: _KT, v: Iterable[_VT]) -> None: ...
1314
def clear(self) -> None: ...

stubs/boltons/boltons/funcutils.pyi

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import functools
2-
from _typeshed import Incomplete
2+
from _typeshed import Incomplete, Unused
3+
from collections.abc import Callable
34
from functools import total_ordering as total_ordering
5+
from typing import TypeVar
6+
7+
_R = TypeVar("_R")
48

59
NO_DEFAULT: Incomplete
610

@@ -60,4 +64,5 @@ class FunctionBuilder:
6064
class MissingArgument(ValueError): ...
6165
class ExistingArgument(ValueError): ...
6266

63-
def noop(*args, **kwargs) -> None: ...
67+
def noop(*args: Unused, **kwargs: Unused) -> None: ...
68+
def once(func: Callable[[], _R]) -> Callable[[], _R]: ...

stubs/boltons/boltons/iterutils.pyi

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
from _typeshed import Incomplete
2-
from collections.abc import Generator
2+
from collections.abc import Callable, Generator, Iterable
3+
from typing import TypeVar
4+
from typing_extensions import TypeIs
35

4-
def is_iterable(obj) -> bool: ...
5-
def is_scalar(obj) -> bool: ...
6-
def is_collection(obj) -> bool: ...
6+
_T = TypeVar("_T")
7+
8+
def is_iterable(obj: Iterable[_T] | object) -> TypeIs[Iterable[_T]]: ...
9+
def is_scalar(obj: object) -> bool: ...
10+
def is_collection(obj: object) -> bool: ...
711
def split(src, sep=None, maxsplit=None): ...
8-
def split_iter(src, sep=None, maxsplit=None) -> Generator[Incomplete, None, Incomplete]: ...
12+
def split_iter(src, sep=None, maxsplit=None) -> Generator[list[Incomplete]]: ...
913
def lstrip(iterable, strip_value=None): ...
1014
def lstrip_iter(iterable, strip_value=None) -> Generator[Incomplete]: ...
1115
def rstrip(iterable, strip_value=None): ...
1216
def rstrip_iter(iterable, strip_value=None) -> Generator[Incomplete]: ...
1317
def strip(iterable, strip_value=None): ...
1418
def strip_iter(iterable, strip_value=None): ...
1519
def chunked(src, size, count=None, **kw): ...
16-
def chunked_iter(src, size, **kw) -> Generator[Incomplete, None, Incomplete]: ...
20+
def chunked_iter(src, size, **kw) -> Generator[str | bytes]: ...
1721
def chunk_ranges(
1822
input_size: int, chunk_size: int, input_offset: int = 0, overlap_size: int = 0, align: bool = False
1923
) -> Generator[tuple[int, int]]: ...
@@ -26,9 +30,9 @@ def frange(stop, start=None, step: float = 1.0): ...
2630
def backoff(start, stop, count=None, factor: float = 2.0, jitter: bool = False): ...
2731
def backoff_iter(start, stop, count=None, factor: float = 2.0, jitter: bool = False) -> Generator[Incomplete]: ...
2832
def bucketize(src, key=..., value_transform=None, key_filter=None): ...
29-
def partition(src, key=...): ...
33+
def partition(src, key=..., *keys: str | Callable[..., Incomplete]) -> tuple[list[Incomplete], ...]: ...
3034
def unique(src, key=None): ...
31-
def unique_iter(src, key=None) -> Generator[Incomplete, None, Incomplete]: ...
35+
def unique_iter(src, key=None) -> Generator[Incomplete]: ...
3236
def redundant(src, key=None, groups: bool = False): ...
3337
def one(src, default=None, key=None): ...
3438
def first(iterable, default=None, key=None): ...
@@ -38,7 +42,7 @@ def same(iterable, ref=...): ...
3842
def default_visit(path, key, value): ...
3943
def default_enter(path, key, value): ...
4044
def default_exit(path, key, old_parent, new_parent, new_items): ...
41-
def remap(root, visit=..., enter=..., exit=..., **kwargs): ...
45+
def remap(root, visit=..., enter=..., exit=..., cache: bool = True, **kwargs): ...
4246

4347
class PathAccessError(KeyError, IndexError, TypeError):
4448
exc: Incomplete

stubs/boltons/boltons/strutils.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from _typeshed import ReadableBuffer
2-
from collections.abc import Callable, Generator, Iterable, Sized
2+
from collections.abc import Callable, Generator, Iterable, Sequence, Sized
33
from html.parser import HTMLParser
44
from re import Pattern
55
from typing import Literal, overload
@@ -32,8 +32,6 @@ class DeaccenterDict(dict[int, int]):
3232
def bytes2human(nbytes: int, ndigits: int = 0) -> str: ...
3333

3434
class HTMLTextExtractor(HTMLParser):
35-
strict: bool
36-
convert_charrefs: bool
3735
result: list[str]
3836
def __init__(self) -> None: ...
3937
def handle_data(self, d: str) -> None: ...
@@ -66,6 +64,7 @@ class MultiReplace:
6664
def multi_replace(text: str, sub_map: dict[str, str], **kwargs) -> str: ...
6765
def unwrap_text(text: str, ending: str | None = "\n\n") -> str: ...
6866
def removeprefix(text: str, prefix: str) -> str: ...
67+
def human_readable_list(items: Sequence[str], delimiter: str = ",", conjunction: str = "and", *, oxford: bool = True) -> str: ...
6968

7069
__all__ = [
7170
"camel2under",
@@ -100,4 +99,5 @@ __all__ = [
10099
"multi_replace",
101100
"unwrap_text",
102101
"removeprefix",
102+
"human_readable_list",
103103
]

0 commit comments

Comments
 (0)