add boltons (#8892)

Co-authored-by: Andrey Maslennikov <andrew.maslennikov@gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
This commit is contained in:
Alexander Burchenko
2023-06-07 09:54:37 +03:00
committed by GitHub
parent 89a22f9912
commit 46de19d2cf
34 changed files with 1365 additions and 0 deletions

3
.gitignore vendored
View File

@@ -68,3 +68,6 @@ analyze.py
# Mypy cache
.mypy_cache/
# pyenv local python version
.python-version

View File

@@ -28,6 +28,7 @@
"stubs/bleach",
"stubs/boto",
"stubs/beautifulsoup4",
"stubs/boltons",
"stubs/braintree",
"stubs/caldav",
"stubs/cffi",

View File

@@ -0,0 +1,10 @@
# These names exist in __all__, but have no definition:
boltons.strutils.int_list_complement
boltons.strutils.int_list_to_int_tuples
# Internal compatibility aliases
boltons.cacheutils.basestring
boltons.funcutils.basestring
boltons.funcutils.inspect_formatargspec
boltons.funcutils.make_method
boltons.iterutils.basestring

View File

@@ -0,0 +1,4 @@
version = "23.0.*"
[tool.stubtest]
ignore_missing_stub = false

View File

View File

@@ -0,0 +1,115 @@
import weakref
from _typeshed import Incomplete, Self, SupportsItems, SupportsKeysAndGetItem
from collections.abc import Callable, Generator, Hashable, Iterable, Iterator, Mapping
from typing import Any, Generic, TypeVar, overload
_KT = TypeVar("_KT")
_VT = TypeVar("_VT")
_T = TypeVar("_T")
PREV: int
NEXT: int
KEY: int
VALUE: int
DEFAULT_MAX_SIZE: int
class LRI(dict[_KT, _VT]):
hit_count: int
miss_count: int
soft_miss_count: int
max_size: int
on_miss: Callable[[_KT], _VT]
def __init__(self, max_size: int = 128, values: Incomplete | None = None, on_miss: Incomplete | None = None) -> None: ...
def __setitem__(self, key: _KT, value: _VT) -> None: ...
def __getitem__(self, key: _KT) -> _VT: ...
@overload
def get(self, key: _KT, default: None = None) -> _VT | None: ...
@overload
def get(self, key: _KT, default: _T) -> _T | _VT: ...
def __delitem__(self, key: _KT) -> None: ...
@overload
def pop(self, key: _KT) -> _VT: ...
@overload
def pop(self, key: _KT, default: _T) -> _T | _VT: ...
def popitem(self) -> tuple[_KT, _VT]: ...
def clear(self) -> None: ...
def copy(self: Self) -> Self: ...
@overload
def setdefault(self, key: _KT, default: None = None) -> _VT: ...
@overload
def setdefault(self, key: _KT, default: _VT) -> _VT: ...
def update(self, E: SupportsKeysAndGetItem[_KT, _VT] | Iterable[tuple[_KT, _VT]], **F: _VT) -> None: ... # type: ignore[override]
class LRU(LRI[_KT, _VT]):
def __getitem__(self, key: _KT) -> _VT: ...
def make_cache_key(
args: Iterable[Hashable],
kwargs: SupportsItems[Hashable, Hashable],
typed: bool = False,
kwarg_mark: object = ...,
fasttypes: frozenset[type] = ...,
): ...
class CachedFunction:
func: Incomplete
get_cache: Incomplete
scoped: Incomplete
typed: Incomplete
key_func: Incomplete
def __init__(self, func, cache, scoped: bool = True, typed: bool = False, key: Incomplete | None = None): ...
def __call__(self, *args, **kwargs): ...
class CachedMethod:
func: Incomplete
get_cache: Incomplete
scoped: Incomplete
typed: Incomplete
key_func: Incomplete
bound_to: Incomplete
def __init__(self, func, cache, scoped: bool = True, typed: bool = False, key: Incomplete | None = None): ...
def __get__(self, obj, objtype: Incomplete | None = None): ...
def __call__(self, *args, **kwargs): ...
def cached(cache: Mapping[Any, Any], scoped: bool = True, typed: bool = False, key: Incomplete | None = None): ...
def cachedmethod(cache, scoped: bool = True, typed: bool = False, key: Incomplete | None = None): ...
class cachedproperty(Generic[_T]):
func: Callable[[Incomplete], _T]
def __init__(self, func: Callable[[Incomplete], _T]) -> None: ...
def __get__(self, obj: _T, objtype: type | None = None): ...
class ThresholdCounter(Generic[_T]):
total: int
def __init__(self, threshold: float = 0.001) -> None: ...
@property
def threshold(self) -> float: ...
def add(self, key: _T) -> None: ...
def elements(self) -> Iterator[_T]: ...
def most_common(self, n: int | None = None) -> list[tuple[_T, int]]: ...
def get_common_count(self) -> int: ...
def get_uncommon_count(self) -> int: ...
def get_commonality(self) -> float: ...
def __getitem__(self, key: _T) -> int: ...
def __len__(self) -> int: ...
def __contains__(self, key: _T) -> bool: ...
def iterkeys(self) -> Iterator[_T]: ...
def keys(self) -> list[_T]: ...
def itervalues(self) -> Generator[int, None, None]: ...
def values(self) -> list[int]: ...
def iteritems(self) -> Generator[tuple[_T, int], None, None]: ...
def items(self) -> list[tuple[_T, int]]: ...
def get(self, key: _T, default: int = 0) -> int: ...
def update(self, iterable: Iterable[_T] | Mapping[_T, int], **kwargs: Iterable[_T] | Mapping[_T, int]) -> None: ...
class MinIDMap(Generic[_T]):
mapping: weakref.WeakKeyDictionary[_T, int]
ref_map: dict[_T, int]
free: list[int]
def __init__(self) -> None: ...
def get(self, a: _T) -> int: ...
def drop(self, a: _T) -> None: ...
def __contains__(self, a: _T) -> bool: ...
def __iter__(self) -> Iterator[_T]: ...
def __len__(self) -> int: ...
def iteritems(self) -> Iterator[tuple[_T, int]]: ...

View File

@@ -0,0 +1,9 @@
from _typeshed import Incomplete
from collections.abc import Callable
from typing import Any
def pdb_on_signal(signalnum: int | None = None) -> None: ...
def pdb_on_exception(limit: int = 100) -> None: ...
def wrap_trace(
obj: Incomplete, hook: Callable[..., Any] = ..., which: str | None = None, events: str | None = None, label: str | None = None
) -> Incomplete: ...

View File

@@ -0,0 +1,8 @@
from types import ModuleType
from typing import Any
class DeprecatableModule(ModuleType):
def __init__(self, module: ModuleType) -> None: ...
def __getattribute__(self, name: str) -> Any: ...
def deprecate_module_member(mod_name: str, name: str, message: str) -> None: ...

View File

@@ -0,0 +1,90 @@
from _typeshed import SupportsKeysAndGetItem
from binascii import Incomplete
from collections.abc import Generator, ItemsView, Iterable, KeysView, ValuesView
from typing import NoReturn, TypeVar
from typing_extensions import Self, TypeAlias
_KT = TypeVar("_KT")
_VT = TypeVar("_VT")
_T = TypeVar("_T")
class OrderedMultiDict(dict[_KT, _VT]):
def add(self, k: _KT, v: _VT) -> None: ...
def addlist(self, k: _KT, v: Iterable[_VT]) -> None: ...
def clear(self) -> None: ...
def copy(self) -> Self: ...
def counts(self) -> OrderedMultiDict[_KT, _VT]: ...
@classmethod
def fromkeys(cls, keys: _KT, default: _VT | None = None) -> OrderedMultiDict[_KT, _VT]: ... # type: ignore[override]
def get(self, k: _KT, default: _VT | None = None) -> OrderedMultiDict[_KT, _VT]: ... # type: ignore[override]
def getlist(self, k: _KT, default: _VT | None = ...) -> list[object]: ...
def inverted(self) -> OrderedMultiDict[_KT, _VT]: ...
def items(self, multi: bool = False) -> list[tuple[_KT, _VT]]: ... # type: ignore[override]
def iteritems(self, multi: bool = False) -> Generator[tuple[_KT, _VT], None, None]: ...
def iterkeys(self, multi: bool = False) -> Generator[_KT, None, None]: ...
def itervalues(self, multi: bool = False) -> Generator[_VT, None, None]: ...
def keys(self, multi: bool = False) -> list[_KT]: ... # type: ignore[override]
def pop(self, k: _KT, default: _VT | None = ...) -> _VT: ... # type: ignore[override]
def popall(self, k: _KT, default: _VT | None = ...) -> list[_VT]: ...
def poplast(self, k: _KT | None = ..., default: _VT | None = ...) -> _VT: ...
def setdefault(self, k: _KT, default: _VT | None = ...) -> _VT: ...
def sorted(self, key: _KT | None = None, reverse: bool = False) -> OrderedMultiDict[_KT, _VT]: ...
def sortedvalues(self, key: _KT | None = None, reverse: bool = False) -> OrderedMultiDict[_KT, _VT]: ...
def todict(self, multi: bool = False) -> dict[_KT, _VT]: ...
def update(self, E: dict[_KT, _VT] | Iterable[object], **F) -> None: ... # type: ignore[override]
def update_extend(self, E: dict[_KT, _VT] | Iterable[object], **F) -> None: ...
def values(self, multi: bool = False) -> list[_VT]: ... # type: ignore[override]
def viewitems(self) -> ItemsView[_KT, _VT]: ...
def viewkeys(self) -> KeysView[_KT]: ...
def viewvalues(self) -> ValuesView[_VT]: ...
OMD: TypeAlias = OrderedMultiDict[_KT, _VT]
MultiDict: TypeAlias = OrderedMultiDict[_KT, _VT]
class FastIterOrderedMultiDict(OrderedMultiDict[_KT, _VT]): # undocumented
def iteritems(self, multi: bool = False) -> Generator[tuple[_KT, _VT], None, None]: ...
def iterkeys(self, multi: bool = False) -> Generator[_KT, None, None]: ...
class OneToOne(dict[_KT, _VT]):
inv: dict[_VT, _KT]
def clear(self) -> None: ...
def copy(self) -> Self: ...
def pop(self, key: _KT, default: _VT | _T = ...) -> _VT | _T: ...
def popitem(self) -> tuple[_KT, _VT]: ...
def setdefault(self, key: _KT, default: _VT | None = None) -> _VT: ...
@classmethod
def unique(cls, *a, **kw) -> Self: ...
def update(self, dict_or_iterable, **kw) -> None: ... # type: ignore[override]
class ManyToMany(dict[_KT, frozenset[_VT]]):
data: dict[_KT, set[_VT]]
inv: dict[_VT, set[_KT]]
# def __contains__(self, key: _KT): ...
def __delitem__(self, key: _KT) -> None: ...
def __eq__(self, other): ...
def __getitem__(self, key: _KT): ...
def __init__(self, items: Iterable[Incomplete] | None = None) -> None: ...
def __iter__(self): ...
def __len__(self): ...
def __setitem__(self, key: _KT, vals: Iterable[_VT]) -> None: ...
def add(self, key: _KT, val: _VT) -> None: ...
def get(self, key: _KT, default: frozenset[_VT] = ...) -> frozenset[_VT]: ... # type: ignore[override]
def iteritems(self) -> Generator[tuple[_KT, _VT], None, None]: ...
def keys(self): ...
def remove(self, key: _KT, val: _VT) -> None: ...
def replace(self, key: _KT, newkey: _KT) -> None: ...
def update(self, iterable: ManyToMany[_KT, _VT] | SupportsKeysAndGetItem[_KT, _VT] | tuple[_KT, _VT]) -> None: ... # type: ignore[override]
def subdict(d: dict[_KT, _VT], keep: Iterable[_KT] | None = None, drop: Iterable[_KT] | None = None) -> dict[_KT, _VT]: ...
class FrozenHashError(TypeError): ... # undocumented
class FrozenDict(dict[_KT, _VT]):
def __copy__(self) -> Self: ...
def clear(self, *a, **kw) -> None: ...
@classmethod
def fromkeys(cls, keys: Iterable[_KT], value: _VT | None = None) -> FrozenDict[_KT, _VT]: ... # type: ignore[override]
def pop(self, *a, **kw) -> NoReturn: ...
def popitem(self, *a, **kw) -> NoReturn: ...
def setdefault(self, *a, **kw) -> NoReturn: ...
def updated(self, *a, **kw) -> Self: ...

View File

@@ -0,0 +1,3 @@
from typing import NoReturn
def gobs_program() -> NoReturn: ...

View File

@@ -0,0 +1,28 @@
from typing import Any
ECO_VERSION: str
PY_GT_2: bool
HAVE_URANDOM: bool
INSTANCE_ID: str
IS_64BIT: bool
HAVE_UCS4: bool
HAVE_READLINE: bool
SQLITE_VERSION: str
OPENSSL_VERSION: str
TKINTER_VERSION: str
ZLIB_VERSION: str
EXPAT_VERSION: str
CPU_COUNT: int
HAVE_THREADING: bool
HAVE_IPV6: bool
RLIMIT_NOFILE: int
RLIMIT_FDS_SOFT: int
RLIMIT_FDS_HARD: int
START_TIME_INFO: dict[str, str | float]
def getrandbits(k: int) -> int: ...
def get_python_info() -> dict[str, Any]: ...
def get_profile(**kwargs) -> dict[str, Any]: ...
def get_profile_json(indent: bool = False) -> str: ...
def main() -> None: ...
def dumps(val: Any, indent: int) -> str: ...

View File

@@ -0,0 +1,9 @@
from typing import Any
from typing_extensions import Self
class ExceptionCauseMixin(Exception):
cause: Any
def __new__(cls, *args, **kw) -> Self: ...
def get_str(self) -> str: ...
class MathError(ExceptionCauseMixin, ValueError): ...

View File

@@ -0,0 +1,79 @@
from _typeshed import StrOrBytesPath
from collections.abc import Callable, Generator, Iterable
from types import TracebackType
from typing import IO, Any, NoReturn
from typing_extensions import Self
def mkdir_p(path: StrOrBytesPath) -> None: ...
class FilePerms:
user: str
group: str
other: str
def __init__(self, user: str = "", group: str = "", other: str = "") -> None: ...
@classmethod
def from_int(cls, i: int) -> Self: ...
@classmethod
def from_path(cls, path: StrOrBytesPath) -> Self: ...
def __int__(self) -> int: ...
def atomic_save(dest_path: str, **kwargs) -> AtomicSaver: ...
class AtomicSaver:
dest_path: str
overwrite: bool
file_perms: int
overwrite_part: bool
part_filename: str
rm_part_on_exc: bool
text_mode: bool
buffering: int
dest_dir: str
part_path: str
mode: str
open_flags: int
part_file: str | None
def __init__(self, dest_path: str, **kwargs) -> None: ...
def setup(self) -> None: ...
def __enter__(self) -> IO[Any] | None: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
def iter_find_files(
directory: str, patterns: str | Iterable[str], ignored: str | Iterable[str] | None = None, include_dirs: bool = False
) -> Generator[str, None, None]: ...
def copy_tree(
src: StrOrBytesPath,
dst: StrOrBytesPath,
symlinks: bool = False,
ignore: None | Callable[[str, list[str]], Iterable[str]] | Callable[[StrOrBytesPath, list[str]], Iterable[str]] = None,
) -> None: ...
copytree = copy_tree
class DummyFile:
name: str
mode: str
closed: bool
errors: None
isatty: bool
encoding: None
newlines: None
softspace: int
def __init__(self, path: StrOrBytesPath, mode: str = "r", buffering: int | None = None) -> None: ...
def close(self) -> None: ...
def fileno(self) -> int: ...
def flush(self) -> None: ...
def next(self) -> NoReturn: ...
def read(self, size: int = 0) -> str: ...
def readline(self, size: int = 0) -> str: ...
def readlines(self, size: int = 0) -> list[str]: ...
def seek(self) -> None: ...
def tell(self) -> int: ...
def truncate(self) -> None: ...
def write(self, string: str) -> None: ...
def writelines(self, list_of_strings: list[str]) -> None: ...
def __next__(self) -> NoReturn: ...
def __enter__(self) -> None: ...
def __exit__(self, exc_type, exc_val, exc_tb) -> None: ...

View File

@@ -0,0 +1,35 @@
from collections.abc import Callable
from typing import Any
def construct_format_field_str(fname: str, fspec: str, conv: str) -> str: ...
def infer_positional_format_args(fstr: str) -> str: ...
def get_format_args(fstr: str) -> tuple[list[tuple[int, type]], list[tuple[str, type]]]: ...
def tokenize_format_str(fstr: str, resolve_pos: bool = True) -> list[str | BaseFormatField]: ...
class BaseFormatField:
def __init__(self, fname: str, fspec: str = "", conv: str | None = None) -> None: ...
base_name: str
fname: str
subpath: str
is_positional: bool
def set_fname(self, fname: str) -> None: ...
subfields: list[str]
fspec: str
type_char: str
type_func: str
def set_fspec(self, fspec) -> None: ...
conv: str
conv_func: str | None
def set_conv(self, conv: str) -> None: ...
@property
def fstr(self) -> str: ...
class DeferredValue:
func: Callable[..., Any]
cache_value: bool
def __init__(self, func: Callable[..., Any], cache_value: bool = True) -> None: ...
def get_value(self) -> Any: ...
def __int__(self) -> int: ...
def __float__(self) -> float: ...
def __unicode__(self) -> str: ...
def __format__(self, fmt: str) -> str: ...

View File

@@ -0,0 +1,59 @@
import functools
from _typeshed import Incomplete
from functools import total_ordering as total_ordering
NO_DEFAULT: Incomplete
def get_module_callables(mod, ignore: Incomplete | None = None): ...
def mro_items(type_obj): ...
def dir_dict(obj, raise_exc: bool = False): ...
def copy_function(orig, copy_dict: bool = True): ...
def partial_ordering(cls): ...
class InstancePartial(functools.partial[Incomplete]):
def __get__(self, obj, obj_type): ...
class CachedInstancePartial(functools.partial[Incomplete]):
__name__: Incomplete
def __set_name__(self, obj_type, name) -> None: ...
__doc__: Incomplete
__module__: Incomplete
def __get__(self, obj, obj_type): ...
partial = CachedInstancePartial
def format_invocation(name: str = "", args=(), kwargs: Incomplete | None = None, **kw): ...
def format_exp_repr(
obj, pos_names, req_names: Incomplete | None = None, opt_names: Incomplete | None = None, opt_key: Incomplete | None = None
): ...
def format_nonexp_repr(
obj, req_names: Incomplete | None = None, opt_names: Incomplete | None = None, opt_key: Incomplete | None = None
): ...
def wraps(func, injected: Incomplete | None = None, expected: Incomplete | None = None, **kw): ...
def update_wrapper(
wrapper,
func,
injected: Incomplete | None = None,
expected: Incomplete | None = None,
build_from: Incomplete | None = None,
**kw,
): ...
class FunctionBuilder:
name: Incomplete
def __init__(self, name, **kw) -> None: ...
def get_sig_str(self, with_annotations: bool = True): ...
def get_invocation_str(self): ...
@classmethod
def from_func(cls, func): ...
def get_func(self, execdict: Incomplete | None = None, add_source: bool = True, with_dict: bool = True): ...
def get_defaults_dict(self): ...
def get_arg_names(self, only_required: bool = False): ...
defaults: Incomplete
def add_arg(self, arg_name, default=..., kwonly: bool = False) -> None: ...
def remove_arg(self, arg_name) -> None: ...
class MissingArgument(ValueError): ...
class ExistingArgument(ValueError): ...
def noop(*args, **kwargs) -> None: ...

View File

@@ -0,0 +1,14 @@
from typing import TypeVar
_T = TypeVar("_T")
def get_all(type_obj: type[_T], include_subtypes: bool = True) -> list[_T]: ...
class GCToggler:
postcollect: bool
def __init__(self, postcollect: bool = False) -> None: ...
def __enter__(self) -> None: ...
def __exit__(self, exc_type, exc_val, exc_tb) -> None: ...
toggle_gc: GCToggler
toggle_gc_postcollect: GCToggler

View File

@@ -0,0 +1,93 @@
import abc
from _typeshed import Incomplete
from abc import abstractmethod
text_type = str
binary_type = bytes
READ_CHUNK_SIZE: int
EINVAL: Incomplete
class SpooledIOBase(metaclass=abc.ABCMeta):
__metaclass__: Incomplete
def __init__(self, max_size: int = 5000000, dir: Incomplete | None = None) -> None: ...
@abstractmethod
def read(self, n: int = -1): ...
@abstractmethod
def write(self, s): ...
@abstractmethod
def seek(self, pos, mode: int = 0): ...
@abstractmethod
def readline(self, length: Incomplete | None = None): ...
@abstractmethod
def readlines(self, sizehint: int = 0): ...
def writelines(self, lines) -> None: ...
@abstractmethod
def rollover(self): ...
@abstractmethod
def tell(self): ...
@property
@abc.abstractmethod
def buffer(self): ...
@property
@abc.abstractmethod
def len(self): ...
softspace: Incomplete
def close(self): ...
def flush(self): ...
def isatty(self): ...
def next(self): ...
@property
def closed(self): ...
@property
def pos(self): ...
@property
def buf(self): ...
def fileno(self): ...
def truncate(self, size: Incomplete | None = None): ...
def getvalue(self): ...
def seekable(self): ...
def readable(self): ...
def writable(self): ...
__next__: Incomplete
def __len__(self): ...
def __iter__(self): ...
def __enter__(self): ...
def __exit__(self, *args) -> None: ...
def __eq__(self, other): ...
def __ne__(self, other): ...
def __bool__(self): ...
__nonzero__: Incomplete
class SpooledBytesIO(SpooledIOBase):
def read(self, n: int = -1): ...
def write(self, s) -> None: ...
def seek(self, pos, mode: int = 0): ...
def readline(self, length: Incomplete | None = None): ...
def readlines(self, sizehint: int = 0): ...
def rollover(self) -> None: ...
@property
def buffer(self): ...
@property
def len(self): ...
def tell(self): ...
class SpooledStringIO(SpooledIOBase):
def __init__(self, *args, **kwargs) -> None: ...
def read(self, n: int = -1): ...
def write(self, s) -> None: ...
def seek(self, pos, mode: int = 0): ...
def readline(self, length: Incomplete | None = None): ...
def readlines(self, sizehint: int = 0): ...
@property
def buffer(self): ...
def rollover(self) -> None: ...
def tell(self): ...
@property
def len(self): ...
def is_text_fileobj(fileobj) -> bool: ...
class MultiFileReader:
def __init__(self, *fileobjs) -> None: ...
def read(self, amt: Incomplete | None = None): ...
def seek(self, offset, whence=0) -> None: ...

View File

@@ -0,0 +1,83 @@
from _typeshed import Incomplete
from collections.abc import Generator
def is_iterable(obj) -> bool: ...
def is_scalar(obj) -> bool: ...
def is_collection(obj) -> bool: ...
def split(src, sep: Incomplete | None = None, maxsplit: Incomplete | None = None): ...
def split_iter(
src, sep: Incomplete | None = None, maxsplit: Incomplete | None = None
) -> Generator[Incomplete, None, Incomplete]: ...
def lstrip(iterable, strip_value: Incomplete | None = None): ...
def lstrip_iter(iterable, strip_value: Incomplete | None = None) -> Generator[Incomplete, None, None]: ...
def rstrip(iterable, strip_value: Incomplete | None = None): ...
def rstrip_iter(iterable, strip_value: Incomplete | None = None) -> Generator[Incomplete, None, None]: ...
def strip(iterable, strip_value: Incomplete | None = None): ...
def strip_iter(iterable, strip_value: Incomplete | None = None): ...
def chunked(src, size, count: Incomplete | None = None, **kw): ...
def chunked_iter(src, size, **kw) -> Generator[Incomplete, None, Incomplete]: ...
def chunk_ranges(
input_size: int, chunk_size: int, input_offset: int = 0, overlap_size: int = 0, align: bool = False
) -> Generator[tuple[int, int], None, None]: ...
def pairwise(src): ...
def pairwise_iter(src): ...
def windowed(src, size): ...
def windowed_iter(src, size): ...
def xfrange(stop, start: Incomplete | None = None, step: float = 1.0) -> Generator[Incomplete, None, None]: ...
def frange(stop, start: Incomplete | None = None, step: float = 1.0): ...
def backoff(start, stop, count: Incomplete | None = None, factor: float = 2.0, jitter: bool = False): ...
def backoff_iter(
start, stop, count: Incomplete | None = None, factor: float = 2.0, jitter: bool = False
) -> Generator[Incomplete, None, None]: ...
def bucketize(src, key=..., value_transform: Incomplete | None = None, key_filter: Incomplete | None = None): ...
def partition(src, key=...): ...
def unique(src, key: Incomplete | None = None): ...
def unique_iter(src, key: Incomplete | None = None) -> Generator[Incomplete, None, Incomplete]: ...
def redundant(src, key: Incomplete | None = None, groups: bool = False): ...
def one(src, default: Incomplete | None = None, key: Incomplete | None = None): ...
def first(iterable, default: Incomplete | None = None, key: Incomplete | None = None): ...
def flatten_iter(iterable) -> Generator[Incomplete, None, None]: ...
def flatten(iterable): ...
def same(iterable, ref=...): ...
def default_visit(path, key, value): ...
def default_enter(path, key, value): ...
def default_exit(path, key, old_parent, new_parent, new_items): ...
def remap(root, visit=..., enter=..., exit=..., **kwargs): ...
class PathAccessError(KeyError, IndexError, TypeError):
exc: Incomplete
seg: Incomplete
path: Incomplete
def __init__(self, exc, seg, path) -> None: ...
def get_path(root, path, default=...): ...
def research(root, query=..., reraise: bool = False): ...
class GUIDerator:
size: Incomplete
count: Incomplete
def __init__(self, size: int = 24) -> None: ...
pid: Incomplete
salt: Incomplete
def reseed(self) -> None: ...
def __iter__(self): ...
def __next__(self): ...
next: Incomplete
class SequentialGUIDerator(GUIDerator):
start: Incomplete
def reseed(self) -> None: ...
def __next__(self): ...
next: Incomplete
guid_iter: Incomplete
seq_guid_iter: Incomplete
def soft_sorted(
iterable,
first: Incomplete | None = None,
last: Incomplete | None = None,
key: Incomplete | None = None,
reverse: bool = False,
): ...
def untyped_sorted(iterable, key: Incomplete | None = None, reverse: bool = False): ...

View File

@@ -0,0 +1,25 @@
from collections.abc import Generator
from typing import IO, Any, overload
from typing_extensions import Self
@overload
def reverse_iter_lines(
file_obj: IO[bytes], blocksize: int = 4096, preseek: bool = True, encoding: None = None
) -> Generator[bytes, None, None]: ...
@overload
def reverse_iter_lines(
file_obj: IO[str], blocksize: int = 4096, preseek: bool = True, *, encoding: str
) -> Generator[str, None, None]: ...
@overload
def reverse_iter_lines(file_obj: IO[str], blocksize: int, preseek: bool, encoding: str) -> Generator[str, None, None]: ...
class JSONLIterator:
ignore_errors: bool
def __init__(
self, file_obj: IO[str], ignore_errors: bool = False, reverse: bool = False, rel_seek: float | None = None
) -> None: ...
@property
def cur_byte_pos(self) -> int: ...
def __iter__(self) -> Self: ...
def next(self) -> Any: ...
__next__ = next

View File

@@ -0,0 +1,33 @@
from collections.abc import Iterable
from typing import TypeVar, overload
from typing_extensions import Self, SupportsIndex, TypeAlias
_T = TypeVar("_T")
class BarrelList(list[_T]):
lists: list[list[_T]]
@overload
def __init__(self, iterable: None = None) -> None: ...
@overload
def __init__(self, iterable: Iterable[_T]) -> None: ...
def insert(self, index: SupportsIndex, item: _T) -> None: ...
def append(self, item: _T) -> None: ...
def extend(self, iterable: Iterable[_T]) -> None: ...
def pop(self, *a) -> _T: ...
def iter_slice(self, start: int, stop: int, step: int | None = None) -> Iterable[_T]: ...
def del_slice(self, start: int, stop: int, step: int | None = None) -> None: ...
__delslice__ = del_slice
@classmethod
def from_iterable(cls, it: Iterable[_T]) -> Self: ...
def __getslice__(self, start: int, stop: int): ...
def __setslice__(self, start: int, stop: int, sequence: int) -> None: ...
def sort(self) -> None: ... # type: ignore[override]
def reverse(self) -> None: ...
def count(self, item: _T) -> int: ...
def index(self, item: _T) -> int: ... # type: ignore[override]
BList: TypeAlias = BarrelList[_T]
class SplayList(list[_T]):
def shift(self, item_index: int, dest_index: int = 0) -> None: ...
def swap(self, item_index: int, dest_index: int) -> None: ...

View File

@@ -0,0 +1,33 @@
from collections.abc import Sequence
def clamp(x: float, lower: float = ..., upper: float = ...) -> float: ...
def ceil(x: float, options: Sequence[float] | None = None) -> float: ...
def floor(x: float, options: Sequence[float] | None = None) -> float: ...
class Bits:
val: int
len: int
def __init__(self, val: int | list[bool] | str | bytes = 0, len_: int | None = None) -> None: ...
def __getitem__(self, k) -> Bits | bool: ...
def __len__(self) -> int: ...
def __eq__(self, other) -> bool: ...
def __or__(self, other: Bits) -> Bits: ...
def __and__(self, other: Bits) -> Bits: ...
def __lshift__(self, other: int) -> Bits: ...
def __rshift__(self, other: int) -> Bits: ...
def __hash__(self) -> int: ...
def as_list(self) -> list[bool]: ...
def as_bin(self) -> str: ...
def as_hex(self) -> str: ...
def as_int(self) -> int: ...
def as_bytes(self) -> bytes: ...
@classmethod
def from_list(cls, list_): ...
@classmethod
def from_bin(cls, bin): ...
@classmethod
def from_hex(cls, hex): ...
@classmethod
def from_int(cls, int_, len_: int | None = None): ...
@classmethod
def from_bytes(cls, bytes_): ...

View File

@@ -0,0 +1,8 @@
import mailbox
DEFAULT_MAXMEM: int
class mbox_readonlydir(mailbox.mbox):
maxmem: int
def __init__(self, path: str, factory: type | None = None, create: bool = True, maxmem: int = 1048576) -> None: ...
def flush(self) -> None: ...

View File

@@ -0,0 +1,4 @@
from collections.abc import Sequence
def namedtuple(typename: str, field_names: Sequence[str], verbose: bool = False, rename: bool = False): ...
def namedlist(typename: str, field_names: Sequence[str], verbose: bool = False, rename: bool = False): ...

View File

@@ -0,0 +1,11 @@
def augpath(
path: str,
suffix: str = "",
prefix: str = "",
ext: str | None = None,
base: str | None = None,
dpath: str | None = None,
multidot: bool = False,
) -> str: ...
def shrinkuser(path: str, home: str = "~") -> str: ...
def expandpath(path: str) -> str: ...

View File

@@ -0,0 +1,15 @@
from binascii import Incomplete
from typing_extensions 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=...) -> Incomplete: ...
def pop(self, default=...) -> Incomplete: ...
def __len__(self) -> int: ...
class HeapPriorityQueue(BasePriorityQueue): ...
class SortedPriorityQueue(BasePriorityQueue): ...
PriorityQueue: TypeAlias = SortedPriorityQueue

View File

@@ -0,0 +1,89 @@
from collections.abc import Generator, Iterable, Iterator, MutableSet
from itertools import islice
from typing import Any
from typing_extensions import Self
class IndexedSet(MutableSet[Any]):
item_index_map: dict[Any, Any]
item_list: list[Any]
dead_indices: list[int]
def __init__(self, other: Iterable[Any] | None = None) -> None: ...
def __len__(self) -> int: ...
def __contains__(self, item: Any) -> bool: ...
def __iter__(self) -> Iterator[Any]: ...
def __reversed__(self) -> Generator[Any, None, None]: ...
@classmethod
def from_iterable(cls, it: Iterable[Any]) -> set[Any]: ...
def add(self, item: Any) -> None: ...
def remove(self, item: Any) -> None: ...
def discard(self, item: Any) -> None: ...
def clear(self) -> None: ...
def isdisjoint(self, other: Iterable[Any]) -> bool: ...
def issubset(self, other: Iterable[Any]) -> bool: ...
def issuperset(self, other: Iterable[Any]) -> bool: ...
def union(self, *others: Iterable[Any]) -> set[Any]: ...
def iter_intersection(self, *others: Iterable[Any]) -> Generator[Any, None, None]: ...
def intersection(self, *others: Iterable[Any]) -> set[Any]: ...
def iter_difference(self, *others: Iterable[Any]) -> Generator[Any, None, None]: ...
def difference(self, *others: Iterable[Any]) -> Any: ...
def symmetric_difference(self, *others: Iterable[Any]) -> set[Any]: ...
# __or__ = union
__ror__ = union
# __and__ = intersection
__rand__ = intersection
# __sub__ = difference
# __xor__ = symmetric_difference
__rxor__ = symmetric_difference
def __rsub__(self, other: Iterable[Any]) -> Any: ...
def update(self, *others: Iterable[Any]) -> None: ...
def intersection_update(self, *others: Iterable[Any]) -> None: ...
def difference_update(self, *others: Iterable[Any]) -> None: ...
def symmetric_difference_update(self, other: Iterable[Any]) -> None: ...
def iter_slice(self, start: int, stop: int, step: int | None = None) -> islice[Iterable[Any]]: ...
def __getitem__(self, index: int) -> Any: ...
def pop(self, index: int | None = None) -> Any: ...
def count(self, val: Any) -> int: ...
def reverse(self) -> None: ...
def sort(self, **kwargs) -> None: ...
def index(self, val: Any) -> int: ...
def complement(wrapped: set[Any]) -> set[Any]: ...
class _ComplementSet:
def __init__(self, included: set[Any] | None = None, excluded: set[Any] | None = None) -> None: ...
def complemented(self) -> set[Any]: ...
__invert__ = complemented
def complement(self) -> None: ...
def __contains__(self, item: Any) -> bool: ...
def add(self, item: Any) -> None: ...
def remove(self, item: Any) -> None: ...
def pop(self) -> Any: ...
def intersection(self, other: set[Any]) -> set[Any]: ...
def __and__(self, other: set[Any]) -> set[Any]: ...
__rand__ = __and__
def __iand__(self, other: set[Any]) -> Self: ...
def union(self, other: set[Any]) -> set[Any]: ...
def __or__(self, other: set[Any]) -> set[Any]: ...
__ror__ = __or__
def __ior__(self, other: set[Any]) -> Self: ...
def update(self, items: Iterable[Any]) -> None: ...
def discard(self, items: Iterable[Any]) -> None: ...
def symmetric_difference(self, other: set[Any]) -> set[Any]: ...
def __xor__(self, other: set[Any]) -> set[Any]: ...
__rxor__ = __xor__
def symmetric_difference_update(self, other: set[Any]) -> None: ...
def isdisjoint(self, other: set[Any]) -> bool: ...
def issubset(self, other: set[Any]) -> bool: ...
def __le__(self, other: set[Any]) -> bool: ...
def __lt__(self, other: set[Any]) -> bool: ...
def issuperset(self, other: set[Any]) -> bool: ...
def __ge__(self, other: set[Any]) -> bool: ...
def __gt__(self, other: set[Any]) -> bool: ...
def difference(self, other: set[Any]) -> set[Any]: ...
def __sub__(self, other: set[Any]) -> set[Any]: ...
def __rsub__(self, other: set[Any]) -> set[Any]: ...
def difference_update(self, other: set[Any]) -> None: ...
def __isub__(self, other: set[Any]) -> Self: ...
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[Any]: ...
def __bool__(self) -> bool: ...

View File

@@ -0,0 +1,72 @@
import socket
from _typeshed import ReadableBuffer, SliceableBuffer
DEFAULT_TIMEOUT: int
DEFAULT_MAXSIZE: int
class BufferedSocket:
sock: socket.socket
rbuf: bytes
sbuf: list[SliceableBuffer]
maxsize: int
timeout: int
def __init__(self, sock: socket.socket, timeout: int = ..., maxsize: int = 32768, recvsize: int = ...) -> None: ...
def settimeout(self, timeout: float) -> None: ...
def gettimeout(self) -> float: ...
def setblocking(self, blocking: bool) -> None: ...
def setmaxsize(self, maxsize) -> None: ...
def getrecvbuffer(self) -> bytes: ...
def getsendbuffer(self) -> bytes: ...
def recv(self, size: int, flags: int = 0, timeout: float = ...) -> bytes: ...
def peek(self, size: int, timeout: float = ...) -> bytes: ...
def recv_close(self, timeout: float = ..., maxsize: int = ...) -> bytes: ...
def recv_until(
self, delimiter: ReadableBuffer, timeout: float = ..., maxsize: int = ..., with_delimiter: bool = False
) -> bytes: ...
def recv_size(self, size: int, timeout: float = ...) -> bytes: ...
def send(self, data: SliceableBuffer, flags: int = 0, timeout: float = ...) -> str: ...
def sendall(self, data: SliceableBuffer, flags: int = 0, timeout: float = ...) -> str: ...
def flush(self) -> None: ...
def buffer(self, data: SliceableBuffer) -> None: ...
def getsockname(self) -> str: ...
def getpeername(self) -> str: ...
def getsockopt(self, level: int, optname: int, buflen: int | None = None) -> bytes | int: ...
def setsockopt(self, level: int, optname: int, value: int | ReadableBuffer | None) -> bytes | int: ...
@property
def type(self) -> int: ...
@property
def family(self) -> int: ...
@property
def proto(self) -> int: ...
def fileno(self) -> int: ...
rbuf_unconsumed: bytes
def close(self) -> None: ...
def shutdown(self, how: int) -> None: ...
class Error(socket.error): ...
class ConnectionClosed(Error): ...
class MessageTooLong(Error):
def __init__(self, bytes_read: int | None = None, delimiter: str | None = None) -> None: ...
class Timeout(socket.timeout, Error):
def __init__(self, timeout: float, extra: str = "") -> None: ...
class NetstringSocket:
bsock: BufferedSocket
timeout: float
maxsize: int
def __init__(self, sock: socket.socket, timeout: float = 10, maxsize: int = 32768) -> None: ...
def fileno(self) -> int: ...
def settimeout(self, timeout: float) -> None: ...
def setmaxsize(self, maxsize: int) -> None: ...
def read_ns(self, timeout: float = ..., maxsize: int = ...): ...
def write_ns(self, payload: bytes) -> None: ...
class NetstringProtocolError(Error): ...
class NetstringInvalidSize(NetstringProtocolError):
def __init__(self, msg: str) -> None: ...
class NetstringMessageTooLong(NetstringProtocolError):
def __init__(self, size: int, maxsize: int) -> None: ...

View File

@@ -0,0 +1,62 @@
from _typeshed import Incomplete
from collections.abc import Callable, Iterator
from typing import Any
class _StatsProperty:
name: str
func: Callable[..., Any]
internal_name: str
__doc__: str | None
def __init__(self, name: str, func: Callable[..., Any]) -> None: ...
def __get__(self, obj: object, objtype: Any | None = None) -> Any: ...
class Stats:
data: list[float]
default: float
def __init__(self, data: list[float], default: float = 0.0, use_copy: bool = True, is_sorted: bool = False) -> None: ...
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[float]: ...
def clear_cache(self) -> None: ...
count: _StatsProperty
mean: _StatsProperty
max: _StatsProperty
min: _StatsProperty
median: _StatsProperty
iqr: _StatsProperty
trimean: _StatsProperty
variance: _StatsProperty
std_dev: _StatsProperty
median_abs_dev: _StatsProperty
mad: _StatsProperty
rel_std_dev: _StatsProperty
skewness: _StatsProperty
kurtosis: _StatsProperty
pearson_type: _StatsProperty
def get_quantile(self, q: float) -> float: ...
def get_zscore(self, value: float) -> float: ...
def trim_relative(self, amount: float = 0.15) -> None: ...
def get_histogram_counts(self, bins: int | None = None, **kw) -> int: ...
def format_histogram(self, bins: int | None = None, **kw) -> str: ...
def describe(
self, quantiles: list[float] | None = None, format: str | None = None
) -> dict[str, float] | list[float] | str: ...
def describe(
data: list[float], quantiles: list[float] | None = None, format: str | None = None
) -> dict[str, float] | list[float] | str: ...
mean: Incomplete
median: Incomplete
iqr: Incomplete
trimean: Incomplete
variance: Incomplete
std_dev: Incomplete
median_abs_dev: Incomplete
rel_std_dev: Incomplete
skewness: Incomplete
kurtosis: Incomplete
pearson_type: Incomplete
def format_histogram_counts(
bin_counts: list[float], width: int | None = None, format_bin: Callable[..., Any] | None = None
) -> str: ...

View File

@@ -0,0 +1,64 @@
from collections.abc import Callable, Generator, Iterable
from html.parser import HTMLParser
from typing import Any, TypeVar
_KT = TypeVar("_KT")
_VT = TypeVar("_VT")
unichr = chr
def camel2under(camel_string: str) -> str: ...
def under2camel(under_string: str) -> str: ...
def slugify(text: str, delim: str = "_", lower: bool = True, ascii: bool = False) -> str: ...
def split_punct_ws(text: str) -> str: ...
def unit_len(sized_iterable: Iterable[Any], unit_noun: str = "item") -> str: ...
def ordinalize(number: int | str, ext_only: bool = False) -> str: ...
def cardinalize(unit_noun: str, count: int) -> str: ...
def singularize(word: str) -> str: ...
def pluralize(word: str) -> str: ...
def find_hashtags(string: str) -> list[str]: ...
def a10n(string: str) -> str: ...
def strip_ansi(text: str) -> str: ...
def asciify(text: str, ignore: bool = False): ...
def is_ascii(text: str) -> bool: ...
class DeaccenterDict(dict[_KT, _VT]):
def __missing__(self, key: _KT) -> _VT: ...
def __getitem__(self, key: _KT) -> _VT: ...
def bytes2human(nbytes: int, ndigits: int = 0) -> str: ...
class HTMLTextExtractor(HTMLParser):
strict: bool
convert_charrefs: bool
result: list[str]
def __init__(self) -> None: ...
def handle_data(self, d: str) -> None: ...
def handle_charref(self, number: str) -> None: ...
def handle_entityref(self, name: str) -> None: ...
def get_text(self) -> str: ...
def html2text(html: str) -> str: ...
def gunzip_bytes(bytestring: bytes) -> bytes: ...
def gzip_bytes(bytestring: bytes, level: int = 6) -> int: ...
def iter_splitlines(text: str) -> Generator[str, None, None]: ...
def indent(text: str, margin: str, newline: str = "\n", key: Callable[..., bool] = ...) -> str: ...
def is_uuid(obj, version: int = 4) -> bool: ...
def escape_shell_args(args: list[str], sep: str = " ", style: str | None = None) -> str: ...
def args2sh(args: list[str], sep: str = " ") -> str: ...
def args2cmd(args: list[str], sep: str = " ") -> str: ...
def parse_int_list(range_string: str, delim: str = ",", range_delim: str = "-") -> list[int]: ...
def format_int_list(int_list: list[int], delim: str = ",", range_delim: str = "-", delim_space: bool = False) -> str: ...
class MultiReplace:
group_map: dict[str, str]
combined_pattern: str
def __init__(self, sub_map: dict[str, str], **kwargs) -> None: ...
def sub(self, text: str) -> str: ...
def multi_replace(text: str, sub_map: dict[str, str], **kwargs) -> str: ...
def unwrap_text(text: str, ending: str = "\n\n") -> str: ...
# Names in __all__ with no definition:
# int_list_complement
# int_list_to_int_tuples

View File

@@ -0,0 +1,63 @@
from _typeshed import Incomplete
class UnsupportedData(TypeError): ...
class InputType:
def __init__(self, *a, **kw) -> None: ...
def get_entry_seq(self, data_seq, headers): ...
class DictInputType(InputType):
def check_type(self, obj): ...
def guess_headers(self, obj): ...
def get_entry(self, obj, headers): ...
def get_entry_seq(self, obj, headers): ...
class ObjectInputType(InputType):
def check_type(self, obj): ...
def guess_headers(self, obj): ...
def get_entry(self, obj, headers): ...
class ListInputType(InputType):
def check_type(self, obj): ...
def guess_headers(self, obj) -> None: ...
def get_entry(self, obj, headers): ...
def get_entry_seq(self, obj_seq, headers): ...
class TupleInputType(InputType):
def check_type(self, obj): ...
def guess_headers(self, obj) -> None: ...
def get_entry(self, obj, headers): ...
def get_entry_seq(self, obj_seq, headers): ...
class NamedTupleInputType(InputType):
def check_type(self, obj): ...
def guess_headers(self, obj): ...
def get_entry(self, obj, headers): ...
def get_entry_seq(self, obj_seq, headers): ...
class Table:
headers: Incomplete
metadata: Incomplete
def __init__(self, data: Incomplete | None = None, headers=..., metadata: Incomplete | None = None) -> None: ...
def extend(self, data) -> None: ...
@classmethod
def from_dict(cls, data, headers=..., max_depth: int = 1, metadata: Incomplete | None = None): ...
@classmethod
def from_list(cls, data, headers=..., max_depth: int = 1, metadata: Incomplete | None = None): ...
@classmethod
def from_object(cls, data, headers=..., max_depth: int = 1, metadata: Incomplete | None = None): ...
@classmethod
def from_data(cls, data, headers=..., max_depth: int = 1, **kwargs): ...
def __len__(self): ...
def __getitem__(self, idx): ...
def to_html(
self,
orientation: Incomplete | None = None,
wrapped: bool = True,
with_headers: bool = True,
with_newlines: bool = True,
with_metadata: bool = False,
max_depth: int = 1,
): ...
def get_cell_html(self, value): ...
def to_text(self, with_headers: bool = True, maxlen: Incomplete | None = None): ...

View File

@@ -0,0 +1,85 @@
from collections.abc import Iterator
from types import FrameType, TracebackType
from typing import Any
from typing_extensions import Self
class Callpoint:
func_name: str
lineno: int
module_name: str
module_path: str
lasti: int
line: str
def __init__(
self, module_name: str, module_path: str, func_name: str, lineno: int, lasti: int, line: str | None = None
) -> None: ...
def to_dict(self) -> dict[str, object]: ...
@classmethod
def from_current(cls, level: int = 1) -> Self: ...
@classmethod
def from_frame(cls, frame: FrameType) -> Self: ...
@classmethod
def from_tb(cls, tb: TracebackType) -> Self: ...
def tb_frame_str(self) -> str: ...
class TracebackInfo:
callpoint_type: type[Callpoint]
frames: list[FrameType]
def __init__(self, frames: list[FrameType]) -> None: ...
@classmethod
def from_frame(cls, frame: FrameType | None = None, level: int = 1, limit: int | None = None) -> Self: ...
@classmethod
def from_traceback(cls, tb: TracebackType | None = None, limit: int | None = None) -> Self: ...
@classmethod
def from_dict(cls, d: dict[str, list[FrameType]]) -> Self: ...
def to_dict(self) -> dict[str, list[FrameType]]: ...
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[FrameType]: ...
def get_formatted(self) -> str: ...
class ExceptionInfo:
tb_info_type: type[TracebackInfo]
exc_type: str
exc_msg: str
tb_info: TracebackInfo
def __init__(self, exc_type: str, exc_msg: str, tb_info: TracebackInfo) -> None: ...
@classmethod
def from_exc_info(cls, exc_type: str, exc_value: Any, traceback: TracebackType) -> Self: ...
@classmethod
def from_current(cls) -> Self: ...
def to_dict(self) -> dict[str, str | dict[str, list[FrameType]]]: ...
def get_formatted(self) -> str: ...
def get_formatted_exception_only(self) -> str: ...
class ContextualCallpoint(Callpoint):
local_reprs: dict[Any, Any]
pre_lines: list[str]
post_lines: list[str]
def __init__(self, *a, **kw) -> None: ...
@classmethod
def from_frame(cls, frame: FrameType) -> Self: ...
@classmethod
def from_tb(cls, tb: TracebackType) -> Self: ...
def to_dict(self) -> dict[str, Any]: ...
class ContextualTracebackInfo(TracebackInfo):
callpoint_type: type[ContextualCallpoint]
class ContextualExceptionInfo(ExceptionInfo):
tb_info_type: type[ContextualTracebackInfo]
def print_exception(etype: str, value: Any, tb: TracebackType, limit: int | None = None, file: str | None = None) -> None: ...
class ParsedException:
exc_type: str
exc_msg: str
frames: list[FrameType]
def __init__(self, exc_type_name: str, exc_msg: str, frames: list[FrameType] | None = None) -> None: ...
@property
def source_file(self) -> str | None: ...
def to_dict(self) -> dict[str, str | list[FrameType]]: ...
def to_string(self) -> str: ...
@classmethod
def from_string(cls, tb_str: str) -> Self: ...
ParsedTB = ParsedException

View File

@@ -0,0 +1,62 @@
from collections.abc import Generator
from datetime import date, datetime, timedelta, tzinfo
def total_seconds(td: timedelta) -> float: ...
def dt_to_timestamp(dt: datetime) -> int: ...
def isoparse(iso_str: str) -> datetime: ...
def parse_timedelta(text: str) -> timedelta: ...
parse_td = parse_timedelta
def decimal_relative_time(
d: datetime, other: datetime | None = None, ndigits: int = 0, cardinalize: bool = True
) -> tuple[float, str]: ...
def relative_time(d: datetime, other: datetime | None = None, ndigits: int = 0) -> str: ...
def strpdate(string: str, format: str) -> date: ...
def daterange(start: date, stop: date, step: int = 1, inclusive: bool = False) -> Generator[date, None, None]: ...
ZERO: timedelta
HOUR: timedelta
class ConstantTZInfo(tzinfo):
name: str
offset: timedelta
def __init__(self, name: str = "ConstantTZ", offset: timedelta = ...) -> None: ...
@property
def utcoffset_hours(self) -> str: ...
def utcoffset(self, dt: datetime | None) -> timedelta: ...
def tzname(self, dt: datetime | None) -> str: ...
def dst(self, dt: datetime | None) -> timedelta: ...
UTC: ConstantTZInfo
EPOCH_AWARE: datetime
EPOCH_NAIVE: datetime
class LocalTZInfo(tzinfo):
def is_dst(self, dt: datetime) -> bool: ...
def utcoffset(self, dt: datetime | None) -> timedelta: ...
def dst(self, dt: datetime | None) -> timedelta: ...
def tzname(self, dt: datetime | None) -> str: ...
LocalTZ: LocalTZInfo
DSTSTART_2007: datetime
DSTEND_2007: datetime
DSTSTART_1987_2006: datetime
DSTEND_1987_2006: datetime
DSTSTART_1967_1986: datetime
DSTEND_1967_1986: datetime
class USTimeZone(tzinfo):
stdoffset: timedelta
reprname: str
stdname: str
dstname: str
def __init__(self, hours: int, reprname: str, stdname: str, dstname: str) -> None: ...
def tzname(self, dt: datetime | None) -> str: ...
def utcoffset(self, dt: datetime | None) -> timedelta: ...
def dst(self, dt: datetime | None) -> timedelta: ...
Eastern: USTimeZone
Central: USTimeZone
Mountain: USTimeZone
Pacific: USTimeZone

View File

@@ -0,0 +1,10 @@
from typing import Any
def make_sentinel(name: str = "_MISSING", var_name: str | None = None) -> object: ...
def issubclass(subclass: type, baseclass: type) -> bool: ...
def get_all_subclasses(cls: type) -> list[type]: ...
class classproperty:
fn: Any
def __init__(self, fn) -> None: ...
def __get__(self, instance, cls): ...

View File

@@ -0,0 +1,86 @@
from _typeshed import Incomplete
from boltons.dictutils import OrderedMultiDict
SCHEME_PORT_MAP: Incomplete
NO_NETLOC_SCHEMES: Incomplete
class URLParseError(ValueError): ...
DEFAULT_ENCODING: str
def to_unicode(obj: object) -> str: ...
def find_all_links(text, with_text: bool = False, default_scheme: str = "https", schemes=()): ...
def quote_path_part(text, full_quote: bool = True): ...
def quote_query_part(text, full_quote: bool = True): ...
def quote_fragment_part(text, full_quote: bool = True): ...
def quote_userinfo_part(text, full_quote: bool = True): ...
def unquote(string, encoding: str = "utf-8", errors: str = "replace"): ...
def unquote_to_bytes(string): ...
def register_scheme(text, uses_netloc: Incomplete | None = None, default_port: Incomplete | None = None) -> None: ...
def resolve_path_parts(path_parts): ...
class cachedproperty:
__doc__: Incomplete
func: Incomplete
def __init__(self, func) -> None: ...
def __get__(self, obj, objtype: Incomplete | None = None): ...
class URL:
scheme: Incomplete
username: Incomplete
password: Incomplete
family: Incomplete
host: Incomplete
port: Incomplete
path_parts: Incomplete
fragment: Incomplete
def __init__(self, url: str = "") -> None: ...
@classmethod
def from_parts(
cls,
scheme: Incomplete | None = None,
host: Incomplete | None = None,
path_parts=(),
query_params=(),
fragment: str = "",
port: Incomplete | None = None,
username: Incomplete | None = None,
password: Incomplete | None = None,
): ...
query_params: Incomplete
qp: Incomplete
@property
def path(self): ...
@path.setter
def path(self, path_text) -> None: ...
@property
def uses_netloc(self): ...
@property
def default_port(self): ...
def normalize(self, with_case: bool = True) -> None: ...
def navigate(self, dest): ...
def get_authority(self, full_quote: bool = False, with_userinfo: bool = False): ...
def to_text(self, full_quote: bool = False): ...
def __unicode__(self): ...
def __eq__(self, other): ...
def __ne__(self, other): ...
def parse_host(host): ...
def parse_url(url_text): ...
DEFAULT_PARSED_URL: Incomplete
def parse_qsl(qs, keep_blank_values: bool = True, encoding="utf8"): ...
PREV: Incomplete
NEXT: Incomplete
KEY: Incomplete
VALUE: Incomplete
SPREV: Incomplete
SNEXT: Incomplete
class QueryParamDict(OrderedMultiDict[Incomplete, Incomplete]):
@classmethod
def from_text(cls, query_string): ...
def to_text(self, full_quote: bool = False): ...