Skip to content
Open
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: 7 additions & 4 deletions stubs/boltons/boltons/strutils.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from _typeshed import ReadableBuffer
from collections.abc import Callable, Generator, Iterable, Sequence, Sized
from collections.abc import Callable, Generator, Iterable, Mapping, Sequence, Sized
from html.parser import HTMLParser
from re import Pattern
from typing import Literal, overload
from typing import Literal, TypeAlias, TypeVar, overload

def camel2under(camel_string: str) -> str: ...
def under2camel(under_string: str) -> str: ...
Expand Down Expand Up @@ -55,13 +55,16 @@ def complement_int_list(
) -> str: ...
def int_ranges_from_int_list(range_string: str, delim: str = ",", range_delim: str = "-") -> tuple[tuple[int, int], ...]: ...

_PatternT = TypeVar("_PatternT", bound=str | Pattern[str])
_Replacements: TypeAlias = Mapping[_PatternT, str] | Iterable[tuple[_PatternT, str]]

class MultiReplace:
group_map: dict[str, str]
combined_pattern: Pattern[str]
def __init__(self, sub_map: dict[str, str], **kwargs) -> None: ...
def __init__(self, sub_map: _Replacements[_PatternT], **kwargs) -> None: ...
def sub(self, text: str) -> str: ...

def multi_replace(text: str, sub_map: dict[str, str], **kwargs) -> str: ...
def multi_replace(text: str, sub_map: _Replacements[_PatternT], **kwargs) -> str: ...
def unwrap_text(text: str, ending: str | None = "\n\n") -> str: ...
def removeprefix(text: str, prefix: str) -> str: ...
def human_readable_list(items: Sequence[str], delimiter: str = ",", conjunction: str = "and", *, oxford: bool = True) -> str: ...
Expand Down
Loading