From 9680e815dc0150958b98e5eb165bc3d17fb9181c Mon Sep 17 00:00:00 2001 From: Alexander Burchenko Date: Wed, 12 Oct 2022 23:55:53 +0200 Subject: [PATCH 01/51] update gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index cca2cf7b80d3..d9cb7a3dd702 100644 --- a/.gitignore +++ b/.gitignore @@ -66,3 +66,6 @@ analyze.py # Mypy cache .mypy_cache/ + +# pyenv local python version +.python-version From a6800a3a71d179b153c38ab38ea3beb44915fddf Mon Sep 17 00:00:00 2001 From: Alexander Burchenko Date: Thu, 13 Oct 2022 00:27:09 +0200 Subject: [PATCH 02/51] add auto-generated stubs for boltons --- pyrightconfig.stricter.json | 1 + stubs/boltons/METADATA.toml | 4 + stubs/boltons/boltons/__init__.pyi | 0 stubs/boltons/boltons/cacheutils.pyi | 111 +++++++++++++++++++++ stubs/boltons/boltons/debugutils.pyi | 7 ++ stubs/boltons/boltons/deprutils.pyi | 9 ++ stubs/boltons/boltons/dictutils.pyi | 101 +++++++++++++++++++ stubs/boltons/boltons/easterutils.pyi | 1 + stubs/boltons/boltons/ecoutils.pyi | 26 +++++ stubs/boltons/boltons/excutils.pyi | 27 ++++++ stubs/boltons/boltons/fileutils.pyi | 77 +++++++++++++++ stubs/boltons/boltons/formatutils.pyi | 36 +++++++ stubs/boltons/boltons/funcutils.pyi | 60 ++++++++++++ stubs/boltons/boltons/gcutils.pyi | 12 +++ stubs/boltons/boltons/ioutils.pyi | 93 ++++++++++++++++++ stubs/boltons/boltons/iterutils.pyi | 82 ++++++++++++++++ stubs/boltons/boltons/jsonutils.pyi | 15 +++ stubs/boltons/boltons/listutils.pyi | 35 +++++++ stubs/boltons/boltons/mathutils.pyi | 36 +++++++ stubs/boltons/boltons/mboxutils.pyi | 9 ++ stubs/boltons/boltons/namedutils.pyi | 4 + stubs/boltons/boltons/pathutils.pyi | 13 +++ stubs/boltons/boltons/queueutils.pyi | 16 +++ stubs/boltons/boltons/setutils.pyi | 96 ++++++++++++++++++ stubs/boltons/boltons/socketutils.pyi | 74 ++++++++++++++ stubs/boltons/boltons/statsutils.pyi | 44 +++++++++ stubs/boltons/boltons/strutils.pyi | 61 ++++++++++++ stubs/boltons/boltons/tableutils.pyi | 65 +++++++++++++ stubs/boltons/boltons/tbutils.pyi | 91 +++++++++++++++++ stubs/boltons/boltons/timeutils.pyi | 61 ++++++++++++ stubs/boltons/boltons/typeutils.pyi | 10 ++ stubs/boltons/boltons/urlutils.pyi | 135 ++++++++++++++++++++++++++ 32 files changed, 1412 insertions(+) create mode 100644 stubs/boltons/METADATA.toml create mode 100644 stubs/boltons/boltons/__init__.pyi create mode 100644 stubs/boltons/boltons/cacheutils.pyi create mode 100644 stubs/boltons/boltons/debugutils.pyi create mode 100644 stubs/boltons/boltons/deprutils.pyi create mode 100644 stubs/boltons/boltons/dictutils.pyi create mode 100644 stubs/boltons/boltons/easterutils.pyi create mode 100644 stubs/boltons/boltons/ecoutils.pyi create mode 100644 stubs/boltons/boltons/excutils.pyi create mode 100644 stubs/boltons/boltons/fileutils.pyi create mode 100644 stubs/boltons/boltons/formatutils.pyi create mode 100644 stubs/boltons/boltons/funcutils.pyi create mode 100644 stubs/boltons/boltons/gcutils.pyi create mode 100644 stubs/boltons/boltons/ioutils.pyi create mode 100644 stubs/boltons/boltons/iterutils.pyi create mode 100644 stubs/boltons/boltons/jsonutils.pyi create mode 100644 stubs/boltons/boltons/listutils.pyi create mode 100644 stubs/boltons/boltons/mathutils.pyi create mode 100644 stubs/boltons/boltons/mboxutils.pyi create mode 100644 stubs/boltons/boltons/namedutils.pyi create mode 100644 stubs/boltons/boltons/pathutils.pyi create mode 100644 stubs/boltons/boltons/queueutils.pyi create mode 100644 stubs/boltons/boltons/setutils.pyi create mode 100644 stubs/boltons/boltons/socketutils.pyi create mode 100644 stubs/boltons/boltons/statsutils.pyi create mode 100644 stubs/boltons/boltons/strutils.pyi create mode 100644 stubs/boltons/boltons/tableutils.pyi create mode 100644 stubs/boltons/boltons/tbutils.pyi create mode 100644 stubs/boltons/boltons/timeutils.pyi create mode 100644 stubs/boltons/boltons/typeutils.pyi create mode 100644 stubs/boltons/boltons/urlutils.pyi diff --git a/pyrightconfig.stricter.json b/pyrightconfig.stricter.json index 29fd2f4ec4b1..f520ea2ecf18 100644 --- a/pyrightconfig.stricter.json +++ b/pyrightconfig.stricter.json @@ -34,6 +34,7 @@ "stubs/bleach", "stubs/boto", "stubs/beautifulsoup4", + "stubs/boltons", "stubs/braintree", "stubs/caldav", "stubs/cffi", diff --git a/stubs/boltons/METADATA.toml b/stubs/boltons/METADATA.toml new file mode 100644 index 000000000000..1f08a40912f2 --- /dev/null +++ b/stubs/boltons/METADATA.toml @@ -0,0 +1,4 @@ +version = "21.0.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/boltons/boltons/__init__.pyi b/stubs/boltons/boltons/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/stubs/boltons/boltons/cacheutils.pyi b/stubs/boltons/boltons/cacheutils.pyi new file mode 100644 index 000000000000..c2fb44aa741a --- /dev/null +++ b/stubs/boltons/boltons/cacheutils.pyi @@ -0,0 +1,111 @@ +from _typeshed import Incomplete +from collections.abc import Generator + +class RLock: + def __enter__(self) -> None: ... + def __exit__(self, exctype, excinst, exctb) -> None: ... + +xrange = range +unicode: Incomplete +str: Incomplete +bytes: Incomplete +basestring: Incomplete +PREV: Incomplete +NEXT: Incomplete +KEY: Incomplete +VALUE: Incomplete +DEFAULT_MAX_SIZE: int + +class LRI(dict): + hit_count: int + max_size: Incomplete + on_miss: Incomplete + def __init__(self, max_size=..., values: Incomplete | None = ..., on_miss: Incomplete | None = ...) -> None: ... + def __setitem__(self, key, value) -> None: ... + def __getitem__(self, key): ... + def get(self, key, default: Incomplete | None = ...): ... + def __delitem__(self, key) -> None: ... + def pop(self, key, default=...): ... + def popitem(self): ... + def clear(self) -> None: ... + def copy(self): ... + def setdefault(self, key, default: Incomplete | None = ...): ... + def update(self, E, **F) -> None: ... + def __eq__(self, other): ... + def __ne__(self, other): ... + +class LRU(LRI): + def __getitem__(self, key): ... + +class _HashedKey(list): + hash_value: Incomplete + def __init__(self, key) -> None: ... + def __hash__(self): ... + +def make_cache_key(args, kwargs, typed: bool = ..., kwarg_mark=..., fasttypes=...): ... + +class CachedFunction: + func: Incomplete + get_cache: Incomplete + scoped: Incomplete + typed: Incomplete + key_func: Incomplete + def __init__(self, func, cache, scoped: bool = ..., typed: bool = ..., key: Incomplete | None = ...): ... + def __call__(self, *args, **kwargs): ... + +class CachedMethod: + func: Incomplete + __isabstractmethod__: Incomplete + get_cache: Incomplete + scoped: Incomplete + typed: Incomplete + key_func: Incomplete + bound_to: Incomplete + def __init__(self, func, cache, scoped: bool = ..., typed: bool = ..., key: Incomplete | None = ...): ... + def __get__(self, obj, objtype: Incomplete | None = ...): ... + def __call__(self, *args, **kwargs): ... + +def cached(cache, scoped: bool = ..., typed: bool = ..., key: Incomplete | None = ...): ... +def cachedmethod(cache, scoped: bool = ..., typed: bool = ..., key: Incomplete | None = ...): ... + +class cachedproperty: + __doc__: Incomplete + __isabstractmethod__: Incomplete + func: Incomplete + def __init__(self, func) -> None: ... + def __get__(self, obj, objtype: Incomplete | None = ...): ... + +class ThresholdCounter: + total: int + def __init__(self, threshold: float = ...) -> None: ... + @property + def threshold(self): ... + def add(self, key) -> None: ... + def elements(self): ... + def most_common(self, n: Incomplete | None = ...): ... + def get_common_count(self): ... + def get_uncommon_count(self): ... + def get_commonality(self): ... + def __getitem__(self, key): ... + def __len__(self): ... + def __contains__(self, key): ... + def iterkeys(self): ... + def keys(self): ... + def itervalues(self) -> Generator[Incomplete, None, None]: ... + def values(self): ... + def iteritems(self) -> Generator[Incomplete, None, None]: ... + def items(self): ... + def get(self, key, default: int = ...): ... + def update(self, iterable, **kwargs) -> None: ... + +class MinIDMap: + mapping: Incomplete + ref_map: Incomplete + free: Incomplete + def __init__(self) -> None: ... + def get(self, a): ... + def drop(self, a) -> None: ... + def __contains__(self, a): ... + def __iter__(self): ... + def __len__(self): ... + def iteritems(self): ... diff --git a/stubs/boltons/boltons/debugutils.pyi b/stubs/boltons/boltons/debugutils.pyi new file mode 100644 index 000000000000..85c20da0f01e --- /dev/null +++ b/stubs/boltons/boltons/debugutils.pyi @@ -0,0 +1,7 @@ +from _typeshed import Incomplete + +def pdb_on_signal(signalnum: Incomplete | None = ...) -> None: ... +def pdb_on_exception(limit: int = ...) -> None: ... +def wrap_trace( + obj, hook=..., which: Incomplete | None = ..., events: Incomplete | None = ..., label: Incomplete | None = ... +): ... diff --git a/stubs/boltons/boltons/deprutils.pyi b/stubs/boltons/boltons/deprutils.pyi new file mode 100644 index 000000000000..c68cbb478932 --- /dev/null +++ b/stubs/boltons/boltons/deprutils.pyi @@ -0,0 +1,9 @@ +from _typeshed import Incomplete + +ModuleType: Incomplete + +class DeprecatableModule(ModuleType): + def __init__(self, module) -> None: ... + def __getattribute__(self, name): ... + +def deprecate_module_member(mod_name, name, message) -> None: ... diff --git a/stubs/boltons/boltons/dictutils.pyi b/stubs/boltons/boltons/dictutils.pyi new file mode 100644 index 000000000000..ffc3a7012b1d --- /dev/null +++ b/stubs/boltons/boltons/dictutils.pyi @@ -0,0 +1,101 @@ +from _typeshed import Incomplete +from collections.abc import Generator + +class OrderedMultiDict(dict): + def __init__(self, *args, **kwargs) -> None: ... + def add(self, k, v) -> None: ... + def addlist(self, k, v) -> None: ... + def get(self, k, default: Incomplete | None = ...): ... + def getlist(self, k, default=...): ... + def clear(self) -> None: ... + def setdefault(self, k, default=...): ... + def copy(self): ... + @classmethod + def fromkeys(cls, keys, default: Incomplete | None = ...): ... + def update(self, E, **F) -> None: ... + def update_extend(self, E, **F) -> None: ... + def __setitem__(self, k, v) -> None: ... + def __getitem__(self, k): ... + def __delitem__(self, k) -> None: ... + def __eq__(self, other): ... + def __ne__(self, other): ... + def pop(self, k, default=...): ... + def popall(self, k, default=...): ... + def poplast(self, k=..., default=...): ... + def iteritems(self, multi: bool = ...) -> Generator[Incomplete, None, None]: ... + def iterkeys(self, multi: bool = ...) -> Generator[Incomplete, None, None]: ... + def itervalues(self, multi: bool = ...) -> Generator[Incomplete, None, None]: ... + def todict(self, multi: bool = ...): ... + def sorted(self, key: Incomplete | None = ..., reverse: bool = ...): ... + def sortedvalues(self, key: Incomplete | None = ..., reverse: bool = ...): ... + def inverted(self): ... + def counts(self): ... + def keys(self, multi: bool = ...): ... + def values(self, multi: bool = ...): ... + def items(self, multi: bool = ...): ... + def __iter__(self): ... + def __reversed__(self) -> Generator[Incomplete, None, None]: ... + def viewkeys(self): ... + def viewvalues(self): ... + def viewitems(self): ... + +OMD = OrderedMultiDict +MultiDict = OrderedMultiDict + +class FastIterOrderedMultiDict(OrderedMultiDict): + def iteritems(self, multi: bool = ...) -> Generator[Incomplete, None, None]: ... + def iterkeys(self, multi: bool = ...) -> Generator[Incomplete, None, None]: ... + def __reversed__(self) -> Generator[Incomplete, None, None]: ... + +class OneToOne(dict): + inv: Incomplete + def __init__(self, *a, **kw) -> None: ... + @classmethod + def unique(cls, *a, **kw): ... + def __setitem__(self, key, val) -> None: ... + def __delitem__(self, key) -> None: ... + def clear(self) -> None: ... + def copy(self): ... + def pop(self, key, default=...): ... + def popitem(self): ... + def setdefault(self, key, default: Incomplete | None = ...): ... + def update(self, dict_or_iterable, **kw) -> None: ... + +class ManyToMany: + data: Incomplete + inv: Incomplete + def __init__(self, items: Incomplete | None = ...) -> None: ... + def get(self, key, default=...): ... + def __getitem__(self, key): ... + def __setitem__(self, key, vals) -> None: ... + def __delitem__(self, key) -> None: ... + def update(self, iterable) -> None: ... + def add(self, key, val) -> None: ... + def remove(self, key, val) -> None: ... + def replace(self, key, newkey) -> None: ... + def iteritems(self) -> Generator[Incomplete, None, None]: ... + def keys(self): ... + def __contains__(self, key): ... + def __iter__(self): ... + def __len__(self): ... + def __eq__(self, other): ... + +def subdict(d, keep: Incomplete | None = ..., drop: Incomplete | None = ...): ... + +class FrozenHashError(TypeError): ... + +class FrozenDict(dict): + def updated(self, *a, **kw): ... + @classmethod + def fromkeys(cls, keys, value: Incomplete | None = ...): ... + def __reduce_ex__(self, protocol): ... + def __hash__(self): ... + def __copy__(self): ... + __ior__: Incomplete + __setitem__: Incomplete + __delitem__: Incomplete + update: Incomplete + setdefault: Incomplete + pop: Incomplete + popitem: Incomplete + clear: Incomplete diff --git a/stubs/boltons/boltons/easterutils.pyi b/stubs/boltons/boltons/easterutils.pyi new file mode 100644 index 000000000000..46cadd75dd58 --- /dev/null +++ b/stubs/boltons/boltons/easterutils.pyi @@ -0,0 +1 @@ +def gobs_program() -> None: ... diff --git a/stubs/boltons/boltons/ecoutils.pyi b/stubs/boltons/boltons/ecoutils.pyi new file mode 100644 index 000000000000..5f538db10f6a --- /dev/null +++ b/stubs/boltons/boltons/ecoutils.pyi @@ -0,0 +1,26 @@ +from _typeshed import Incomplete + +ECO_VERSION: str +PY_GT_2: Incomplete +getrandbits: Incomplete +HAVE_URANDOM: bool +INSTANCE_ID: Incomplete +IS_64BIT: Incomplete +HAVE_UCS4: Incomplete +HAVE_READLINE: bool +SQLITE_VERSION: Incomplete +OPENSSL_VERSION: Incomplete +TKINTER_VERSION: Incomplete +ZLIB_VERSION: Incomplete +EXPAT_VERSION: Incomplete +CPU_COUNT: Incomplete +HAVE_THREADING: bool +HAVE_IPV6: Incomplete +RLIMIT_FDS_SOFT: Incomplete +RLIMIT_FDS_HARD: Incomplete +START_TIME_INFO: Incomplete + +def get_python_info(): ... +def get_profile(**kwargs): ... +def get_profile_json(indent: bool = ...): ... +def main() -> None: ... diff --git a/stubs/boltons/boltons/excutils.pyi b/stubs/boltons/boltons/excutils.pyi new file mode 100644 index 000000000000..b508048924f3 --- /dev/null +++ b/stubs/boltons/boltons/excutils.pyi @@ -0,0 +1,27 @@ +from _typeshed import Incomplete +from typing import NamedTuple + +class ExceptionCauseMixin(Exception): + cause: Incomplete + def __new__(cls, *args, **kw): ... + def get_str(self): ... + +class _BaseTBItem(NamedTuple): + filename: Incomplete + lineno: Incomplete + name: Incomplete + line: Incomplete + +class _TBItem(_BaseTBItem): ... + +class _DeferredLine: + filename: Incomplete + lineno: Incomplete + module_globals: Incomplete + def __init__(self, filename, lineno, module_globals: Incomplete | None = ...) -> None: ... + def __eq__(self, other): ... + def __ne__(self, other): ... + def __len__(self): ... + def strip(self): ... + +class MathError(ExceptionCauseMixin, ValueError): ... diff --git a/stubs/boltons/boltons/fileutils.pyi b/stubs/boltons/boltons/fileutils.pyi new file mode 100644 index 000000000000..67084fa36912 --- /dev/null +++ b/stubs/boltons/boltons/fileutils.pyi @@ -0,0 +1,77 @@ +from _typeshed import Incomplete +from collections.abc import Generator + +unicode = str + +def mkdir_p(path) -> None: ... + +class FilePerms: + class _FilePermProperty: + attribute: Incomplete + offset: Incomplete + def __init__(self, attribute, offset) -> None: ... + def __get__(self, fp_obj, type_: Incomplete | None = ...): ... + def __set__(self, fp_obj, value): ... + user: Incomplete + group: Incomplete + other: Incomplete + def __init__(self, user: str = ..., group: str = ..., other: str = ...) -> None: ... + @classmethod + def from_int(cls, i): ... + @classmethod + def from_path(cls, path): ... + def __int__(self): ... + +def atomic_save(dest_path, **kwargs): ... + +class AtomicSaver: + dest_path: Incomplete + overwrite: Incomplete + file_perms: Incomplete + overwrite_part: Incomplete + part_filename: Incomplete + rm_part_on_exc: Incomplete + text_mode: Incomplete + buffering: Incomplete + dest_dir: Incomplete + part_path: Incomplete + mode: Incomplete + open_flags: Incomplete + part_file: Incomplete + def __init__(self, dest_path, **kwargs) -> None: ... + def setup(self) -> None: ... + def __enter__(self): ... + def __exit__(self, exc_type, exc_val, exc_tb) -> None: ... + +def iter_find_files( + directory, patterns, ignored: Incomplete | None = ..., include_dirs: bool = ... +) -> Generator[Incomplete, None, None]: ... + +copytree = copy_tree +file = object + +class DummyFile(file): + name: Incomplete + mode: Incomplete + closed: bool + errors: Incomplete + isatty: bool + encoding: Incomplete + newlines: Incomplete + softspace: int + def __init__(self, path, mode: str = ..., buffering: Incomplete | None = ...) -> None: ... + def close(self) -> None: ... + def fileno(self): ... + def flush(self) -> None: ... + def next(self) -> None: ... + def read(self, size: int = ...): ... + def readline(self, size: int = ...): ... + def readlines(self, size: int = ...): ... + def seek(self) -> None: ... + def tell(self): ... + def truncate(self) -> None: ... + def write(self, string) -> None: ... + def writelines(self, list_of_strings) -> None: ... + def __next__(self) -> None: ... + def __enter__(self) -> None: ... + def __exit__(self, exc_type, exc_val, exc_tb) -> None: ... diff --git a/stubs/boltons/boltons/formatutils.pyi b/stubs/boltons/boltons/formatutils.pyi new file mode 100644 index 000000000000..eda26d02411f --- /dev/null +++ b/stubs/boltons/boltons/formatutils.pyi @@ -0,0 +1,36 @@ +from _typeshed import Incomplete + +unicode = str + +def construct_format_field_str(fname, fspec, conv): ... +def infer_positional_format_args(fstr): ... +def get_format_args(fstr): ... +def tokenize_format_str(fstr, resolve_pos: bool = ...): ... + +class BaseFormatField: + def __init__(self, fname, fspec: str = ..., conv: Incomplete | None = ...) -> None: ... + base_name: Incomplete + fname: Incomplete + subpath: Incomplete + is_positional: Incomplete + def set_fname(self, fname) -> None: ... + subfields: Incomplete + fspec: Incomplete + type_char: Incomplete + type_func: Incomplete + def set_fspec(self, fspec) -> None: ... + conv: Incomplete + conv_func: Incomplete + def set_conv(self, conv) -> None: ... + @property + def fstr(self): ... + +class DeferredValue: + func: Incomplete + cache_value: Incomplete + def __init__(self, func, cache_value: bool = ...) -> None: ... + def get_value(self): ... + def __int__(self): ... + def __float__(self): ... + def __unicode__(self): ... + def __format__(self, fmt): ... diff --git a/stubs/boltons/boltons/funcutils.pyi b/stubs/boltons/boltons/funcutils.pyi new file mode 100644 index 000000000000..0be681385ae0 --- /dev/null +++ b/stubs/boltons/boltons/funcutils.pyi @@ -0,0 +1,60 @@ +import functools +from _typeshed import Incomplete +from functools import total_ordering as total_ordering +from types import MethodType + +make_method = MethodType +basestring: Incomplete +NO_DEFAULT: Incomplete + +def get_module_callables(mod, ignore: Incomplete | None = ...): ... +def mro_items(type_obj): ... +def dir_dict(obj, raise_exc: bool = ...): ... +def copy_function(orig, copy_dict: bool = ...): ... +def partial_ordering(cls): ... + +class InstancePartial(functools.partial): + def __get__(self, obj, obj_type): ... + +class CachedInstancePartial(functools.partial): + __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 = ..., **kw): ... +def format_exp_repr( + obj, pos_names, req_names: Incomplete | None = ..., opt_names: Incomplete | None = ..., opt_key: Incomplete | None = ... +): ... +def format_nonexp_repr( + obj, req_names: Incomplete | None = ..., opt_names: Incomplete | None = ..., opt_key: Incomplete | None = ... +): ... +def wraps(func, injected: Incomplete | None = ..., expected: Incomplete | None = ..., **kw): ... +def update_wrapper( + wrapper, func, injected: Incomplete | None = ..., expected: Incomplete | None = ..., build_from: Incomplete | None = ..., **kw +): ... + +class FunctionBuilder: + name: Incomplete + def __init__(self, name, **kw) -> None: ... + def get_sig_str(self, with_annotations: bool = ...): ... + def get_invocation_str(self): ... + def get_sig_str(self, with_annotations: bool = ...): ... + def get_invocation_str(self): ... + @classmethod + def from_func(cls, func): ... + def get_func(self, execdict: Incomplete | None = ..., add_source: bool = ..., with_dict: bool = ...): ... + def get_defaults_dict(self): ... + def get_arg_names(self, only_required: bool = ...): ... + defaults: Incomplete + def add_arg(self, arg_name, default=...) -> None: ... + def add_arg(self, arg_name, default=..., kwonly: bool = ...) -> None: ... + def remove_arg(self, arg_name) -> None: ... + +class MissingArgument(ValueError): ... +class ExistingArgument(ValueError): ... + +def noop(*args, **kwargs) -> None: ... diff --git a/stubs/boltons/boltons/gcutils.pyi b/stubs/boltons/boltons/gcutils.pyi new file mode 100644 index 000000000000..a14616aecf2d --- /dev/null +++ b/stubs/boltons/boltons/gcutils.pyi @@ -0,0 +1,12 @@ +from _typeshed import Incomplete + +def get_all(type_obj, include_subtypes: bool = ...): ... + +class GCToggler: + postcollect: Incomplete + def __init__(self, postcollect: bool = ...) -> None: ... + def __enter__(self) -> None: ... + def __exit__(self, exc_type, exc_val, exc_tb) -> None: ... + +toggle_gc: Incomplete +toggle_gc_postcollect: Incomplete diff --git a/stubs/boltons/boltons/ioutils.pyi b/stubs/boltons/boltons/ioutils.pyi new file mode 100644 index 000000000000..a3db8ad4cebf --- /dev/null +++ b/stubs/boltons/boltons/ioutils.pyi @@ -0,0 +1,93 @@ +import abc +from _typeshed import Incomplete +from abc import abstractmethod + +text_type = unicode +binary_type = str +text_type = str +binary_type = bytes +READ_CHUNK_SIZE: int + +class SpooledIOBase(metaclass=abc.ABCMeta): + __metaclass__: Incomplete + def __init__(self, max_size: int = ..., dir: Incomplete | None = ...) -> None: ... + @abstractmethod + def read(self, n: int = ...): ... + @abstractmethod + def write(self, s): ... + @abstractmethod + def seek(self, pos, mode: int = ...): ... + @abstractmethod + def readline(self, length: Incomplete | None = ...): ... + @abstractmethod + def readlines(self, sizehint: int = ...): ... + @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 = ...): ... + 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 = ...): ... + def write(self, s) -> None: ... + def seek(self, pos, mode: int = ...): ... + def readline(self, length: Incomplete | None = ...): ... + def readlines(self, sizehint: int = ...): ... + 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 = ...): ... + def write(self, s) -> None: ... + def seek(self, pos, mode: int = ...): ... + def readline(self, length: Incomplete | None = ...): ... + def readlines(self, sizehint: int = ...): ... + @property + def buffer(self): ... + def rollover(self) -> None: ... + def tell(self): ... + @property + def len(self): ... + +def is_text_fileobj(fileobj): ... + +class MultiFileReader: + def __init__(self, *fileobjs) -> None: ... + def read(self, amt: Incomplete | None = ...): ... + def seek(self, offset, whence=...) -> None: ... diff --git a/stubs/boltons/boltons/iterutils.pyi b/stubs/boltons/boltons/iterutils.pyi new file mode 100644 index 000000000000..f50195a843b7 --- /dev/null +++ b/stubs/boltons/boltons/iterutils.pyi @@ -0,0 +1,82 @@ +from _typeshed import Incomplete +from collections.abc import Generator + +basestring: Incomplete +unicode = str +xrange: Incomplete + +def is_iterable(obj): ... +def is_scalar(obj): ... +def is_collection(obj): ... +def split(src, sep: Incomplete | None = ..., maxsplit: Incomplete | None = ...): ... +def split_iter( + src, sep: Incomplete | None = ..., maxsplit: Incomplete | None = ... +) -> Generator[Incomplete, None, Incomplete]: ... +def lstrip(iterable, strip_value: Incomplete | None = ...): ... +def lstrip_iter(iterable, strip_value: Incomplete | None = ...) -> Generator[Incomplete, None, None]: ... +def rstrip(iterable, strip_value: Incomplete | None = ...): ... +def rstrip_iter(iterable, strip_value: Incomplete | None = ...) -> Generator[Incomplete, None, None]: ... +def strip(iterable, strip_value: Incomplete | None = ...): ... +def strip_iter(iterable, strip_value: Incomplete | None = ...): ... +def chunked(src, size, count: Incomplete | None = ..., **kw): ... +def chunked_iter(src, size, **kw) -> Generator[Incomplete, None, Incomplete]: ... +def pairwise(src): ... +def pairwise_iter(src): ... +def windowed(src, size): ... +def windowed_iter(src, size): ... +def xfrange(stop, start: Incomplete | None = ..., step: float = ...) -> Generator[Incomplete, None, None]: ... +def frange(stop, start: Incomplete | None = ..., step: float = ...): ... +def backoff(start, stop, count: Incomplete | None = ..., factor: float = ..., jitter: bool = ...): ... +def backoff_iter( + start, stop, count: Incomplete | None = ..., factor: float = ..., jitter: bool = ... +) -> Generator[Incomplete, None, None]: ... +def bucketize(src, key=..., value_transform: Incomplete | None = ..., key_filter: Incomplete | None = ...): ... +def partition(src, key=...): ... +def unique(src, key: Incomplete | None = ...): ... +def unique_iter(src, key: Incomplete | None = ...) -> Generator[Incomplete, None, Incomplete]: ... +def redundant(src, key: Incomplete | None = ..., groups: bool = ...): ... +def one(src, default: Incomplete | None = ..., key: Incomplete | None = ...): ... +def first(iterable, default: Incomplete | None = ..., key: Incomplete | 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 = ...): ... + +class GUIDerator: + size: Incomplete + count: Incomplete + def __init__(self, size: int = ...) -> None: ... + pid: Incomplete + salt: Incomplete + def reseed(self) -> None: ... + def __iter__(self): ... + def __next__(self): ... + def __next__(self): ... + next: Incomplete + +class SequentialGUIDerator(GUIDerator): + start: Incomplete + def reseed(self) -> None: ... + def reseed(self) -> None: ... + def __next__(self): ... + next: Incomplete + +guid_iter: Incomplete +seq_guid_iter: Incomplete + +def soft_sorted( + iterable, first: Incomplete | None = ..., last: Incomplete | None = ..., key: Incomplete | None = ..., reverse: bool = ... +): ... +def untyped_sorted(iterable, key: Incomplete | None = ..., reverse: bool = ...): ... diff --git a/stubs/boltons/boltons/jsonutils.pyi b/stubs/boltons/boltons/jsonutils.pyi new file mode 100644 index 000000000000..7454cfedef26 --- /dev/null +++ b/stubs/boltons/boltons/jsonutils.pyi @@ -0,0 +1,15 @@ +from _typeshed import Incomplete +from collections.abc import Generator + +def reverse_iter_lines( + file_obj, blocksize=..., preseek: bool = ..., encoding: Incomplete | None = ... +) -> Generator[Incomplete, None, None]: ... + +class JSONLIterator: + ignore_errors: Incomplete + def __init__(self, file_obj, ignore_errors: bool = ..., reverse: bool = ..., rel_seek: Incomplete | None = ...) -> None: ... + @property + def cur_byte_pos(self): ... + def __iter__(self): ... + def next(self): ... + __next__: Incomplete diff --git a/stubs/boltons/boltons/listutils.pyi b/stubs/boltons/boltons/listutils.pyi new file mode 100644 index 000000000000..a7c31098b9ef --- /dev/null +++ b/stubs/boltons/boltons/listutils.pyi @@ -0,0 +1,35 @@ +from _typeshed import Incomplete + +xrange = range + +class BarrelList(list): + lists: Incomplete + def __init__(self, iterable: Incomplete | None = ...) -> None: ... + def insert(self, index, item) -> None: ... + def append(self, item) -> None: ... + def extend(self, iterable) -> None: ... + def pop(self, *a): ... + def iter_slice(self, start, stop, step: Incomplete | None = ...): ... + def del_slice(self, start, stop, step: Incomplete | None = ...) -> None: ... + __delslice__: Incomplete + @classmethod + def from_iterable(cls, it): ... + def __iter__(self): ... + def __reversed__(self): ... + def __len__(self): ... + def __contains__(self, item): ... + def __getitem__(self, index): ... + def __delitem__(self, index) -> None: ... + def __setitem__(self, index, item) -> None: ... + def __getslice__(self, start, stop): ... + def __setslice__(self, start, stop, sequence) -> None: ... + def sort(self) -> None: ... + def reverse(self) -> None: ... + def count(self, item): ... + def index(self, item): ... + +BList = BarrelList + +class SplayList(list): + def shift(self, item_index, dest_index: int = ...) -> None: ... + def swap(self, item_index, dest_index) -> None: ... diff --git a/stubs/boltons/boltons/mathutils.pyi b/stubs/boltons/boltons/mathutils.pyi new file mode 100644 index 000000000000..1b0f91dc4622 --- /dev/null +++ b/stubs/boltons/boltons/mathutils.pyi @@ -0,0 +1,36 @@ +from _typeshed import Incomplete + +def clamp(x, lower=..., upper=...): ... +def ceil(x, options: Incomplete | None = ...): ... +def floor(x, options: Incomplete | None = ...): ... + +bytes = str +unicode = str + +class Bits: + val: Incomplete + len: Incomplete + def __init__(self, val: int = ..., len_: Incomplete | None = ...) -> None: ... + def __getitem__(self, k): ... + def __len__(self): ... + def __eq__(self, other): ... + def __or__(self, other): ... + def __and__(self, other): ... + def __lshift__(self, other): ... + def __rshift__(self, other): ... + def __hash__(self): ... + def as_list(self): ... + def as_bin(self): ... + def as_hex(self): ... + def as_int(self): ... + def as_bytes(self): ... + @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_: Incomplete | None = ...): ... + @classmethod + def from_bytes(cls, bytes_): ... diff --git a/stubs/boltons/boltons/mboxutils.pyi b/stubs/boltons/boltons/mboxutils.pyi new file mode 100644 index 000000000000..e58b907d8f20 --- /dev/null +++ b/stubs/boltons/boltons/mboxutils.pyi @@ -0,0 +1,9 @@ +import mailbox +from _typeshed import Incomplete + +DEFAULT_MAXMEM: Incomplete + +class mbox_readonlydir(mailbox.mbox): + maxmem: Incomplete + def __init__(self, path, factory: Incomplete | None = ..., create: bool = ..., maxmem=...) -> None: ... + def flush(self) -> None: ... diff --git a/stubs/boltons/boltons/namedutils.pyi b/stubs/boltons/boltons/namedutils.pyi new file mode 100644 index 000000000000..fa99af184212 --- /dev/null +++ b/stubs/boltons/boltons/namedutils.pyi @@ -0,0 +1,4 @@ +OrderedDict = dict + +def namedtuple(typename, field_names, verbose: bool = ..., rename: bool = ...): ... +def namedlist(typename, field_names, verbose: bool = ..., rename: bool = ...): ... diff --git a/stubs/boltons/boltons/pathutils.pyi b/stubs/boltons/boltons/pathutils.pyi new file mode 100644 index 000000000000..f1b96516ecae --- /dev/null +++ b/stubs/boltons/boltons/pathutils.pyi @@ -0,0 +1,13 @@ +from _typeshed import Incomplete + +def augpath( + path, + suffix: str = ..., + prefix: str = ..., + ext: Incomplete | None = ..., + base: Incomplete | None = ..., + dpath: Incomplete | None = ..., + multidot: bool = ..., +): ... +def shrinkuser(path, home: str = ...): ... +def expandpath(path): ... diff --git a/stubs/boltons/boltons/queueutils.pyi b/stubs/boltons/boltons/queueutils.pyi new file mode 100644 index 000000000000..4b53e0f03de3 --- /dev/null +++ b/stubs/boltons/boltons/queueutils.pyi @@ -0,0 +1,16 @@ +from _typeshed import Incomplete + +BList = list + +class BasePriorityQueue: + def __init__(self, **kw) -> None: ... + def add(self, task, priority: Incomplete | None = ...) -> None: ... + def remove(self, task) -> None: ... + def peek(self, default=...): ... + def pop(self, default=...): ... + def __len__(self): ... + +class HeapPriorityQueue(BasePriorityQueue): ... +class SortedPriorityQueue(BasePriorityQueue): ... + +PriorityQueue = SortedPriorityQueue diff --git a/stubs/boltons/boltons/setutils.pyi b/stubs/boltons/boltons/setutils.pyi new file mode 100644 index 000000000000..ab4078b28c15 --- /dev/null +++ b/stubs/boltons/boltons/setutils.pyi @@ -0,0 +1,96 @@ +from _typeshed import Incomplete +from collections import MutableSet +from collections.abc import Generator + +class IndexedSet(MutableSet): + item_index_map: Incomplete + item_list: Incomplete + dead_indices: Incomplete + def __init__(self, other: Incomplete | None = ...) -> None: ... + def __len__(self): ... + def __contains__(self, item): ... + def __iter__(self): ... + def __reversed__(self): ... + def __eq__(self, other): ... + @classmethod + def from_iterable(cls, it): ... + def add(self, item) -> None: ... + def remove(self, item) -> None: ... + def discard(self, item) -> None: ... + def clear(self) -> None: ... + def isdisjoint(self, other): ... + def issubset(self, other): ... + def issuperset(self, other): ... + def union(self, *others): ... + def iter_intersection(self, *others) -> Generator[Incomplete, None, None]: ... + def intersection(self, *others): ... + def iter_difference(self, *others) -> Generator[Incomplete, None, None]: ... + def difference(self, *others): ... + def symmetric_difference(self, *others): ... + __or__: Incomplete + __ror__: Incomplete + __and__: Incomplete + __rand__: Incomplete + __sub__: Incomplete + __xor__: Incomplete + __rxor__: Incomplete + def __rsub__(self, other): ... + def update(self, *others) -> None: ... + def intersection_update(self, *others) -> None: ... + def difference_update(self, *others) -> None: ... + def symmetric_difference_update(self, other) -> None: ... + def __ior__(self, *others): ... + def __iand__(self, *others): ... + def __isub__(self, *others): ... + def __ixor__(self, *others): ... + def iter_slice(self, start, stop, step: Incomplete | None = ...): ... + def __getitem__(self, index): ... + def pop(self, index: Incomplete | None = ...): ... + def count(self, val): ... + def reverse(self) -> None: ... + def sort(self, **kwargs) -> None: ... + def index(self, val): ... + +def complement(wrapped): ... + +class _ComplementSet: + def __init__(self, included: Incomplete | None = ..., excluded: Incomplete | None = ...) -> None: ... + def complemented(self): ... + __invert__: Incomplete + def complement(self) -> None: ... + def __contains__(self, item): ... + def add(self, item) -> None: ... + def remove(self, item) -> None: ... + def pop(self): ... + def intersection(self, other): ... + def __and__(self, other): ... + __rand__: Incomplete + def __iand__(self, other): ... + def union(self, other): ... + def __or__(self, other): ... + __ror__: Incomplete + def __ior__(self, other): ... + def update(self, items) -> None: ... + def discard(self, items) -> None: ... + def symmetric_difference(self, other): ... + def __xor__(self, other): ... + __rxor__: Incomplete + def symmetric_difference_update(self, other) -> None: ... + def isdisjoint(self, other): ... + def issubset(self, other): ... + def __le__(self, other): ... + def __lt__(self, other): ... + def issuperset(self, other): ... + def __ge__(self, other): ... + def __gt__(self, other): ... + def difference(self, other): ... + def __sub__(self, other): ... + def __rsub__(self, other): ... + def difference_update(self, other) -> None: ... + def __isub__(self, other): ... + def __eq__(self, other): ... + def __hash__(self): ... + def __len__(self): ... + def __iter__(self): ... + def __bool__(self): ... + __nonzero__: Incomplete diff --git a/stubs/boltons/boltons/socketutils.pyi b/stubs/boltons/boltons/socketutils.pyi new file mode 100644 index 000000000000..07c4343f789d --- /dev/null +++ b/stubs/boltons/boltons/socketutils.pyi @@ -0,0 +1,74 @@ +import socket +from _typeshed import Incomplete + +class RLock: + def __enter__(self) -> None: ... + def __exit__(self, exctype, excinst, exctb) -> None: ... + +DEFAULT_TIMEOUT: int +DEFAULT_MAXSIZE: Incomplete + +class BufferedSocket: + sock: Incomplete + rbuf: bytes + sbuf: Incomplete + maxsize: Incomplete + timeout: Incomplete + def __init__(self, sock, timeout=..., maxsize=..., recvsize=...) -> None: ... + def settimeout(self, timeout) -> None: ... + def gettimeout(self): ... + def setblocking(self, blocking) -> None: ... + def setmaxsize(self, maxsize) -> None: ... + def getrecvbuffer(self): ... + def getsendbuffer(self): ... + def recv(self, size, flags: int = ..., timeout=...): ... + def peek(self, size, timeout=...): ... + def recv_close(self, timeout=..., maxsize=...): ... + def recv_until(self, delimiter, timeout=..., maxsize=..., with_delimiter: bool = ...): ... + def recv_size(self, size, timeout=...): ... + def send(self, data, flags: int = ..., timeout=...): ... + def sendall(self, data, flags: int = ..., timeout=...): ... + def flush(self) -> None: ... + def buffer(self, data) -> None: ... + def getsockname(self): ... + def getpeername(self): ... + def getsockopt(self, level, optname, buflen: Incomplete | None = ...): ... + def setsockopt(self, level, optname, value): ... + @property + def type(self): ... + @property + def family(self): ... + @property + def proto(self): ... + def fileno(self): ... + rbuf_unconsumed: Incomplete + def close(self) -> None: ... + def shutdown(self, how) -> None: ... + +class Error(socket.error): ... +class ConnectionClosed(Error): ... + +class MessageTooLong(Error): + def __init__(self, bytes_read: Incomplete | None = ..., delimiter: Incomplete | None = ...) -> None: ... + +class Timeout(socket.timeout, Error): + def __init__(self, timeout, extra: str = ...) -> None: ... + +class NetstringSocket: + bsock: Incomplete + timeout: Incomplete + maxsize: Incomplete + def __init__(self, sock, timeout=..., maxsize=...) -> None: ... + def fileno(self): ... + def settimeout(self, timeout) -> None: ... + def setmaxsize(self, maxsize) -> None: ... + def read_ns(self, timeout=..., maxsize=...): ... + def write_ns(self, payload) -> None: ... + +class NetstringProtocolError(Error): ... + +class NetstringInvalidSize(NetstringProtocolError): + def __init__(self, msg) -> None: ... + +class NetstringMessageTooLong(NetstringProtocolError): + def __init__(self, size, maxsize) -> None: ... diff --git a/stubs/boltons/boltons/statsutils.pyi b/stubs/boltons/boltons/statsutils.pyi new file mode 100644 index 000000000000..9e20f048a4e5 --- /dev/null +++ b/stubs/boltons/boltons/statsutils.pyi @@ -0,0 +1,44 @@ +from _typeshed import Incomplete + +class _StatsProperty: + name: Incomplete + func: Incomplete + internal_name: Incomplete + __doc__: Incomplete + def __init__(self, name, func) -> None: ... + def __get__(self, obj, objtype: Incomplete | None = ...): ... + +class Stats: + data: Incomplete + default: Incomplete + def __init__(self, data, default: float = ..., use_copy: bool = ..., is_sorted: bool = ...) -> None: ... + def __len__(self): ... + def __iter__(self): ... + def clear_cache(self) -> None: ... + count: Incomplete + mean: Incomplete + max: Incomplete + min: Incomplete + median: Incomplete + iqr: Incomplete + trimean: Incomplete + variance: Incomplete + std_dev: Incomplete + median_abs_dev: Incomplete + mad: Incomplete + rel_std_dev: Incomplete + skewness: Incomplete + kurtosis: Incomplete + pearson_type: Incomplete + def get_quantile(self, q): ... + def get_zscore(self, value): ... + def trim_relative(self, amount: float = ...) -> None: ... + def get_histogram_counts(self, bins: Incomplete | None = ..., **kw): ... + def format_histogram(self, bins: Incomplete | None = ..., **kw): ... + def describe(self, quantiles: Incomplete | None = ..., format: Incomplete | None = ...): ... + +def describe(data, quantiles: Incomplete | None = ..., format: Incomplete | None = ...): ... + +func: Incomplete + +def format_histogram_counts(bin_counts, width: Incomplete | None = ..., format_bin: Incomplete | None = ...): ... diff --git a/stubs/boltons/boltons/strutils.pyi b/stubs/boltons/boltons/strutils.pyi new file mode 100644 index 000000000000..934e2e43b0d5 --- /dev/null +++ b/stubs/boltons/boltons/strutils.pyi @@ -0,0 +1,61 @@ +from _typeshed import Incomplete +from collections.abc import Generator +from html.parser import HTMLParser + +unichr = chr + +def camel2under(camel_string): ... +def under2camel(under_string): ... +def slugify(text, delim: str = ..., lower: bool = ..., ascii: bool = ...): ... +def split_punct_ws(text): ... +def unit_len(sized_iterable, unit_noun: str = ...): ... +def ordinalize(number, ext_only: bool = ...): ... +def cardinalize(unit_noun, count): ... +def singularize(word): ... +def pluralize(word): ... +def find_hashtags(string): ... +def a10n(string): ... +def strip_ansi(text): ... +def asciify(text, ignore: bool = ...): ... +def is_ascii(text): ... + +class DeaccenterDict(dict): + def __missing__(self, key): ... + def __getitem__(self, key): ... + +def bytes2human(nbytes, ndigits: int = ...): ... + +class HTMLTextExtractor(HTMLParser): + strict: bool + convert_charrefs: bool + result: Incomplete + def __init__(self) -> None: ... + def handle_data(self, d) -> None: ... + def handle_charref(self, number) -> None: ... + def handle_entityref(self, name) -> None: ... + def get_text(self): ... + +def html2text(html): ... +def gunzip_bytes(bytestring): ... +def gzip_bytes(bytestring, level: int = ...): ... +def iter_splitlines(text) -> Generator[Incomplete, None, None]: ... +def indent(text, margin, newline: str = ..., key=...): ... +def is_uuid(obj, version: int = ...): ... +def escape_shell_args(args, sep: str = ..., style: Incomplete | None = ...): ... +def args2sh(args, sep: str = ...): ... +def args2cmd(args, sep: str = ...): ... +def parse_int_list(range_string, delim: str = ..., range_delim: str = ...): ... +def format_int_list(int_list, delim: str = ..., range_delim: str = ..., delim_space: bool = ...): ... + +class MultiReplace: + group_map: Incomplete + combined_pattern: Incomplete + def __init__(self, sub_map, **kwargs) -> None: ... + def sub(self, text): ... + +def multi_replace(text, sub_map, **kwargs): ... +def unwrap_text(text, ending: str = ...): ... + +# Names in __all__ with no definition: +# int_list_complement +# int_list_to_int_tuples diff --git a/stubs/boltons/boltons/tableutils.pyi b/stubs/boltons/boltons/tableutils.pyi new file mode 100644 index 000000000000..d997451845cc --- /dev/null +++ b/stubs/boltons/boltons/tableutils.pyi @@ -0,0 +1,65 @@ +from _typeshed import Incomplete + +unicode = str + +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 = ..., headers=..., metadata: Incomplete | None = ...) -> None: ... + def extend(self, data) -> None: ... + @classmethod + def from_dict(cls, data, headers=..., max_depth: int = ..., metadata: Incomplete | None = ...): ... + @classmethod + def from_list(cls, data, headers=..., max_depth: int = ..., metadata: Incomplete | None = ...): ... + @classmethod + def from_object(cls, data, headers=..., max_depth: int = ..., metadata: Incomplete | None = ...): ... + @classmethod + def from_data(cls, data, headers=..., max_depth: int = ..., **kwargs): ... + def __len__(self): ... + def __getitem__(self, idx): ... + def to_html( + self, + orientation: Incomplete | None = ..., + wrapped: bool = ..., + with_headers: bool = ..., + with_newlines: bool = ..., + with_metadata: bool = ..., + max_depth: int = ..., + ): ... + def get_cell_html(self, value): ... + def to_text(self, with_headers: bool = ..., maxlen: Incomplete | None = ...): ... diff --git a/stubs/boltons/boltons/tbutils.pyi b/stubs/boltons/boltons/tbutils.pyi new file mode 100644 index 000000000000..20ccabb6d999 --- /dev/null +++ b/stubs/boltons/boltons/tbutils.pyi @@ -0,0 +1,91 @@ +from _typeshed import Incomplete + +text = unicode +text = str + +class Callpoint: + func_name: Incomplete + lineno: Incomplete + module_name: Incomplete + module_path: Incomplete + lasti: Incomplete + line: Incomplete + def __init__(self, module_name, module_path, func_name, lineno, lasti, line: Incomplete | None = ...) -> None: ... + def to_dict(self): ... + @classmethod + def from_current(cls, level: int = ...): ... + @classmethod + def from_frame(cls, frame): ... + @classmethod + def from_tb(cls, tb): ... + def tb_frame_str(self): ... + +class _DeferredLine: + filename: Incomplete + lineno: Incomplete + def __init__(self, filename, lineno, module_globals: Incomplete | None = ...) -> None: ... + def __eq__(self, other): ... + def __ne__(self, other): ... + def __len__(self): ... + +class TracebackInfo: + callpoint_type: Incomplete + frames: Incomplete + def __init__(self, frames) -> None: ... + @classmethod + def from_frame(cls, frame: Incomplete | None = ..., level: int = ..., limit: Incomplete | None = ...): ... + @classmethod + def from_traceback(cls, tb: Incomplete | None = ..., limit: Incomplete | None = ...): ... + @classmethod + def from_dict(cls, d): ... + def to_dict(self): ... + def __len__(self): ... + def __iter__(self): ... + def get_formatted(self): ... + +class ExceptionInfo: + tb_info_type: Incomplete + exc_type: Incomplete + exc_msg: Incomplete + tb_info: Incomplete + def __init__(self, exc_type, exc_msg, tb_info) -> None: ... + @classmethod + def from_exc_info(cls, exc_type, exc_value, traceback): ... + @classmethod + def from_current(cls): ... + def to_dict(self): ... + def get_formatted(self): ... + def get_formatted_exception_only(self): ... + +class ContextualCallpoint(Callpoint): + local_reprs: Incomplete + pre_lines: Incomplete + post_lines: Incomplete + def __init__(self, *a, **kw) -> None: ... + @classmethod + def from_frame(cls, frame): ... + @classmethod + def from_tb(cls, tb): ... + def to_dict(self): ... + +class ContextualTracebackInfo(TracebackInfo): + callpoint_type: Incomplete + +class ContextualExceptionInfo(ExceptionInfo): + tb_info_type: Incomplete + +def print_exception(etype, value, tb, limit: Incomplete | None = ..., file: Incomplete | None = ...) -> None: ... + +class ParsedException: + exc_type: Incomplete + exc_msg: Incomplete + frames: Incomplete + def __init__(self, exc_type_name, exc_msg, frames: Incomplete | None = ...) -> None: ... + @property + def source_file(self): ... + def to_dict(self): ... + def to_string(self): ... + @classmethod + def from_string(cls, tb_str): ... + +ParsedTB = ParsedException diff --git a/stubs/boltons/boltons/timeutils.pyi b/stubs/boltons/boltons/timeutils.pyi new file mode 100644 index 000000000000..67ce9cb10fb6 --- /dev/null +++ b/stubs/boltons/boltons/timeutils.pyi @@ -0,0 +1,61 @@ +from _typeshed import Incomplete +from collections.abc import Generator +from datetime import tzinfo + +def total_seconds(td): ... +def dt_to_timestamp(dt): ... +def isoparse(iso_str): ... +def parse_timedelta(text): ... + +parse_td = parse_timedelta + +def decimal_relative_time(d, other: Incomplete | None = ..., ndigits: int = ..., cardinalize: bool = ...): ... +def relative_time(d, other: Incomplete | None = ..., ndigits: int = ...): ... +def strpdate(string, format): ... +def daterange(start, stop, step: int = ..., inclusive: bool = ...) -> Generator[Incomplete, None, Incomplete]: ... + +ZERO: Incomplete +HOUR: Incomplete + +class ConstantTZInfo(tzinfo): + name: Incomplete + offset: Incomplete + def __init__(self, name: str = ..., offset=...) -> None: ... + @property + def utcoffset_hours(self): ... + def utcoffset(self, dt): ... + def tzname(self, dt): ... + def dst(self, dt): ... + +UTC: Incomplete +EPOCH_AWARE: Incomplete +EPOCH_NAIVE: Incomplete + +class LocalTZInfo(tzinfo): + def is_dst(self, dt): ... + def utcoffset(self, dt): ... + def dst(self, dt): ... + def tzname(self, dt): ... + +LocalTZ: Incomplete +DSTSTART_2007: Incomplete +DSTEND_2007: Incomplete +DSTSTART_1987_2006: Incomplete +DSTEND_1987_2006: Incomplete +DSTSTART_1967_1986: Incomplete +DSTEND_1967_1986 = DSTEND_1987_2006 + +class USTimeZone(tzinfo): + stdoffset: Incomplete + reprname: Incomplete + stdname: Incomplete + dstname: Incomplete + def __init__(self, hours, reprname, stdname, dstname) -> None: ... + def tzname(self, dt): ... + def utcoffset(self, dt): ... + def dst(self, dt): ... + +Eastern: Incomplete +Central: Incomplete +Mountain: Incomplete +Pacific: Incomplete diff --git a/stubs/boltons/boltons/typeutils.pyi b/stubs/boltons/boltons/typeutils.pyi new file mode 100644 index 000000000000..5463a2632df6 --- /dev/null +++ b/stubs/boltons/boltons/typeutils.pyi @@ -0,0 +1,10 @@ +from _typeshed import Incomplete + +def make_sentinel(name: str = ..., var_name: Incomplete | None = ...): ... +def issubclass(subclass, baseclass): ... +def get_all_subclasses(cls): ... + +class classproperty: + fn: Incomplete + def __init__(self, fn) -> None: ... + def __get__(self, instance, cls): ... diff --git a/stubs/boltons/boltons/urlutils.pyi b/stubs/boltons/boltons/urlutils.pyi new file mode 100644 index 000000000000..34f61c8d24ab --- /dev/null +++ b/stubs/boltons/boltons/urlutils.pyi @@ -0,0 +1,135 @@ +import ctypes +from _typeshed import Incomplete +from collections.abc import Generator + +from boltons.dictutils import OrderedMultiDict + +unicode: Incomplete +unichr = chr +SCHEME_PORT_MAP: Incomplete +NO_NETLOC_SCHEMES: Incomplete + +class URLParseError(ValueError): ... + +DEFAULT_ENCODING: str + +def to_unicode(obj): ... +def find_all_links(text, with_text: bool = ..., default_scheme: str = ..., schemes=...): ... +def quote_path_part(text, full_quote: bool = ...): ... +def quote_query_part(text, full_quote: bool = ...): ... +def quote_fragment_part(text, full_quote: bool = ...): ... +def quote_userinfo_part(text, full_quote: bool = ...): ... +def unquote(string, encoding: str = ..., errors: str = ...): ... +def unquote_to_bytes(string): ... +def register_scheme(text, uses_netloc: Incomplete | None = ..., default_port: Incomplete | 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 = ...): ... + +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 = ..., + host: Incomplete | None = ..., + path_parts=..., + query_params=..., + fragment: str = ..., + port: Incomplete | None = ..., + username: Incomplete | None = ..., + password: Incomplete | None = ..., + ): ... + def query_params(self): ... + 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 = ...) -> None: ... + def navigate(self, dest): ... + def get_authority(self, full_quote: bool = ..., with_userinfo: bool = ...): ... + def to_text(self, full_quote: bool = ...): ... + def __unicode__(self): ... + def __eq__(self, other): ... + def __ne__(self, other): ... + +class _sockaddr(ctypes.Structure): ... + +WSAStringToAddressA: Incomplete +WSAAddressToStringA: Incomplete + +def parse_host(host): ... +def parse_url(url_text): ... + +DEFAULT_PARSED_URL: Incomplete + +def parse_qsl(qs, keep_blank_values: bool = ..., encoding=...): ... + +PREV: Incomplete +NEXT: Incomplete +KEY: Incomplete +VALUE: Incomplete +SPREV: Incomplete +SNEXT: Incomplete + +class OrderedMultiDict(dict): + def __init__(self, *args, **kwargs) -> None: ... + def add(self, k, v) -> None: ... + def addlist(self, k, v) -> None: ... + def get(self, k, default: Incomplete | None = ...): ... + def getlist(self, k, default=...): ... + def clear(self) -> None: ... + def setdefault(self, k, default=...): ... + def copy(self): ... + @classmethod + def fromkeys(cls, keys, default: Incomplete | None = ...): ... + def update(self, E, **F) -> None: ... + def update_extend(self, E, **F) -> None: ... + def __setitem__(self, k, v) -> None: ... + def __getitem__(self, k): ... + def __delitem__(self, k) -> None: ... + def __eq__(self, other): ... + def __ne__(self, other): ... + def pop(self, k, default=...): ... + def popall(self, k, default=...): ... + def poplast(self, k=..., default=...): ... + def iteritems(self, multi: bool = ...) -> Generator[Incomplete, None, None]: ... + def iterkeys(self, multi: bool = ...) -> Generator[Incomplete, None, None]: ... + def itervalues(self, multi: bool = ...) -> Generator[Incomplete, None, None]: ... + def todict(self, multi: bool = ...): ... + def sorted(self, key: Incomplete | None = ..., reverse: bool = ...): ... + def sortedvalues(self, key: Incomplete | None = ..., reverse: bool = ...): ... + def inverted(self): ... + def counts(self): ... + def keys(self, multi: bool = ...): ... + def values(self, multi: bool = ...): ... + def items(self, multi: bool = ...): ... + def __iter__(self): ... + def __reversed__(self) -> Generator[Incomplete, None, None]: ... + def viewkeys(self): ... + def viewvalues(self): ... + def viewitems(self): ... + +OMD = OrderedMultiDict + +class QueryParamDict(OrderedMultiDict): + @classmethod + def from_text(cls, query_string): ... + def to_text(self, full_quote: bool = ...): ... From ede7ad08ecf2c4b39aeacb69822c5d63658774df Mon Sep 17 00:00:00 2001 From: Alexander Burchenko Date: Thu, 13 Oct 2022 18:20:54 +0200 Subject: [PATCH 03/51] update dictutils/FrozenDict --- stubs/boltons/boltons/dictutils.pyi | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/stubs/boltons/boltons/dictutils.pyi b/stubs/boltons/boltons/dictutils.pyi index ffc3a7012b1d..e4896fd09bfb 100644 --- a/stubs/boltons/boltons/dictutils.pyi +++ b/stubs/boltons/boltons/dictutils.pyi @@ -1,5 +1,6 @@ from _typeshed import Incomplete from collections.abc import Generator +from typing import Any, Iterable, NoReturn class OrderedMultiDict(dict): def __init__(self, *args, **kwargs) -> None: ... @@ -85,17 +86,10 @@ def subdict(d, keep: Incomplete | None = ..., drop: Incomplete | None = ...): .. class FrozenHashError(TypeError): ... class FrozenDict(dict): - def updated(self, *a, **kw): ... + def clear(self, *a, **kw) -> NoReturn: ... @classmethod - def fromkeys(cls, keys, value: Incomplete | None = ...): ... - def __reduce_ex__(self, protocol): ... - def __hash__(self): ... - def __copy__(self): ... - __ior__: Incomplete - __setitem__: Incomplete - __delitem__: Incomplete - update: Incomplete - setdefault: Incomplete - pop: Incomplete - popitem: Incomplete - clear: Incomplete + def fromkeys(cls, keys: Iterable[Any], value: Any | None = ...) -> FrozenDict: ... + def pop(self, *a, **kw) -> NoReturn: ... + def popitem(self, *a, **kw) -> NoReturn: ... + def setdefault(self, *a, **kw) -> NoReturn: ... + def updated(self, *a, **kw) -> FrozenDict: ... From 0d7f4ff92cefb346b1d0486aa4abb0c06efd5a9a Mon Sep 17 00:00:00 2001 From: Alexander Burchenko Date: Thu, 13 Oct 2022 18:21:33 +0200 Subject: [PATCH 04/51] update dictutils/FrozenHashError --- stubs/boltons/boltons/dictutils.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/boltons/boltons/dictutils.pyi b/stubs/boltons/boltons/dictutils.pyi index e4896fd09bfb..8bc17e371c08 100644 --- a/stubs/boltons/boltons/dictutils.pyi +++ b/stubs/boltons/boltons/dictutils.pyi @@ -83,7 +83,7 @@ class ManyToMany: def subdict(d, keep: Incomplete | None = ..., drop: Incomplete | None = ...): ... -class FrozenHashError(TypeError): ... +class FrozenHashError(TypeError): ... # undocumented class FrozenDict(dict): def clear(self, *a, **kw) -> NoReturn: ... From d40ab5df0a82055cedd4eb10db2f9a775767deba Mon Sep 17 00:00:00 2001 From: Alexander Burchenko Date: Thu, 13 Oct 2022 19:07:31 +0200 Subject: [PATCH 05/51] update dictutils/subdict --- stubs/boltons/boltons/dictutils.pyi | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/stubs/boltons/boltons/dictutils.pyi b/stubs/boltons/boltons/dictutils.pyi index 8bc17e371c08..ddb49e7d09a8 100644 --- a/stubs/boltons/boltons/dictutils.pyi +++ b/stubs/boltons/boltons/dictutils.pyi @@ -1,6 +1,6 @@ from _typeshed import Incomplete -from collections.abc import Generator -from typing import Any, Iterable, NoReturn +from collections.abc import Generator, Iterable, Hashable +from typing import Any, NoReturn class OrderedMultiDict(dict): def __init__(self, *args, **kwargs) -> None: ... @@ -81,14 +81,15 @@ class ManyToMany: def __len__(self): ... def __eq__(self, other): ... -def subdict(d, keep: Incomplete | None = ..., drop: Incomplete | None = ...): ... + +def subdict(d: dict[Hashable, object], keep: Iterable[object] | None = ..., drop: Iterable[object] | None = ...) -> dict[Hashable, object]: ... class FrozenHashError(TypeError): ... # undocumented class FrozenDict(dict): def clear(self, *a, **kw) -> NoReturn: ... @classmethod - def fromkeys(cls, keys: Iterable[Any], value: Any | None = ...) -> FrozenDict: ... + def fromkeys(cls, keys: Iterable[object], value: object | None = ...) -> FrozenDict: ... def pop(self, *a, **kw) -> NoReturn: ... def popitem(self, *a, **kw) -> NoReturn: ... def setdefault(self, *a, **kw) -> NoReturn: ... From 04ab8fdf723d1e05025d9c17ac6cb535a27f73b1 Mon Sep 17 00:00:00 2001 From: Alexander Burchenko Date: Thu, 13 Oct 2022 20:00:58 +0200 Subject: [PATCH 06/51] update dictutils/ManyToMany --- stubs/boltons/boltons/dictutils.pyi | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/stubs/boltons/boltons/dictutils.pyi b/stubs/boltons/boltons/dictutils.pyi index ddb49e7d09a8..4695895eb81f 100644 --- a/stubs/boltons/boltons/dictutils.pyi +++ b/stubs/boltons/boltons/dictutils.pyi @@ -63,24 +63,16 @@ class OneToOne(dict): def update(self, dict_or_iterable, **kw) -> None: ... class ManyToMany: - data: Incomplete - inv: Incomplete - def __init__(self, items: Incomplete | None = ...) -> None: ... - def get(self, key, default=...): ... - def __getitem__(self, key): ... - def __setitem__(self, key, vals) -> None: ... - def __delitem__(self, key) -> None: ... - def update(self, iterable) -> None: ... - def add(self, key, val) -> None: ... - def remove(self, key, val) -> None: ... - def replace(self, key, newkey) -> None: ... - def iteritems(self) -> Generator[Incomplete, None, None]: ... - def keys(self): ... - def __contains__(self, key): ... - def __iter__(self): ... - def __len__(self): ... - def __eq__(self, other): ... - + def __getattr__(self, name: str) -> Any: ... # incomplete + data: dict[Hashable, object] + inv: tuple[object] + def add(self, key: Hashable, val: object) -> NoReturn: ... + def get(self, key: Hashable, default: frozenset = ...) -> Any: ... + def iteritems(self) -> Generator[tuple[Hashable, object], None, None]: ... + def keys(self): ... # incomplete + def remove(self, key: Hashable, val: object) -> NoReturn: ... + def replace(self, key: Hashable, newkey: Hashable) -> NoReturn: ... + def update(self, iterable: Iterable) -> NoReturn: ... def subdict(d: dict[Hashable, object], keep: Iterable[object] | None = ..., drop: Iterable[object] | None = ...) -> dict[Hashable, object]: ... From 24c15901f23291f54cdec26d3f5726a5976f9692 Mon Sep 17 00:00:00 2001 From: Alexander Burchenko Date: Thu, 13 Oct 2022 20:47:43 +0200 Subject: [PATCH 07/51] update dictutils/OneToOne --- stubs/boltons/boltons/dictutils.pyi | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/stubs/boltons/boltons/dictutils.pyi b/stubs/boltons/boltons/dictutils.pyi index 4695895eb81f..0e0c2f724ee6 100644 --- a/stubs/boltons/boltons/dictutils.pyi +++ b/stubs/boltons/boltons/dictutils.pyi @@ -50,29 +50,26 @@ class FastIterOrderedMultiDict(OrderedMultiDict): class OneToOne(dict): inv: Incomplete - def __init__(self, *a, **kw) -> None: ... - @classmethod - def unique(cls, *a, **kw): ... - def __setitem__(self, key, val) -> None: ... - def __delitem__(self, key) -> None: ... def clear(self) -> None: ... - def copy(self): ... - def pop(self, key, default=...): ... - def popitem(self): ... - def setdefault(self, key, default: Incomplete | None = ...): ... - def update(self, dict_or_iterable, **kw) -> None: ... + def copy(self) -> OneToOne: ... + def pop(self, key: Hashable, default: object = ...) -> object: ... + def popitem(self) -> tuple[Hashable, object]: ... + def setdefault(self, key: Hashable, default: object | None = ...) -> object: ... + @classmethod + def unique(cls, *a, **kw) -> NoReturn: ... + def update(self, dict_or_iterable: dict[Hashable, object] | Iterable[object] , **kw: Any) -> NoReturn: ... class ManyToMany: def __getattr__(self, name: str) -> Any: ... # incomplete data: dict[Hashable, object] inv: tuple[object] def add(self, key: Hashable, val: object) -> NoReturn: ... - def get(self, key: Hashable, default: frozenset = ...) -> Any: ... + def get(self, key: Hashable, default: frozenset[object] = ...) -> Any: ... def iteritems(self) -> Generator[tuple[Hashable, object], None, None]: ... def keys(self): ... # incomplete def remove(self, key: Hashable, val: object) -> NoReturn: ... def replace(self, key: Hashable, newkey: Hashable) -> NoReturn: ... - def update(self, iterable: Iterable) -> NoReturn: ... + def update(self, iterable: Iterable[object] ) -> NoReturn: ... def subdict(d: dict[Hashable, object], keep: Iterable[object] | None = ..., drop: Iterable[object] | None = ...) -> dict[Hashable, object]: ... From 0c90a6e72ac54cf01f6e5c16a8c2d64e18aa82cf Mon Sep 17 00:00:00 2001 From: Alexander Burchenko Date: Thu, 13 Oct 2022 20:48:27 +0200 Subject: [PATCH 08/51] update dictutils/FastIterOrderedMultiDict --- stubs/boltons/boltons/dictutils.pyi | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/stubs/boltons/boltons/dictutils.pyi b/stubs/boltons/boltons/dictutils.pyi index 0e0c2f724ee6..bd5a3a3bf73c 100644 --- a/stubs/boltons/boltons/dictutils.pyi +++ b/stubs/boltons/boltons/dictutils.pyi @@ -43,10 +43,9 @@ class OrderedMultiDict(dict): OMD = OrderedMultiDict MultiDict = OrderedMultiDict -class FastIterOrderedMultiDict(OrderedMultiDict): - def iteritems(self, multi: bool = ...) -> Generator[Incomplete, None, None]: ... - def iterkeys(self, multi: bool = ...) -> Generator[Incomplete, None, None]: ... - def __reversed__(self) -> Generator[Incomplete, None, None]: ... +class FastIterOrderedMultiDict(OrderedMultiDict): # undocumented + def iteritems(self, multi: bool = ...) -> Generator[tuple[Hashable, object], None, None] -> NoReturn: ... + def iterkeys(self, multi: bool = ...) -> Generator[Hashable, None, None]: ... class OneToOne(dict): inv: Incomplete From 76b5e8b46a3c4dc3bdb7b03e1f74e51563fcba7c Mon Sep 17 00:00:00 2001 From: Alexander Burchenko Date: Thu, 13 Oct 2022 22:28:27 +0200 Subject: [PATCH 09/51] update dictutils/OrderedMultiDict --- stubs/boltons/boltons/dictutils.pyi | 74 +++++++++++++---------------- 1 file changed, 33 insertions(+), 41 deletions(-) diff --git a/stubs/boltons/boltons/dictutils.pyi b/stubs/boltons/boltons/dictutils.pyi index bd5a3a3bf73c..332a43086d15 100644 --- a/stubs/boltons/boltons/dictutils.pyi +++ b/stubs/boltons/boltons/dictutils.pyi @@ -1,54 +1,46 @@ -from _typeshed import Incomplete -from collections.abc import Generator, Iterable, Hashable -from typing import Any, NoReturn +def __getattr__(self, name: str) -> Any: ... # incomplete + +from collections.abc import Generator, Iterable, Hashable, ItemsView, KeysView, ValuesView +from typing import Any, Final, NoReturn class OrderedMultiDict(dict): - def __init__(self, *args, **kwargs) -> None: ... - def add(self, k, v) -> None: ... - def addlist(self, k, v) -> None: ... - def get(self, k, default: Incomplete | None = ...): ... - def getlist(self, k, default=...): ... - def clear(self) -> None: ... - def setdefault(self, k, default=...): ... - def copy(self): ... + def add(self, k: Hashable, v: object) -> NoReturn: ... + def addlist(self, k: Hashable, v: Iterable[object]) -> NoReturn: ... + def clear(self) -> NoReturn: ... + def copy(self) -> OrderedMultiDict: ... + def counts(self) -> OrderedMultiDict: ... @classmethod - def fromkeys(cls, keys, default: Incomplete | None = ...): ... - def update(self, E, **F) -> None: ... - def update_extend(self, E, **F) -> None: ... - def __setitem__(self, k, v) -> None: ... - def __getitem__(self, k): ... - def __delitem__(self, k) -> None: ... - def __eq__(self, other): ... - def __ne__(self, other): ... - def pop(self, k, default=...): ... - def popall(self, k, default=...): ... - def poplast(self, k=..., default=...): ... - def iteritems(self, multi: bool = ...) -> Generator[Incomplete, None, None]: ... - def iterkeys(self, multi: bool = ...) -> Generator[Incomplete, None, None]: ... - def itervalues(self, multi: bool = ...) -> Generator[Incomplete, None, None]: ... - def todict(self, multi: bool = ...): ... - def sorted(self, key: Incomplete | None = ..., reverse: bool = ...): ... - def sortedvalues(self, key: Incomplete | None = ..., reverse: bool = ...): ... - def inverted(self): ... - def counts(self): ... - def keys(self, multi: bool = ...): ... - def values(self, multi: bool = ...): ... - def items(self, multi: bool = ...): ... - def __iter__(self): ... - def __reversed__(self) -> Generator[Incomplete, None, None]: ... - def viewkeys(self): ... - def viewvalues(self): ... - def viewitems(self): ... + def fromkeys(cls, keys: Hashable, default: object | None = ...) -> OrderedMultiDict: ... + def get(self, k: Hashable, default: object | None = ...) -> OrderedMultiDict: ... + def getlist(self, k: Hashable, default: object | None = ...) -> list[object]: ... + def inverted(self) -> OrderedMultiDict: ... + def items(self, multi: bool = ...) -> list[tuple[Hashable, object]]: ... + def iteritems(self, multi: bool = ...) -> Generator[tuple[Hashable, object], None, None]: ... + def iterkeys(self, multi: bool = ...) -> Generator[Hashable, None, None]: ... + def itervalues(self, multi: bool = ...) -> Generator[object, None, None]: ... + def keys(self, multi: bool = ...) -> list[Hashable]: ... + def pop(self, k: Hashable, default: object | None = ...) -> object: ... + def popall(self, k: Hashable, default: object | None = ...) -> list[object]: ... + def poplast(self, k: Hashable | None = ..., default: object | None = ...) -> object: ... + def setdefault(self, k: Hashable, default: object | None = ...) -> object: ... + def sorted(self, key: Hashable | None = ..., reverse: bool = ...) -> OrderedMultiDict: ... + def sortedvalues(self, key: Hashable | None = ..., reverse: bool = ...) -> OrderedMultiDict: ... + def todict(self, multi: bool = ...) -> dict[Hashable, object]: ... + def update(self, E: dict[Hashable, object] | Iterable[object], **F: object) -> NoReturn: ... + def update_extend(self, E: dict[Hashable, object] | Iterable[object], **F: object) -> NoReturn: ... + def values(self, multi: bool = ...) -> list[object]: ... + def viewitems(self) -> ItemsView[Hashable, object]: ... + def viewkeys(self) -> KeysView[Hashable]: ... + def viewvalues(self) -> ValuesView[object]: ... -OMD = OrderedMultiDict -MultiDict = OrderedMultiDict +OMD: Final[OrderedMultiDict] +MultiDict: Final[OrderedMultiDict] class FastIterOrderedMultiDict(OrderedMultiDict): # undocumented def iteritems(self, multi: bool = ...) -> Generator[tuple[Hashable, object], None, None] -> NoReturn: ... def iterkeys(self, multi: bool = ...) -> Generator[Hashable, None, None]: ... class OneToOne(dict): - inv: Incomplete def clear(self) -> None: ... def copy(self) -> OneToOne: ... def pop(self, key: Hashable, default: object = ...) -> object: ... From af3dbb924c98426384ecddbe0e74fcf0201f22d0 Mon Sep 17 00:00:00 2001 From: Alexander Burchenko Date: Thu, 13 Oct 2022 22:37:34 +0200 Subject: [PATCH 10/51] format code --- stubs/boltons/boltons/dictutils.pyi | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/stubs/boltons/boltons/dictutils.pyi b/stubs/boltons/boltons/dictutils.pyi index 332a43086d15..4e5e35521e25 100644 --- a/stubs/boltons/boltons/dictutils.pyi +++ b/stubs/boltons/boltons/dictutils.pyi @@ -1,8 +1,8 @@ -def __getattr__(self, name: str) -> Any: ... # incomplete - -from collections.abc import Generator, Iterable, Hashable, ItemsView, KeysView, ValuesView +from collections.abc import Generator, Hashable, ItemsView, Iterable, KeysView, ValuesView from typing import Any, Final, NoReturn +def __getattr__(name: str) -> Any: ... # incomplete + class OrderedMultiDict(dict): def add(self, k: Hashable, v: object) -> NoReturn: ... def addlist(self, k: Hashable, v: Iterable[object]) -> NoReturn: ... @@ -36,8 +36,8 @@ class OrderedMultiDict(dict): OMD: Final[OrderedMultiDict] MultiDict: Final[OrderedMultiDict] -class FastIterOrderedMultiDict(OrderedMultiDict): # undocumented - def iteritems(self, multi: bool = ...) -> Generator[tuple[Hashable, object], None, None] -> NoReturn: ... +class FastIterOrderedMultiDict(OrderedMultiDict): # undocumented + def iteritems(self, multi: bool = ...) -> Generator[tuple[Hashable, object], None, None]: ... def iterkeys(self, multi: bool = ...) -> Generator[Hashable, None, None]: ... class OneToOne(dict): @@ -48,7 +48,7 @@ class OneToOne(dict): def setdefault(self, key: Hashable, default: object | None = ...) -> object: ... @classmethod def unique(cls, *a, **kw) -> NoReturn: ... - def update(self, dict_or_iterable: dict[Hashable, object] | Iterable[object] , **kw: Any) -> NoReturn: ... + def update(self, dict_or_iterable: dict[Hashable, object] | Iterable[object], **kw: Any) -> NoReturn: ... class ManyToMany: def __getattr__(self, name: str) -> Any: ... # incomplete @@ -60,9 +60,11 @@ class ManyToMany: def keys(self): ... # incomplete def remove(self, key: Hashable, val: object) -> NoReturn: ... def replace(self, key: Hashable, newkey: Hashable) -> NoReturn: ... - def update(self, iterable: Iterable[object] ) -> NoReturn: ... + def update(self, iterable: Iterable[object]) -> NoReturn: ... -def subdict(d: dict[Hashable, object], keep: Iterable[object] | None = ..., drop: Iterable[object] | None = ...) -> dict[Hashable, object]: ... +def subdict( + d: dict[Hashable, object], keep: Iterable[object] | None = ..., drop: Iterable[object] | None = ... +) -> dict[Hashable, object]: ... class FrozenHashError(TypeError): ... # undocumented From f120ae7b194629ea82577d30f10e42db1c6b439a Mon Sep 17 00:00:00 2001 From: Alexander Burchenko Date: Sun, 16 Oct 2022 00:21:35 +0200 Subject: [PATCH 11/51] fix linter warnings --- stubs/boltons/boltons/deprutils.pyi | 4 +-- stubs/boltons/boltons/fileutils.pyi | 1 + stubs/boltons/boltons/funcutils.pyi | 3 --- stubs/boltons/boltons/ioutils.pyi | 2 -- stubs/boltons/boltons/iterutils.pyi | 2 -- stubs/boltons/boltons/tbutils.pyi | 1 - stubs/boltons/boltons/timeutils.pyi | 6 ----- stubs/boltons/boltons/urlutils.pyi | 41 ----------------------------- 8 files changed, 2 insertions(+), 58 deletions(-) diff --git a/stubs/boltons/boltons/deprutils.pyi b/stubs/boltons/boltons/deprutils.pyi index c68cbb478932..bdbfb1346860 100644 --- a/stubs/boltons/boltons/deprutils.pyi +++ b/stubs/boltons/boltons/deprutils.pyi @@ -1,6 +1,4 @@ -from _typeshed import Incomplete - -ModuleType: Incomplete +from types import ModuleType class DeprecatableModule(ModuleType): def __init__(self, module) -> None: ... diff --git a/stubs/boltons/boltons/fileutils.pyi b/stubs/boltons/boltons/fileutils.pyi index 67084fa36912..63f5c1133ed2 100644 --- a/stubs/boltons/boltons/fileutils.pyi +++ b/stubs/boltons/boltons/fileutils.pyi @@ -46,6 +46,7 @@ class AtomicSaver: def iter_find_files( directory, patterns, ignored: Incomplete | None = ..., include_dirs: bool = ... ) -> Generator[Incomplete, None, None]: ... +def copy_tree(src, dst, symlinks: bool = ..., ignore: Incomplete | None = ...): ... copytree = copy_tree file = object diff --git a/stubs/boltons/boltons/funcutils.pyi b/stubs/boltons/boltons/funcutils.pyi index 0be681385ae0..ac4db87ecf68 100644 --- a/stubs/boltons/boltons/funcutils.pyi +++ b/stubs/boltons/boltons/funcutils.pyi @@ -42,15 +42,12 @@ class FunctionBuilder: def __init__(self, name, **kw) -> None: ... def get_sig_str(self, with_annotations: bool = ...): ... def get_invocation_str(self): ... - def get_sig_str(self, with_annotations: bool = ...): ... - def get_invocation_str(self): ... @classmethod def from_func(cls, func): ... def get_func(self, execdict: Incomplete | None = ..., add_source: bool = ..., with_dict: bool = ...): ... def get_defaults_dict(self): ... def get_arg_names(self, only_required: bool = ...): ... defaults: Incomplete - def add_arg(self, arg_name, default=...) -> None: ... def add_arg(self, arg_name, default=..., kwonly: bool = ...) -> None: ... def remove_arg(self, arg_name) -> None: ... diff --git a/stubs/boltons/boltons/ioutils.pyi b/stubs/boltons/boltons/ioutils.pyi index a3db8ad4cebf..e69bdbf576e9 100644 --- a/stubs/boltons/boltons/ioutils.pyi +++ b/stubs/boltons/boltons/ioutils.pyi @@ -2,8 +2,6 @@ import abc from _typeshed import Incomplete from abc import abstractmethod -text_type = unicode -binary_type = str text_type = str binary_type = bytes READ_CHUNK_SIZE: int diff --git a/stubs/boltons/boltons/iterutils.pyi b/stubs/boltons/boltons/iterutils.pyi index f50195a843b7..eb1dedad32a4 100644 --- a/stubs/boltons/boltons/iterutils.pyi +++ b/stubs/boltons/boltons/iterutils.pyi @@ -63,13 +63,11 @@ class GUIDerator: def reseed(self) -> None: ... def __iter__(self): ... def __next__(self): ... - def __next__(self): ... next: Incomplete class SequentialGUIDerator(GUIDerator): start: Incomplete def reseed(self) -> None: ... - def reseed(self) -> None: ... def __next__(self): ... next: Incomplete diff --git a/stubs/boltons/boltons/tbutils.pyi b/stubs/boltons/boltons/tbutils.pyi index 20ccabb6d999..a1bf344615a7 100644 --- a/stubs/boltons/boltons/tbutils.pyi +++ b/stubs/boltons/boltons/tbutils.pyi @@ -1,6 +1,5 @@ from _typeshed import Incomplete -text = unicode text = str class Callpoint: diff --git a/stubs/boltons/boltons/timeutils.pyi b/stubs/boltons/boltons/timeutils.pyi index 67ce9cb10fb6..036b102a9cb3 100644 --- a/stubs/boltons/boltons/timeutils.pyi +++ b/stubs/boltons/boltons/timeutils.pyi @@ -38,12 +38,6 @@ class LocalTZInfo(tzinfo): def tzname(self, dt): ... LocalTZ: Incomplete -DSTSTART_2007: Incomplete -DSTEND_2007: Incomplete -DSTSTART_1987_2006: Incomplete -DSTEND_1987_2006: Incomplete -DSTSTART_1967_1986: Incomplete -DSTEND_1967_1986 = DSTEND_1987_2006 class USTimeZone(tzinfo): stdoffset: Incomplete diff --git a/stubs/boltons/boltons/urlutils.pyi b/stubs/boltons/boltons/urlutils.pyi index 34f61c8d24ab..19236e48e388 100644 --- a/stubs/boltons/boltons/urlutils.pyi +++ b/stubs/boltons/boltons/urlutils.pyi @@ -1,6 +1,5 @@ import ctypes from _typeshed import Incomplete -from collections.abc import Generator from boltons.dictutils import OrderedMultiDict @@ -89,46 +88,6 @@ VALUE: Incomplete SPREV: Incomplete SNEXT: Incomplete -class OrderedMultiDict(dict): - def __init__(self, *args, **kwargs) -> None: ... - def add(self, k, v) -> None: ... - def addlist(self, k, v) -> None: ... - def get(self, k, default: Incomplete | None = ...): ... - def getlist(self, k, default=...): ... - def clear(self) -> None: ... - def setdefault(self, k, default=...): ... - def copy(self): ... - @classmethod - def fromkeys(cls, keys, default: Incomplete | None = ...): ... - def update(self, E, **F) -> None: ... - def update_extend(self, E, **F) -> None: ... - def __setitem__(self, k, v) -> None: ... - def __getitem__(self, k): ... - def __delitem__(self, k) -> None: ... - def __eq__(self, other): ... - def __ne__(self, other): ... - def pop(self, k, default=...): ... - def popall(self, k, default=...): ... - def poplast(self, k=..., default=...): ... - def iteritems(self, multi: bool = ...) -> Generator[Incomplete, None, None]: ... - def iterkeys(self, multi: bool = ...) -> Generator[Incomplete, None, None]: ... - def itervalues(self, multi: bool = ...) -> Generator[Incomplete, None, None]: ... - def todict(self, multi: bool = ...): ... - def sorted(self, key: Incomplete | None = ..., reverse: bool = ...): ... - def sortedvalues(self, key: Incomplete | None = ..., reverse: bool = ...): ... - def inverted(self): ... - def counts(self): ... - def keys(self, multi: bool = ...): ... - def values(self, multi: bool = ...): ... - def items(self, multi: bool = ...): ... - def __iter__(self): ... - def __reversed__(self) -> Generator[Incomplete, None, None]: ... - def viewkeys(self): ... - def viewvalues(self): ... - def viewitems(self): ... - -OMD = OrderedMultiDict - class QueryParamDict(OrderedMultiDict): @classmethod def from_text(cls, query_string): ... From 9ee21c548345890076572eea603d72a67e360ec8 Mon Sep 17 00:00:00 2001 From: Alexander Burchenko Date: Sun, 16 Oct 2022 02:30:17 +0200 Subject: [PATCH 12/51] fix linter warnings --- stubs/boltons/boltons/cacheutils.pyi | 10 +-- stubs/boltons/boltons/dictutils.pyi | 106 ++++++++++++++------------- stubs/boltons/boltons/funcutils.pyi | 4 +- stubs/boltons/boltons/listutils.pyi | 6 +- stubs/boltons/boltons/setutils.pyi | 9 +-- stubs/boltons/boltons/strutils.pyi | 2 +- stubs/boltons/boltons/urlutils.pyi | 2 +- 7 files changed, 69 insertions(+), 70 deletions(-) diff --git a/stubs/boltons/boltons/cacheutils.pyi b/stubs/boltons/boltons/cacheutils.pyi index c2fb44aa741a..20264be149d9 100644 --- a/stubs/boltons/boltons/cacheutils.pyi +++ b/stubs/boltons/boltons/cacheutils.pyi @@ -1,10 +1,6 @@ from _typeshed import Incomplete from collections.abc import Generator -class RLock: - def __enter__(self) -> None: ... - def __exit__(self, exctype, excinst, exctb) -> None: ... - xrange = range unicode: Incomplete str: Incomplete @@ -16,7 +12,7 @@ KEY: Incomplete VALUE: Incomplete DEFAULT_MAX_SIZE: int -class LRI(dict): +class LRI(dict[Incomplete, Incomplete]): hit_count: int max_size: Incomplete on_miss: Incomplete @@ -30,14 +26,14 @@ class LRI(dict): def clear(self) -> None: ... def copy(self): ... def setdefault(self, key, default: Incomplete | None = ...): ... - def update(self, E, **F) -> None: ... + def update(self, E, **F) -> None: ... # type: ignore def __eq__(self, other): ... def __ne__(self, other): ... class LRU(LRI): def __getitem__(self, key): ... -class _HashedKey(list): +class _HashedKey(list[Incomplete]): hash_value: Incomplete def __init__(self, key) -> None: ... def __hash__(self): ... diff --git a/stubs/boltons/boltons/dictutils.pyi b/stubs/boltons/boltons/dictutils.pyi index 4e5e35521e25..45bc2de3b5f2 100644 --- a/stubs/boltons/boltons/dictutils.pyi +++ b/stubs/boltons/boltons/dictutils.pyi @@ -1,78 +1,86 @@ +from _typeshed import Incomplete from collections.abc import Generator, Hashable, ItemsView, Iterable, KeysView, ValuesView -from typing import Any, Final, NoReturn +from typing import Any, NoReturn, TypeVar def __getattr__(name: str) -> Any: ... # incomplete -class OrderedMultiDict(dict): - def add(self, k: Hashable, v: object) -> NoReturn: ... - def addlist(self, k: Hashable, v: Iterable[object]) -> NoReturn: ... +_KT = TypeVar("_KT") +_VT = TypeVar("_VT") + +class OrderedMultiDict(dict[_KT, _VT]): + def add(self, k: _KT, v: _VT) -> NoReturn: ... + def addlist(self, k: _KT, v: Iterable[object]) -> NoReturn: ... def clear(self) -> NoReturn: ... - def copy(self) -> OrderedMultiDict: ... - def counts(self) -> OrderedMultiDict: ... + def copy(self) -> OrderedMultiDict[_KT, _VT]: ... + def counts(self) -> OrderedMultiDict[_KT, _VT]: ... @classmethod - def fromkeys(cls, keys: Hashable, default: object | None = ...) -> OrderedMultiDict: ... - def get(self, k: Hashable, default: object | None = ...) -> OrderedMultiDict: ... - def getlist(self, k: Hashable, default: object | None = ...) -> list[object]: ... - def inverted(self) -> OrderedMultiDict: ... - def items(self, multi: bool = ...) -> list[tuple[Hashable, object]]: ... - def iteritems(self, multi: bool = ...) -> Generator[tuple[Hashable, object], None, None]: ... - def iterkeys(self, multi: bool = ...) -> Generator[Hashable, None, None]: ... - def itervalues(self, multi: bool = ...) -> Generator[object, None, None]: ... - def keys(self, multi: bool = ...) -> list[Hashable]: ... - def pop(self, k: Hashable, default: object | None = ...) -> object: ... - def popall(self, k: Hashable, default: object | None = ...) -> list[object]: ... - def poplast(self, k: Hashable | None = ..., default: object | None = ...) -> object: ... - def setdefault(self, k: Hashable, default: object | None = ...) -> object: ... - def sorted(self, key: Hashable | None = ..., reverse: bool = ...) -> OrderedMultiDict: ... - def sortedvalues(self, key: Hashable | None = ..., reverse: bool = ...) -> OrderedMultiDict: ... - def todict(self, multi: bool = ...) -> dict[Hashable, object]: ... - def update(self, E: dict[Hashable, object] | Iterable[object], **F: object) -> NoReturn: ... - def update_extend(self, E: dict[Hashable, object] | Iterable[object], **F: object) -> NoReturn: ... - def values(self, multi: bool = ...) -> list[object]: ... - def viewitems(self) -> ItemsView[Hashable, object]: ... - def viewkeys(self) -> KeysView[Hashable]: ... - def viewvalues(self) -> ValuesView[object]: ... - -OMD: Final[OrderedMultiDict] -MultiDict: Final[OrderedMultiDict] + def fromkeys(cls, keys: _KT, default: _VT | None = ...) -> OrderedMultiDict[_KT, _VT]: ... # type: ignore + def get(self, k: _KT, default: _VT | None = ...) -> OrderedMultiDict[_KT, _VT]: ... # type: ignore + def getlist(self, k: _KT, default: _VT | None = ...) -> list[object]: ... + def inverted(self) -> OrderedMultiDict[_KT, _VT]: ... + def items(self, multi: bool = ...) -> list[tuple[_KT, _VT]]: ... # type: ignore + def iteritems(self, multi: bool = ...) -> Generator[tuple[_KT, _VT], None, None]: ... + def iterkeys(self, multi: bool = ...) -> Generator[_KT, None, None]: ... + def itervalues(self, multi: bool = ...) -> Generator[_VT, None, None]: ... + def keys(self, multi: bool = ...) -> list[_KT]: ... # type: ignore + def pop(self, k: _KT, default: _VT | None = ...) -> _VT: ... # type: ignore + 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 = ..., reverse: bool = ...) -> OrderedMultiDict[_KT, _VT]: ... + def sortedvalues(self, key: _KT | None = ..., reverse: bool = ...) -> OrderedMultiDict[_KT, _VT]: ... + def todict(self, multi: bool = ...) -> dict[_KT, _VT]: ... + def update(self, E: dict[_KT, _VT] | Iterable[object], **F) -> NoReturn: ... # type: ignore + def update_extend(self, E: dict[_KT, _VT] | Iterable[object], **F) -> NoReturn: ... + def values(self, multi: bool = ...) -> list[_VT]: ... # type: ignore + def viewitems(self) -> ItemsView[_KT, _VT]: ... + def viewkeys(self) -> KeysView[_KT]: ... + def viewvalues(self) -> ValuesView[_VT]: ... -class FastIterOrderedMultiDict(OrderedMultiDict): # undocumented - def iteritems(self, multi: bool = ...) -> Generator[tuple[Hashable, object], None, None]: ... - def iterkeys(self, multi: bool = ...) -> Generator[Hashable, None, None]: ... +class FastIterOrderedMultiDict(OrderedMultiDict[_KT, _VT]): # undocumented + def iteritems(self, multi: bool = ...) -> Generator[tuple[_KT, _VT], None, None]: ... + def iterkeys(self, multi: bool = ...) -> Generator[_KT, None, None]: ... -class OneToOne(dict): +class OneToOne(dict[_KT, _VT]): def clear(self) -> None: ... - def copy(self) -> OneToOne: ... - def pop(self, key: Hashable, default: object = ...) -> object: ... - def popitem(self) -> tuple[Hashable, object]: ... - def setdefault(self, key: Hashable, default: object | None = ...) -> object: ... + def copy(self) -> OneToOne[_KT, _VT]: ... + def pop(self, key: _KT, default: _VT = ...) -> _VT: ... # type: ignore + def popitem(self) -> tuple[_KT, _VT]: ... + def setdefault(self, key: _KT, default: _VT | None = ...) -> _VT: ... @classmethod def unique(cls, *a, **kw) -> NoReturn: ... - def update(self, dict_or_iterable: dict[Hashable, object] | Iterable[object], **kw: Any) -> NoReturn: ... + def update(self, dict_or_iterable: dict[_KT, _VT] | Iterable[object], **kw) -> NoReturn: ... # type: ignore class ManyToMany: def __getattr__(self, name: str) -> Any: ... # incomplete data: dict[Hashable, object] - inv: tuple[object] + def __contains__(self, key): ... + def __delitem__(self, key) -> None: ... + def __eq__(self, other): ... + def __getitem__(self, key): ... + def __init__(self, items: Incomplete | None = ...) -> None: ... + def __iter__(self): ... + def __len__(self): ... + def __setitem__(self, key, vals) -> None: ... def add(self, key: Hashable, val: object) -> NoReturn: ... - def get(self, key: Hashable, default: frozenset[object] = ...) -> Any: ... + def get(self, key: Hashable, default: frozenset[object] = ...) -> object: ... def iteritems(self) -> Generator[tuple[Hashable, object], None, None]: ... def keys(self): ... # incomplete def remove(self, key: Hashable, val: object) -> NoReturn: ... def replace(self, key: Hashable, newkey: Hashable) -> NoReturn: ... - def update(self, iterable: Iterable[object]) -> NoReturn: ... + def update(self, iterable) -> None: ... + inv: tuple[object] -def subdict( - d: dict[Hashable, object], keep: Iterable[object] | None = ..., drop: Iterable[object] | None = ... -) -> dict[Hashable, object]: ... +def subdict(d: dict[_KT, _VT], keep: Iterable[_VT] | None = ..., drop: Iterable[_VT] | None = ...) -> dict[_KT, _VT]: ... class FrozenHashError(TypeError): ... # undocumented -class FrozenDict(dict): +class FrozenDict(dict[_KT, _VT]): + def __copy__(self): ... def clear(self, *a, **kw) -> NoReturn: ... @classmethod - def fromkeys(cls, keys: Iterable[object], value: object | None = ...) -> FrozenDict: ... + def fromkeys(cls, keys: Iterable[_KT], value: _VT | None = ...) -> FrozenDict[_KT, _VT]: ... # type: ignore def pop(self, *a, **kw) -> NoReturn: ... def popitem(self, *a, **kw) -> NoReturn: ... def setdefault(self, *a, **kw) -> NoReturn: ... - def updated(self, *a, **kw) -> FrozenDict: ... + def updated(self, *a, **kw) -> FrozenDict[_KT, _VT]: ... diff --git a/stubs/boltons/boltons/funcutils.pyi b/stubs/boltons/boltons/funcutils.pyi index ac4db87ecf68..945505c99735 100644 --- a/stubs/boltons/boltons/funcutils.pyi +++ b/stubs/boltons/boltons/funcutils.pyi @@ -13,10 +13,10 @@ def dir_dict(obj, raise_exc: bool = ...): ... def copy_function(orig, copy_dict: bool = ...): ... def partial_ordering(cls): ... -class InstancePartial(functools.partial): +class InstancePartial(functools.partial[Incomplete]): def __get__(self, obj, obj_type): ... -class CachedInstancePartial(functools.partial): +class CachedInstancePartial(functools.partial[Incomplete]): __name__: Incomplete def __set_name__(self, obj_type, name) -> None: ... __doc__: Incomplete diff --git a/stubs/boltons/boltons/listutils.pyi b/stubs/boltons/boltons/listutils.pyi index a7c31098b9ef..00eebadf3c2f 100644 --- a/stubs/boltons/boltons/listutils.pyi +++ b/stubs/boltons/boltons/listutils.pyi @@ -2,7 +2,7 @@ from _typeshed import Incomplete xrange = range -class BarrelList(list): +class BarrelList(list[Incomplete]): lists: Incomplete def __init__(self, iterable: Incomplete | None = ...) -> None: ... def insert(self, index, item) -> None: ... @@ -23,13 +23,13 @@ class BarrelList(list): def __setitem__(self, index, item) -> None: ... def __getslice__(self, start, stop): ... def __setslice__(self, start, stop, sequence) -> None: ... - def sort(self) -> None: ... + def sort(self) -> None: ... # type: ignore def reverse(self) -> None: ... def count(self, item): ... def index(self, item): ... BList = BarrelList -class SplayList(list): +class SplayList(list[Incomplete]): def shift(self, item_index, dest_index: int = ...) -> None: ... def swap(self, item_index, dest_index) -> None: ... diff --git a/stubs/boltons/boltons/setutils.pyi b/stubs/boltons/boltons/setutils.pyi index ab4078b28c15..eef9be5f3934 100644 --- a/stubs/boltons/boltons/setutils.pyi +++ b/stubs/boltons/boltons/setutils.pyi @@ -1,8 +1,7 @@ from _typeshed import Incomplete -from collections import MutableSet -from collections.abc import Generator +from collections.abc import Generator, MutableSet -class IndexedSet(MutableSet): +class IndexedSet(MutableSet[Incomplete]): item_index_map: Incomplete item_list: Incomplete dead_indices: Incomplete @@ -39,10 +38,6 @@ class IndexedSet(MutableSet): def intersection_update(self, *others) -> None: ... def difference_update(self, *others) -> None: ... def symmetric_difference_update(self, other) -> None: ... - def __ior__(self, *others): ... - def __iand__(self, *others): ... - def __isub__(self, *others): ... - def __ixor__(self, *others): ... def iter_slice(self, start, stop, step: Incomplete | None = ...): ... def __getitem__(self, index): ... def pop(self, index: Incomplete | None = ...): ... diff --git a/stubs/boltons/boltons/strutils.pyi b/stubs/boltons/boltons/strutils.pyi index 934e2e43b0d5..00538c975689 100644 --- a/stubs/boltons/boltons/strutils.pyi +++ b/stubs/boltons/boltons/strutils.pyi @@ -19,7 +19,7 @@ def strip_ansi(text): ... def asciify(text, ignore: bool = ...): ... def is_ascii(text): ... -class DeaccenterDict(dict): +class DeaccenterDict(dict[Incomplete, Incomplete]): def __missing__(self, key): ... def __getitem__(self, key): ... diff --git a/stubs/boltons/boltons/urlutils.pyi b/stubs/boltons/boltons/urlutils.pyi index 19236e48e388..d84c6941b5a0 100644 --- a/stubs/boltons/boltons/urlutils.pyi +++ b/stubs/boltons/boltons/urlutils.pyi @@ -88,7 +88,7 @@ VALUE: Incomplete SPREV: Incomplete SNEXT: Incomplete -class QueryParamDict(OrderedMultiDict): +class QueryParamDict(OrderedMultiDict[Incomplete, Incomplete]): @classmethod def from_text(cls, query_string): ... def to_text(self, full_quote: bool = ...): ... From 416ba9cf3beeb0f214835ec9f1aeae17035269d8 Mon Sep 17 00:00:00 2001 From: Andrey Maslennikov Date: Thu, 27 Oct 2022 12:52:37 +0300 Subject: [PATCH 13/51] Make changes to pass flake8 (#2) --- stubs/boltons/boltons/fileutils.pyi | 2 -- 1 file changed, 2 deletions(-) diff --git a/stubs/boltons/boltons/fileutils.pyi b/stubs/boltons/boltons/fileutils.pyi index 63f5c1133ed2..a41a4cd2e0e5 100644 --- a/stubs/boltons/boltons/fileutils.pyi +++ b/stubs/boltons/boltons/fileutils.pyi @@ -1,8 +1,6 @@ from _typeshed import Incomplete from collections.abc import Generator -unicode = str - def mkdir_p(path) -> None: ... class FilePerms: From 2155b12c2f1b8a47f8ed55bdd00f45c16d864ed7 Mon Sep 17 00:00:00 2001 From: Alexander Burchenko Date: Fri, 11 Nov 2022 21:35:14 +0200 Subject: [PATCH 14/51] boltons: fix stubtest errors --- stubs/boltons/@tests/stubtest_allowlist.txt | 3 +++ stubs/boltons/boltons/dictutils.pyi | 6 +++++- stubs/boltons/boltons/ecoutils.pyi | 1 + stubs/boltons/boltons/funcutils.pyi | 4 ++-- stubs/boltons/boltons/ioutils.pyi | 1 + stubs/boltons/boltons/mathutils.pyi | 2 +- stubs/boltons/boltons/namedutils.pyi | 2 +- stubs/boltons/boltons/socketutils.pyi | 6 +++--- stubs/boltons/boltons/statsutils.pyi | 13 ++++++++++++- stubs/boltons/boltons/timeutils.pyi | 6 ++++++ stubs/boltons/boltons/urlutils.pyi | 6 +++--- 11 files changed, 38 insertions(+), 12 deletions(-) create mode 100644 stubs/boltons/@tests/stubtest_allowlist.txt diff --git a/stubs/boltons/@tests/stubtest_allowlist.txt b/stubs/boltons/@tests/stubtest_allowlist.txt new file mode 100644 index 000000000000..7d28fc915de8 --- /dev/null +++ b/stubs/boltons/@tests/stubtest_allowlist.txt @@ -0,0 +1,3 @@ +boltons.ecoutils +boltons.strutils.int_list_complement +boltons.strutils.int_list_to_int_tuples diff --git a/stubs/boltons/boltons/dictutils.pyi b/stubs/boltons/boltons/dictutils.pyi index 45bc2de3b5f2..50e28c93a2ec 100644 --- a/stubs/boltons/boltons/dictutils.pyi +++ b/stubs/boltons/boltons/dictutils.pyi @@ -1,6 +1,7 @@ from _typeshed import Incomplete from collections.abc import Generator, Hashable, ItemsView, Iterable, KeysView, ValuesView from typing import Any, NoReturn, TypeVar +from typing_extensions import TypeAlias def __getattr__(name: str) -> Any: ... # incomplete @@ -37,11 +38,15 @@ class OrderedMultiDict(dict[_KT, _VT]): def viewkeys(self) -> KeysView[_KT]: ... def viewvalues(self) -> ValuesView[_VT]: ... +OMD: TypeAlias = OrderedMultiDict[Any, Any] +MultiDict: TypeAlias = OrderedMultiDict[Any, Any] + class FastIterOrderedMultiDict(OrderedMultiDict[_KT, _VT]): # undocumented def iteritems(self, multi: bool = ...) -> Generator[tuple[_KT, _VT], None, None]: ... def iterkeys(self, multi: bool = ...) -> Generator[_KT, None, None]: ... class OneToOne(dict[_KT, _VT]): + inv: Incomplete def clear(self) -> None: ... def copy(self) -> OneToOne[_KT, _VT]: ... def pop(self, key: _KT, default: _VT = ...) -> _VT: ... # type: ignore @@ -52,7 +57,6 @@ class OneToOne(dict[_KT, _VT]): def update(self, dict_or_iterable: dict[_KT, _VT] | Iterable[object], **kw) -> NoReturn: ... # type: ignore class ManyToMany: - def __getattr__(self, name: str) -> Any: ... # incomplete data: dict[Hashable, object] def __contains__(self, key): ... def __delitem__(self, key) -> None: ... diff --git a/stubs/boltons/boltons/ecoutils.pyi b/stubs/boltons/boltons/ecoutils.pyi index 5f538db10f6a..3db230d943a5 100644 --- a/stubs/boltons/boltons/ecoutils.pyi +++ b/stubs/boltons/boltons/ecoutils.pyi @@ -16,6 +16,7 @@ EXPAT_VERSION: Incomplete CPU_COUNT: Incomplete HAVE_THREADING: bool HAVE_IPV6: Incomplete +RLIMIT_NOFILE: Incomplete RLIMIT_FDS_SOFT: Incomplete RLIMIT_FDS_HARD: Incomplete START_TIME_INFO: Incomplete diff --git a/stubs/boltons/boltons/funcutils.pyi b/stubs/boltons/boltons/funcutils.pyi index 945505c99735..362787a47c06 100644 --- a/stubs/boltons/boltons/funcutils.pyi +++ b/stubs/boltons/boltons/funcutils.pyi @@ -1,11 +1,11 @@ import functools from _typeshed import Incomplete from functools import total_ordering as total_ordering -from types import MethodType -make_method = MethodType +make_method: Incomplete basestring: Incomplete NO_DEFAULT: Incomplete +inspect_formatargspec: Incomplete def get_module_callables(mod, ignore: Incomplete | None = ...): ... def mro_items(type_obj): ... diff --git a/stubs/boltons/boltons/ioutils.pyi b/stubs/boltons/boltons/ioutils.pyi index e69bdbf576e9..ce7ba00d2bde 100644 --- a/stubs/boltons/boltons/ioutils.pyi +++ b/stubs/boltons/boltons/ioutils.pyi @@ -5,6 +5,7 @@ from abc import abstractmethod text_type = str binary_type = bytes READ_CHUNK_SIZE: int +EINVAL: Incomplete class SpooledIOBase(metaclass=abc.ABCMeta): __metaclass__: Incomplete diff --git a/stubs/boltons/boltons/mathutils.pyi b/stubs/boltons/boltons/mathutils.pyi index 1b0f91dc4622..5b5ce83eb7ac 100644 --- a/stubs/boltons/boltons/mathutils.pyi +++ b/stubs/boltons/boltons/mathutils.pyi @@ -4,7 +4,7 @@ def clamp(x, lower=..., upper=...): ... def ceil(x, options: Incomplete | None = ...): ... def floor(x, options: Incomplete | None = ...): ... -bytes = str +# bytes = str unicode = str class Bits: diff --git a/stubs/boltons/boltons/namedutils.pyi b/stubs/boltons/boltons/namedutils.pyi index fa99af184212..5a62ac505f71 100644 --- a/stubs/boltons/boltons/namedutils.pyi +++ b/stubs/boltons/boltons/namedutils.pyi @@ -1,4 +1,4 @@ -OrderedDict = dict +# OrderedDict = dict def namedtuple(typename, field_names, verbose: bool = ..., rename: bool = ...): ... def namedlist(typename, field_names, verbose: bool = ..., rename: bool = ...): ... diff --git a/stubs/boltons/boltons/socketutils.pyi b/stubs/boltons/boltons/socketutils.pyi index 07c4343f789d..b70e9aceddc4 100644 --- a/stubs/boltons/boltons/socketutils.pyi +++ b/stubs/boltons/boltons/socketutils.pyi @@ -1,9 +1,9 @@ import socket from _typeshed import Incomplete -class RLock: - def __enter__(self) -> None: ... - def __exit__(self, exctype, excinst, exctb) -> None: ... +# class RLock: +# def __enter__(self) -> None: ... +# def __exit__(self, exctype, excinst, exctb) -> None: ... DEFAULT_TIMEOUT: int DEFAULT_MAXSIZE: Incomplete diff --git a/stubs/boltons/boltons/statsutils.pyi b/stubs/boltons/boltons/statsutils.pyi index 9e20f048a4e5..74009090e95a 100644 --- a/stubs/boltons/boltons/statsutils.pyi +++ b/stubs/boltons/boltons/statsutils.pyi @@ -39,6 +39,17 @@ class Stats: def describe(data, quantiles: Incomplete | None = ..., format: Incomplete | None = ...): ... -func: Incomplete +# func: Incomplete +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, width: Incomplete | None = ..., format_bin: Incomplete | None = ...): ... diff --git a/stubs/boltons/boltons/timeutils.pyi b/stubs/boltons/boltons/timeutils.pyi index 036b102a9cb3..9eb12904cc68 100644 --- a/stubs/boltons/boltons/timeutils.pyi +++ b/stubs/boltons/boltons/timeutils.pyi @@ -38,6 +38,12 @@ class LocalTZInfo(tzinfo): def tzname(self, dt): ... LocalTZ: Incomplete +DSTSTART_2007: Incomplete +DSTEND_2007: Incomplete +DSTSTART_1987_2006: Incomplete +DSTEND_1987_2006: Incomplete +DSTSTART_1967_1986: Incomplete +DSTEND_1967_1986: Incomplete class USTimeZone(tzinfo): stdoffset: Incomplete diff --git a/stubs/boltons/boltons/urlutils.pyi b/stubs/boltons/boltons/urlutils.pyi index d84c6941b5a0..36fcf8663f6a 100644 --- a/stubs/boltons/boltons/urlutils.pyi +++ b/stubs/boltons/boltons/urlutils.pyi @@ -51,7 +51,7 @@ class URL: username: Incomplete | None = ..., password: Incomplete | None = ..., ): ... - def query_params(self): ... + query_params: Incomplete qp: Incomplete @property def path(self): ... @@ -71,8 +71,8 @@ class URL: class _sockaddr(ctypes.Structure): ... -WSAStringToAddressA: Incomplete -WSAAddressToStringA: Incomplete +# WSAStringToAddressA: Incomplete +# WSAAddressToStringA: Incomplete def parse_host(host): ... def parse_url(url_text): ... From 211c8d011ee30b7895c384d351bee5c6d7ec2d3c Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Fri, 11 Nov 2022 20:03:45 +0000 Subject: [PATCH 15/51] remove unused allowlist entry --- stubs/boltons/@tests/stubtest_allowlist.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/stubs/boltons/@tests/stubtest_allowlist.txt b/stubs/boltons/@tests/stubtest_allowlist.txt index 7d28fc915de8..933d35d601e1 100644 --- a/stubs/boltons/@tests/stubtest_allowlist.txt +++ b/stubs/boltons/@tests/stubtest_allowlist.txt @@ -1,3 +1,2 @@ -boltons.ecoutils boltons.strutils.int_list_complement boltons.strutils.int_list_to_int_tuples From 339528c1e6aca350fe8477036de2f4dd94a6c5c4 Mon Sep 17 00:00:00 2001 From: Alexander Burchenko Date: Sat, 12 Nov 2022 19:56:18 +0200 Subject: [PATCH 16/51] boltons: queueutils realised --- stubs/boltons/boltons/queueutils.pyi | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/stubs/boltons/boltons/queueutils.pyi b/stubs/boltons/boltons/queueutils.pyi index 4b53e0f03de3..958fabfc0779 100644 --- a/stubs/boltons/boltons/queueutils.pyi +++ b/stubs/boltons/boltons/queueutils.pyi @@ -1,16 +1,15 @@ -from _typeshed import Incomplete - -BList = list +from typing import Any, NoReturn +from typing_extensions import TypeAlias class BasePriorityQueue: - def __init__(self, **kw) -> None: ... - def add(self, task, priority: Incomplete | None = ...) -> None: ... - def remove(self, task) -> None: ... - def peek(self, default=...): ... - def pop(self, default=...): ... - def __len__(self): ... + def __init__(self, **kw) -> NoReturn: ... + def add(self, task: Any, priority: int | None = ...) -> NoReturn: ... + def remove(self, task: Any) -> NoReturn: ... + def peek(self, default: Any = ...) -> Any | NoReturn: ... + def pop(self, default: Any = ...) -> Any | NoReturn: ... + def __len__(self) -> int: ... class HeapPriorityQueue(BasePriorityQueue): ... class SortedPriorityQueue(BasePriorityQueue): ... -PriorityQueue = SortedPriorityQueue +PriorityQueue: TypeAlias = SortedPriorityQueue From 0d6338973f5d922f2898c4fee94a06d28daa22c4 Mon Sep 17 00:00:00 2001 From: Alexander Burchenko Date: Mon, 14 Nov 2022 00:10:58 +0200 Subject: [PATCH 17/51] boltons: type annotations updated Fully annotated and ready for review: debugutils deprutils easterutils ecoutils excutils jsonutils mboxutils namedutils pathutils queueutils --- stubs/boltons/boltons/debugutils.pyi | 12 +++---- stubs/boltons/boltons/deprutils.pyi | 9 +++-- stubs/boltons/boltons/easterutils.pyi | 6 +++- stubs/boltons/boltons/ecoutils.pyi | 52 ++++++++++++++------------- stubs/boltons/boltons/excutils.pyi | 30 +++------------- stubs/boltons/boltons/jsonutils.pyi | 27 ++++++++------ stubs/boltons/boltons/mboxutils.pyi | 12 ++++--- stubs/boltons/boltons/namedutils.pyi | 6 ++-- stubs/boltons/boltons/pathutils.pyi | 19 +++++----- stubs/boltons/boltons/queueutils.pyi | 2 ++ 10 files changed, 90 insertions(+), 85 deletions(-) diff --git a/stubs/boltons/boltons/debugutils.pyi b/stubs/boltons/boltons/debugutils.pyi index 85c20da0f01e..bd0cec81fbae 100644 --- a/stubs/boltons/boltons/debugutils.pyi +++ b/stubs/boltons/boltons/debugutils.pyi @@ -1,7 +1,7 @@ -from _typeshed import Incomplete +# TODO: DONE! -def pdb_on_signal(signalnum: Incomplete | None = ...) -> None: ... -def pdb_on_exception(limit: int = ...) -> None: ... -def wrap_trace( - obj, hook=..., which: Incomplete | None = ..., events: Incomplete | None = ..., label: Incomplete | None = ... -): ... +from typing import NoReturn + +def pdb_on_signal(signalnum: int | None = ...) -> NoReturn: ... +def pdb_on_exception(limit: int = ...) -> NoReturn: ... +def wrap_trace(obj, hook=..., which: str | None = ..., events: str | None = ..., label: str | None = ...): ... diff --git a/stubs/boltons/boltons/deprutils.pyi b/stubs/boltons/boltons/deprutils.pyi index bdbfb1346860..ea358706bc3b 100644 --- a/stubs/boltons/boltons/deprutils.pyi +++ b/stubs/boltons/boltons/deprutils.pyi @@ -1,7 +1,10 @@ +# TODO: DONE! + from types import ModuleType +from typing import Any, NoReturn class DeprecatableModule(ModuleType): - def __init__(self, module) -> None: ... - def __getattribute__(self, name): ... + def __init__(self, module: ModuleType) -> NoReturn: ... + def __getattribute__(self, name: str) -> Any: ... -def deprecate_module_member(mod_name, name, message) -> None: ... +def deprecate_module_member(mod_name: str, name: str, message: str) -> NoReturn: ... diff --git a/stubs/boltons/boltons/easterutils.pyi b/stubs/boltons/boltons/easterutils.pyi index 46cadd75dd58..0d137b6b899a 100644 --- a/stubs/boltons/boltons/easterutils.pyi +++ b/stubs/boltons/boltons/easterutils.pyi @@ -1 +1,5 @@ -def gobs_program() -> None: ... +# TODO: DONE! + +from typing import NoReturn + +def gobs_program() -> NoReturn: ... diff --git a/stubs/boltons/boltons/ecoutils.pyi b/stubs/boltons/boltons/ecoutils.pyi index 3db230d943a5..069f6d419ffa 100644 --- a/stubs/boltons/boltons/ecoutils.pyi +++ b/stubs/boltons/boltons/ecoutils.pyi @@ -1,27 +1,29 @@ -from _typeshed import Incomplete +# TODO: DONE! -ECO_VERSION: str -PY_GT_2: Incomplete -getrandbits: Incomplete -HAVE_URANDOM: bool -INSTANCE_ID: Incomplete -IS_64BIT: Incomplete -HAVE_UCS4: Incomplete -HAVE_READLINE: bool -SQLITE_VERSION: Incomplete -OPENSSL_VERSION: Incomplete -TKINTER_VERSION: Incomplete -ZLIB_VERSION: Incomplete -EXPAT_VERSION: Incomplete -CPU_COUNT: Incomplete -HAVE_THREADING: bool -HAVE_IPV6: Incomplete -RLIMIT_NOFILE: Incomplete -RLIMIT_FDS_SOFT: Incomplete -RLIMIT_FDS_HARD: Incomplete -START_TIME_INFO: Incomplete +from typing import Any, NoReturn -def get_python_info(): ... -def get_profile(**kwargs): ... -def get_profile_json(indent: bool = ...): ... -def main() -> None: ... +# ECO_VERSION: str +# PY_GT_2: Incomplete +# getrandbits: Incomplete +# HAVE_URANDOM: bool +# INSTANCE_ID: Incomplete +# IS_64BIT: Incomplete +# HAVE_UCS4: Incomplete +# HAVE_READLINE: bool +# SQLITE_VERSION: Incomplete +# OPENSSL_VERSION: Incomplete +# TKINTER_VERSION: Incomplete +# ZLIB_VERSION: Incomplete +# EXPAT_VERSION: Incomplete +# CPU_COUNT: Incomplete +# HAVE_THREADING: bool +# HAVE_IPV6: Incomplete +# RLIMIT_NOFILE: Incomplete +# RLIMIT_FDS_SOFT: Incomplete +# RLIMIT_FDS_HARD: Incomplete +# START_TIME_INFO: Incomplete + +def get_python_info() -> dict[str, Any]: ... +def get_profile(**kwargs) -> dict[str, Any]: ... +def get_profile_json(indent: bool = ...) -> str: ... +def main() -> NoReturn: ... diff --git a/stubs/boltons/boltons/excutils.pyi b/stubs/boltons/boltons/excutils.pyi index b508048924f3..f5164f8ca26c 100644 --- a/stubs/boltons/boltons/excutils.pyi +++ b/stubs/boltons/boltons/excutils.pyi @@ -1,27 +1,7 @@ -from _typeshed import Incomplete -from typing import NamedTuple +# TODO: DONE! -class ExceptionCauseMixin(Exception): - cause: Incomplete - def __new__(cls, *args, **kw): ... - def get_str(self): ... - -class _BaseTBItem(NamedTuple): - filename: Incomplete - lineno: Incomplete - name: Incomplete - line: Incomplete - -class _TBItem(_BaseTBItem): ... +from typing import Any -class _DeferredLine: - filename: Incomplete - lineno: Incomplete - module_globals: Incomplete - def __init__(self, filename, lineno, module_globals: Incomplete | None = ...) -> None: ... - def __eq__(self, other): ... - def __ne__(self, other): ... - def __len__(self): ... - def strip(self): ... - -class MathError(ExceptionCauseMixin, ValueError): ... +class ExceptionCauseMixin(Exception): + cause: Any + def get_str(self) -> str: ... diff --git a/stubs/boltons/boltons/jsonutils.pyi b/stubs/boltons/boltons/jsonutils.pyi index 7454cfedef26..200101a9b080 100644 --- a/stubs/boltons/boltons/jsonutils.pyi +++ b/stubs/boltons/boltons/jsonutils.pyi @@ -1,15 +1,22 @@ -from _typeshed import Incomplete -from collections.abc import Generator +# TODO: DONE! + +from collections.abc import Iterator +from typing import IO, AnyStr def reverse_iter_lines( - file_obj, blocksize=..., preseek: bool = ..., encoding: Incomplete | None = ... -) -> Generator[Incomplete, None, None]: ... + file_obj: IO[AnyStr], blocksize: int = ..., preseek: bool = ..., encoding: AnyStr | None = ... +) -> Iterator[AnyStr]: ... + +# def reverse_iter_lines( +# file_obj: IO[AnyStr], blocksize: int =..., preseek: bool = ..., encoding: AnyStr | None = ... +# ) -> Generator[Incomplete, None, None]: ... class JSONLIterator: - ignore_errors: Incomplete - def __init__(self, file_obj, ignore_errors: bool = ..., reverse: bool = ..., rel_seek: Incomplete | None = ...) -> None: ... + ignore_errors: bool + def __init__( + self, file_obj: IO[AnyStr], ignore_errors: bool = ..., reverse: bool = ..., rel_seek: float | None = ... + ) -> None: ... @property - def cur_byte_pos(self): ... - def __iter__(self): ... - def next(self): ... - __next__: Incomplete + def cur_byte_pos(self) -> int: ... + # def next(self): ... + # __next__: Incomplete diff --git a/stubs/boltons/boltons/mboxutils.pyi b/stubs/boltons/boltons/mboxutils.pyi index e58b907d8f20..0d090ca008ca 100644 --- a/stubs/boltons/boltons/mboxutils.pyi +++ b/stubs/boltons/boltons/mboxutils.pyi @@ -1,9 +1,11 @@ +# TODO: DONE! + import mailbox -from _typeshed import Incomplete +from typing import NoReturn -DEFAULT_MAXMEM: Incomplete +DEFAULT_MAXMEM: int class mbox_readonlydir(mailbox.mbox): - maxmem: Incomplete - def __init__(self, path, factory: Incomplete | None = ..., create: bool = ..., maxmem=...) -> None: ... - def flush(self) -> None: ... + maxmem: int + def __init__(self, path: str, factory: type | None = ..., create: bool = ..., maxmem: int = ...) -> NoReturn: ... + def flush(self) -> NoReturn: ... diff --git a/stubs/boltons/boltons/namedutils.pyi b/stubs/boltons/boltons/namedutils.pyi index 5a62ac505f71..89783ab80023 100644 --- a/stubs/boltons/boltons/namedutils.pyi +++ b/stubs/boltons/boltons/namedutils.pyi @@ -1,4 +1,6 @@ +# TODO: DONE! + # OrderedDict = dict -def namedtuple(typename, field_names, verbose: bool = ..., rename: bool = ...): ... -def namedlist(typename, field_names, verbose: bool = ..., rename: bool = ...): ... +def namedtuple(typename: str, field_names: list[str], verbose: bool = ..., rename: bool = ...): ... +def namedlist(typename: str, field_names: list[str], verbose: bool = ..., rename: bool = ...): ... diff --git a/stubs/boltons/boltons/pathutils.pyi b/stubs/boltons/boltons/pathutils.pyi index f1b96516ecae..e00ea7912abe 100644 --- a/stubs/boltons/boltons/pathutils.pyi +++ b/stubs/boltons/boltons/pathutils.pyi @@ -1,13 +1,16 @@ -from _typeshed import Incomplete +# TODO: DONE! + +import os +from typing import Any def augpath( - path, + path: str | "os.PathLike[Any]", suffix: str = ..., prefix: str = ..., - ext: Incomplete | None = ..., - base: Incomplete | None = ..., - dpath: Incomplete | None = ..., + ext: str | None = ..., + base: str | None = ..., + dpath: str | "os.PathLike[Any]" | None = ..., multidot: bool = ..., -): ... -def shrinkuser(path, home: str = ...): ... -def expandpath(path): ... +) -> str: ... +def shrinkuser(path: str | "os.PathLike[Any]", home: str = ...) -> str: ... +def expandpath(path: str | "os.PathLike[Any]") -> str: ... diff --git a/stubs/boltons/boltons/queueutils.pyi b/stubs/boltons/boltons/queueutils.pyi index 958fabfc0779..adb1caec7e9e 100644 --- a/stubs/boltons/boltons/queueutils.pyi +++ b/stubs/boltons/boltons/queueutils.pyi @@ -1,3 +1,5 @@ +# TODO: DONE! + from typing import Any, NoReturn from typing_extensions import TypeAlias From f372c6c6dba5f2c13ffe93130ba8a88fb004b6cb Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 13 Nov 2022 22:12:13 +0000 Subject: [PATCH 18/51] [pre-commit.ci] auto fixes from pre-commit.com hooks --- stubs/boltons/boltons/pathutils.pyi | 3 --- 1 file changed, 3 deletions(-) diff --git a/stubs/boltons/boltons/pathutils.pyi b/stubs/boltons/boltons/pathutils.pyi index e00ea7912abe..31139d255979 100644 --- a/stubs/boltons/boltons/pathutils.pyi +++ b/stubs/boltons/boltons/pathutils.pyi @@ -1,8 +1,5 @@ # TODO: DONE! -import os -from typing import Any - def augpath( path: str | "os.PathLike[Any]", suffix: str = ..., From f51cdc6e23489a064addfbdd473a44cfa688d9e9 Mon Sep 17 00:00:00 2001 From: Alexander Burchenko Date: Mon, 14 Nov 2022 00:21:11 +0200 Subject: [PATCH 19/51] boltons: fix pathutils --- stubs/boltons/boltons/pathutils.pyi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/stubs/boltons/boltons/pathutils.pyi b/stubs/boltons/boltons/pathutils.pyi index 31139d255979..776cf69ba852 100644 --- a/stubs/boltons/boltons/pathutils.pyi +++ b/stubs/boltons/boltons/pathutils.pyi @@ -1,13 +1,13 @@ # TODO: DONE! def augpath( - path: str | "os.PathLike[Any]", + path: str, suffix: str = ..., prefix: str = ..., ext: str | None = ..., base: str | None = ..., - dpath: str | "os.PathLike[Any]" | None = ..., + dpath: str | None = ..., multidot: bool = ..., ) -> str: ... -def shrinkuser(path: str | "os.PathLike[Any]", home: str = ...) -> str: ... -def expandpath(path: str | "os.PathLike[Any]") -> str: ... +def shrinkuser(path: str, home: str = ...) -> str: ... +def expandpath(path: str) -> str: ... From 1ebd17fac1ddf02a2f41404419065c994876fba9 Mon Sep 17 00:00:00 2001 From: Alexander Burchenko Date: Fri, 18 Nov 2022 12:07:45 +0200 Subject: [PATCH 20/51] fix subtest errors --- stubs/boltons/@tests/stubtest_allowlist.txt | 5 +++++ stubs/boltons/boltons/cacheutils.pyi | 7 ++----- stubs/boltons/boltons/excutils.pyi | 23 ++++++++++++++++++++- stubs/boltons/boltons/jsonutils.pyi | 15 ++++++-------- 4 files changed, 35 insertions(+), 15 deletions(-) diff --git a/stubs/boltons/@tests/stubtest_allowlist.txt b/stubs/boltons/@tests/stubtest_allowlist.txt index 933d35d601e1..eb8bcf9b179e 100644 --- a/stubs/boltons/@tests/stubtest_allowlist.txt +++ b/stubs/boltons/@tests/stubtest_allowlist.txt @@ -1,2 +1,7 @@ boltons.strutils.int_list_complement boltons.strutils.int_list_to_int_tuples + +# Bug in boltons https://github.com/mahmoud/boltons/issues/294 +# This bug is fixed only in the development version (on github). +# In the PyPI repository version the bug is not fixed +boltons.ecoutils diff --git a/stubs/boltons/boltons/cacheutils.pyi b/stubs/boltons/boltons/cacheutils.pyi index 20264be149d9..168bd117731f 100644 --- a/stubs/boltons/boltons/cacheutils.pyi +++ b/stubs/boltons/boltons/cacheutils.pyi @@ -1,11 +1,9 @@ from _typeshed import Incomplete from collections.abc import Generator +from typing import Any xrange = range -unicode: Incomplete -str: Incomplete -bytes: Incomplete -basestring: Incomplete +basestring: Any PREV: Incomplete NEXT: Incomplete KEY: Incomplete @@ -65,7 +63,6 @@ def cached(cache, scoped: bool = ..., typed: bool = ..., key: Incomplete | None def cachedmethod(cache, scoped: bool = ..., typed: bool = ..., key: Incomplete | None = ...): ... class cachedproperty: - __doc__: Incomplete __isabstractmethod__: Incomplete func: Incomplete def __init__(self, func) -> None: ... diff --git a/stubs/boltons/boltons/excutils.pyi b/stubs/boltons/boltons/excutils.pyi index f5164f8ca26c..584bb5dfe20b 100644 --- a/stubs/boltons/boltons/excutils.pyi +++ b/stubs/boltons/boltons/excutils.pyi @@ -1,7 +1,28 @@ # TODO: DONE! -from typing import Any +from typing import Any, NamedTuple, NoReturn class ExceptionCauseMixin(Exception): cause: Any + def __new__(cls, *args, **kw) -> NoReturn: ... def get_str(self) -> str: ... + +class _BaseTBItem(NamedTuple): + filename: str + lineno: int + name: str + line: str + +class _TBItem(_BaseTBItem): ... + +class _DeferredLine: + filename: str + lineno: int + module_globals: dict[Any, Any] + def __init__(self, filename: str, lineno: int, module_globals: dict[Any, Any] | None = ...) -> None: ... + def __eq__(self, other: object) -> bool: ... + def __ne__(self, other: object) -> bool: ... + def __len__(self) -> int: ... + def strip(self) -> str: ... + +class MathError(ExceptionCauseMixin, ValueError): ... diff --git a/stubs/boltons/boltons/jsonutils.pyi b/stubs/boltons/boltons/jsonutils.pyi index 200101a9b080..8559e9a1815d 100644 --- a/stubs/boltons/boltons/jsonutils.pyi +++ b/stubs/boltons/boltons/jsonutils.pyi @@ -1,15 +1,11 @@ # TODO: DONE! -from collections.abc import Iterator -from typing import IO, AnyStr +from collections.abc import Generator +from typing import IO, Any, AnyStr, NoReturn def reverse_iter_lines( file_obj: IO[AnyStr], blocksize: int = ..., preseek: bool = ..., encoding: AnyStr | None = ... -) -> Iterator[AnyStr]: ... - -# def reverse_iter_lines( -# file_obj: IO[AnyStr], blocksize: int =..., preseek: bool = ..., encoding: AnyStr | None = ... -# ) -> Generator[Incomplete, None, None]: ... +) -> Generator[AnyStr, None, None]: ... class JSONLIterator: ignore_errors: bool @@ -18,5 +14,6 @@ class JSONLIterator: ) -> None: ... @property def cur_byte_pos(self) -> int: ... - # def next(self): ... - # __next__: Incomplete + def __iter__(self) -> NoReturn: ... + def next(self) -> Any | NoReturn: ... + __next__: Any | NoReturn From 13bd8da528719e31f15c93c36c142fa7f6fd7ceb Mon Sep 17 00:00:00 2001 From: Alexander Burchenko Date: Tue, 22 Nov 2022 14:26:26 +0200 Subject: [PATCH 21/51] boltons: ecoutils - fix stubtest errors --- stubs/boltons/boltons/ecoutils.pyi | 45 +++++++++++++++++------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/stubs/boltons/boltons/ecoutils.pyi b/stubs/boltons/boltons/ecoutils.pyi index 069f6d419ffa..f2138c3b8403 100644 --- a/stubs/boltons/boltons/ecoutils.pyi +++ b/stubs/boltons/boltons/ecoutils.pyi @@ -2,28 +2,33 @@ from typing import Any, NoReturn -# ECO_VERSION: str -# PY_GT_2: Incomplete -# getrandbits: Incomplete -# HAVE_URANDOM: bool -# INSTANCE_ID: Incomplete -# IS_64BIT: Incomplete -# HAVE_UCS4: Incomplete -# HAVE_READLINE: bool -# SQLITE_VERSION: Incomplete -# OPENSSL_VERSION: Incomplete -# TKINTER_VERSION: Incomplete -# ZLIB_VERSION: Incomplete -# EXPAT_VERSION: Incomplete -# CPU_COUNT: Incomplete -# HAVE_THREADING: bool -# HAVE_IPV6: Incomplete -# RLIMIT_NOFILE: Incomplete -# RLIMIT_FDS_SOFT: Incomplete -# RLIMIT_FDS_HARD: Incomplete -# START_TIME_INFO: Incomplete +ECO_VERSION: str +PY_GT_2: bool +getrandbits: int +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 get_python_info() -> dict[str, Any]: ... def get_profile(**kwargs) -> dict[str, Any]: ... def get_profile_json(indent: bool = ...) -> str: ... def main() -> NoReturn: ... +def dumps(val: Any, indent: int) -> str: ... + +# def _escape_shell_args(args, sep=' ', style=None) -> str: ... +# def _args2sh(args, sep=' ') -> str: ... +# def _args2cmd(args, sep=' ') -> str: ... From 8dd781be206e83ffc6fac1179cae7bebb14ef281 Mon Sep 17 00:00:00 2001 From: Alexander Burchenko Date: Tue, 22 Nov 2022 14:29:24 +0200 Subject: [PATCH 22/51] boltons: annotated - cacheutils, fileutils, formatutils, statsutils, strutils --- stubs/boltons/boltons/cacheutils.pyi | 30 ++++---- stubs/boltons/boltons/fileutils.pyi | 96 +++++++++++++----------- stubs/boltons/boltons/formatutils.pyi | 8 +- stubs/boltons/boltons/statsutils.pyi | 103 ++++++++++++++------------ stubs/boltons/boltons/strutils.pyi | 27 +++---- 5 files changed, 145 insertions(+), 119 deletions(-) diff --git a/stubs/boltons/boltons/cacheutils.pyi b/stubs/boltons/boltons/cacheutils.pyi index 168bd117731f..623ee577aa6c 100644 --- a/stubs/boltons/boltons/cacheutils.pyi +++ b/stubs/boltons/boltons/cacheutils.pyi @@ -1,24 +1,28 @@ from _typeshed import Incomplete -from collections.abc import Generator -from typing import Any +from collections.abc import Callable, Generator +from typing import Any, NoReturn, TypeVar + +_KT = TypeVar("_KT") +_VT = TypeVar("_VT") +# _T = TypeVar("_T") xrange = range basestring: Any -PREV: Incomplete -NEXT: Incomplete -KEY: Incomplete -VALUE: Incomplete +PREV: int +NEXT: int +KEY: int +VALUE: int DEFAULT_MAX_SIZE: int -class LRI(dict[Incomplete, Incomplete]): +class LRI(dict[_KT, _VT]): hit_count: int - max_size: Incomplete - on_miss: Incomplete - def __init__(self, max_size=..., values: Incomplete | None = ..., on_miss: Incomplete | None = ...) -> None: ... - def __setitem__(self, key, value) -> None: ... - def __getitem__(self, key): ... + max_size: int + on_miss: Callable[[_KT], _VT] + def __init__(self, max_size: int = ..., values: _VT | None = ..., on_miss: Callable[[_KT], _VT] | None = ...) -> NoReturn: ... + def __setitem__(self, key: _KT, value: _VT) -> NoReturn: ... + def __getitem__(self, key: _KT) -> _VT: ... def get(self, key, default: Incomplete | None = ...): ... - def __delitem__(self, key) -> None: ... + def __delitem__(self, key: _KT) -> NoReturn: ... def pop(self, key, default=...): ... def popitem(self): ... def clear(self) -> None: ... diff --git a/stubs/boltons/boltons/fileutils.pyi b/stubs/boltons/boltons/fileutils.pyi index a41a4cd2e0e5..d1f427eb6b22 100644 --- a/stubs/boltons/boltons/fileutils.pyi +++ b/stubs/boltons/boltons/fileutils.pyi @@ -1,66 +1,78 @@ -from _typeshed import Incomplete -from collections.abc import Generator +from _typeshed import Incomplete, StrOrBytesPath +from collections.abc import Callable, Generator, Iterable +from types import TracebackType +from typing import IO, Any, NoReturn +from typing_extensions import TypeAlias -def mkdir_p(path) -> None: ... +_PathReturn: TypeAlias = Any + +def mkdir_p(path: StrOrBytesPath) -> NoReturn: ... class FilePerms: - class _FilePermProperty: - attribute: Incomplete - offset: Incomplete - def __init__(self, attribute, offset) -> None: ... - def __get__(self, fp_obj, type_: Incomplete | None = ...): ... - def __set__(self, fp_obj, value): ... - user: Incomplete - group: Incomplete - other: Incomplete + # class _FilePermProperty: + # attribute: Incomplete + # offset: Incomplete + # def __init__(self, attribute, offset) -> None: ... + # def __get__(self, fp_obj, type_: Incomplete | None = ...): ... + # def __set__(self, fp_obj, value): ... + user: str + group: str + other: str def __init__(self, user: str = ..., group: str = ..., other: str = ...) -> None: ... @classmethod - def from_int(cls, i): ... + def from_int(cls, i: int) -> FilePerms: ... @classmethod - def from_path(cls, path): ... - def __int__(self): ... + def from_path(cls, path: StrOrBytesPath) -> FilePerms: ... + def __int__(self) -> int: ... -def atomic_save(dest_path, **kwargs): ... +def atomic_save(dest_path: str, **kwargs) -> AtomicSaver: ... class AtomicSaver: - dest_path: Incomplete - overwrite: Incomplete - file_perms: Incomplete - overwrite_part: Incomplete - part_filename: Incomplete - rm_part_on_exc: Incomplete - text_mode: Incomplete - buffering: Incomplete - dest_dir: Incomplete - part_path: Incomplete - mode: Incomplete - open_flags: Incomplete - part_file: Incomplete - def __init__(self, dest_path, **kwargs) -> None: ... - def setup(self) -> None: ... - def __enter__(self): ... - def __exit__(self, exc_type, exc_val, exc_tb) -> None: ... + 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: StrOrBytesPath + part_path: StrOrBytesPath + mode: str + open_flags: int + part_file: str + def __init__(self, dest_path: str, **kwargs) -> NoReturn: ... + def setup(self) -> NoReturn: ... + def __enter__(self) -> IO[Any] | None: ... + def __exit__( + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + ) -> NoReturn: ... def iter_find_files( - directory, patterns, ignored: Incomplete | None = ..., include_dirs: bool = ... -) -> Generator[Incomplete, None, None]: ... -def copy_tree(src, dst, symlinks: bool = ..., ignore: Incomplete | None = ...): ... + directory: str, patterns: str | list[Any], ignored: str | list[Any] | None = ..., include_dirs: bool = ... +) -> Generator[str, None, None]: ... +def copy_tree( + src: StrOrBytesPath, + dst: StrOrBytesPath, + symlinks: bool = ..., + ignore: None | Callable[[str, list[str]], Iterable[str]] | Callable[[StrOrBytesPath, list[str]], Iterable[str]] = ..., +) -> _PathReturn: ... copytree = copy_tree file = object class DummyFile(file): - name: Incomplete - mode: Incomplete + name: str + mode: str closed: bool - errors: Incomplete + errors: list[str] isatty: bool - encoding: Incomplete - newlines: Incomplete + encoding: str + newlines: list[str] softspace: int def __init__(self, path, mode: str = ..., buffering: Incomplete | None = ...) -> None: ... def close(self) -> None: ... - def fileno(self): ... + def fileno(self) -> int: ... def flush(self) -> None: ... def next(self) -> None: ... def read(self, size: int = ...): ... diff --git a/stubs/boltons/boltons/formatutils.pyi b/stubs/boltons/boltons/formatutils.pyi index eda26d02411f..2755a5db210e 100644 --- a/stubs/boltons/boltons/formatutils.pyi +++ b/stubs/boltons/boltons/formatutils.pyi @@ -1,10 +1,10 @@ from _typeshed import Incomplete -unicode = str +# unicode = str -def construct_format_field_str(fname, fspec, conv): ... -def infer_positional_format_args(fstr): ... -def get_format_args(fstr): ... +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): ... def tokenize_format_str(fstr, resolve_pos: bool = ...): ... class BaseFormatField: diff --git a/stubs/boltons/boltons/statsutils.pyi b/stubs/boltons/boltons/statsutils.pyi index 74009090e95a..97aa780a8228 100644 --- a/stubs/boltons/boltons/statsutils.pyi +++ b/stubs/boltons/boltons/statsutils.pyi @@ -1,55 +1,64 @@ -from _typeshed import Incomplete +# TODO: DONE! + +from collections.abc import Callable, Iterator +from typing import Any, NoReturn class _StatsProperty: - name: Incomplete - func: Incomplete - internal_name: Incomplete - __doc__: Incomplete - def __init__(self, name, func) -> None: ... - def __get__(self, obj, objtype: Incomplete | None = ...): ... + name: str + func: Callable[..., Any] + internal_name: str + __doc__: str | None + def __init__(self, name: str, func: Callable[..., Any]) -> NoReturn: ... + def __get__(self, obj: object, objtype: Any | None = ...) -> Any: ... class Stats: - data: Incomplete - default: Incomplete - def __init__(self, data, default: float = ..., use_copy: bool = ..., is_sorted: bool = ...) -> None: ... - def __len__(self): ... - def __iter__(self): ... - def clear_cache(self) -> None: ... - count: Incomplete - mean: Incomplete - max: Incomplete - min: Incomplete - median: Incomplete - iqr: Incomplete - trimean: Incomplete - variance: Incomplete - std_dev: Incomplete - median_abs_dev: Incomplete - mad: Incomplete - rel_std_dev: Incomplete - skewness: Incomplete - kurtosis: Incomplete - pearson_type: Incomplete - def get_quantile(self, q): ... - def get_zscore(self, value): ... - def trim_relative(self, amount: float = ...) -> None: ... - def get_histogram_counts(self, bins: Incomplete | None = ..., **kw): ... - def format_histogram(self, bins: Incomplete | None = ..., **kw): ... - def describe(self, quantiles: Incomplete | None = ..., format: Incomplete | None = ...): ... + data: list[int | float] + default: float + def __init__( + self, data: list[int | float], default: float = ..., use_copy: bool = ..., is_sorted: bool = ... + ) -> NoReturn: ... + def __len__(self) -> int: ... + def __iter__(self) -> Iterator[Any]: ... + def clear_cache(self) -> NoReturn: ... + 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 = ...) -> NoReturn: ... + def get_histogram_counts(self, bins: int | None = ..., **kw) -> int: ... + def format_histogram(self, bins: int | None = ..., **kw) -> str: ... + def describe(self, quantiles: list[float] | None = ..., format: str | None = ...) -> dict[str, float] | list[float] | str: ... -def describe(data, quantiles: Incomplete | None = ..., format: Incomplete | None = ...): ... +def describe( + data: list[int | float], quantiles: list[float] | None = ..., format: str | None = ... +) -> dict[str, float] | list[float] | str: ... # func: Incomplete -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 +mean: Any +median: Any +iqr: Any +trimean: Any +variance: Any +std_dev: Any +median_abs_dev: Any +rel_std_dev: Any +skewness: Any +kurtosis: Any +pearson_type: Any -def format_histogram_counts(bin_counts, width: Incomplete | None = ..., format_bin: Incomplete | None = ...): ... +def format_histogram_counts( + bin_counts: list[int | float], width: int | None = ..., format_bin: Callable[..., Any] | None = ... +) -> str: ... diff --git a/stubs/boltons/boltons/strutils.pyi b/stubs/boltons/boltons/strutils.pyi index 00538c975689..3ce2a18adec5 100644 --- a/stubs/boltons/boltons/strutils.pyi +++ b/stubs/boltons/boltons/strutils.pyi @@ -1,21 +1,22 @@ from _typeshed import Incomplete -from collections.abc import Generator +from collections.abc import Generator, Iterable from html.parser import HTMLParser +from typing import Any unichr = chr -def camel2under(camel_string): ... -def under2camel(under_string): ... -def slugify(text, delim: str = ..., lower: bool = ..., ascii: bool = ...): ... -def split_punct_ws(text): ... -def unit_len(sized_iterable, unit_noun: str = ...): ... -def ordinalize(number, ext_only: bool = ...): ... -def cardinalize(unit_noun, count): ... -def singularize(word): ... -def pluralize(word): ... -def find_hashtags(string): ... -def a10n(string): ... -def strip_ansi(text): ... +def camel2under(camel_string: str) -> str: ... +def under2camel(under_string: str) -> str: ... +def slugify(text: str, delim: str = ..., lower: bool = ..., ascii: bool = ...) -> str: ... +def split_punct_ws(text: str) -> str: ... +def unit_len(sized_iterable: Iterable[Any], unit_noun: str = ...) -> str: ... +def ordinalize(number: int | str, ext_only: bool = ...) -> 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, ignore: bool = ...): ... def is_ascii(text): ... From dc819d46a7fc7b24d24242590d54ab997de08ef0 Mon Sep 17 00:00:00 2001 From: Alexander Burchenko Date: Tue, 22 Nov 2022 14:46:00 +0200 Subject: [PATCH 23/51] boltons(cacheutils): fix pyright errors --- stubs/boltons/boltons/cacheutils.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stubs/boltons/boltons/cacheutils.pyi b/stubs/boltons/boltons/cacheutils.pyi index 623ee577aa6c..247f3942a555 100644 --- a/stubs/boltons/boltons/cacheutils.pyi +++ b/stubs/boltons/boltons/cacheutils.pyi @@ -18,7 +18,7 @@ class LRI(dict[_KT, _VT]): hit_count: int max_size: int on_miss: Callable[[_KT], _VT] - def __init__(self, max_size: int = ..., values: _VT | None = ..., on_miss: Callable[[_KT], _VT] | None = ...) -> NoReturn: ... + def __init__(self, max_size: int = ..., values: Incomplete | None = ..., on_miss: Incomplete | None = ...) -> NoReturn: ... def __setitem__(self, key: _KT, value: _VT) -> NoReturn: ... def __getitem__(self, key: _KT) -> _VT: ... def get(self, key, default: Incomplete | None = ...): ... @@ -32,7 +32,7 @@ class LRI(dict[_KT, _VT]): def __eq__(self, other): ... def __ne__(self, other): ... -class LRU(LRI): +class LRU(LRI[Any, Any]): def __getitem__(self, key): ... class _HashedKey(list[Incomplete]): From f661197d0d8f51436ddfd65a8f8385e2b1beac27 Mon Sep 17 00:00:00 2001 From: Alexander Burchenko Date: Tue, 22 Nov 2022 14:51:22 +0200 Subject: [PATCH 24/51] boltons(ecoutils): fix stubtest errors --- stubs/boltons/@tests/stubtest_allowlist.txt | 2 +- stubs/boltons/boltons/ecoutils.pyi | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/stubs/boltons/@tests/stubtest_allowlist.txt b/stubs/boltons/@tests/stubtest_allowlist.txt index eb8bcf9b179e..85de33b9df42 100644 --- a/stubs/boltons/@tests/stubtest_allowlist.txt +++ b/stubs/boltons/@tests/stubtest_allowlist.txt @@ -4,4 +4,4 @@ boltons.strutils.int_list_to_int_tuples # Bug in boltons https://github.com/mahmoud/boltons/issues/294 # This bug is fixed only in the development version (on github). # In the PyPI repository version the bug is not fixed -boltons.ecoutils +# boltons.ecoutils diff --git a/stubs/boltons/boltons/ecoutils.pyi b/stubs/boltons/boltons/ecoutils.pyi index f2138c3b8403..9d0f9f538ff5 100644 --- a/stubs/boltons/boltons/ecoutils.pyi +++ b/stubs/boltons/boltons/ecoutils.pyi @@ -4,7 +4,7 @@ from typing import Any, NoReturn ECO_VERSION: str PY_GT_2: bool -getrandbits: int +getrandbits: Any HAVE_URANDOM: bool INSTANCE_ID: str IS_64BIT: bool @@ -27,8 +27,8 @@ def get_python_info() -> dict[str, Any]: ... def get_profile(**kwargs) -> dict[str, Any]: ... def get_profile_json(indent: bool = ...) -> str: ... def main() -> NoReturn: ... -def dumps(val: Any, indent: int) -> str: ... +# def dumps(val: Any, indent: int) -> str: ... # def _escape_shell_args(args, sep=' ', style=None) -> str: ... # def _args2sh(args, sep=' ') -> str: ... # def _args2cmd(args, sep=' ') -> str: ... From d58eefa23fc9a7c03ff8adb1878da5c2eaba6421 Mon Sep 17 00:00:00 2001 From: Alexander Burchenko Date: Sat, 26 Nov 2022 19:40:01 +0200 Subject: [PATCH 25/51] boltons(ecoutils): fexed --- stubs/boltons/@tests/stubtest_allowlist.txt | 5 +++++ stubs/boltons/boltons/ecoutils.pyi | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/stubs/boltons/@tests/stubtest_allowlist.txt b/stubs/boltons/@tests/stubtest_allowlist.txt index 85de33b9df42..c6d348cd1a07 100644 --- a/stubs/boltons/@tests/stubtest_allowlist.txt +++ b/stubs/boltons/@tests/stubtest_allowlist.txt @@ -1,6 +1,11 @@ boltons.strutils.int_list_complement boltons.strutils.int_list_to_int_tuples +# But stubtest complains about runtime +# def dumps(val: Any, indent: int) -> str: ... +boltons.ecoutils + + # Bug in boltons https://github.com/mahmoud/boltons/issues/294 # This bug is fixed only in the development version (on github). # In the PyPI repository version the bug is not fixed diff --git a/stubs/boltons/boltons/ecoutils.pyi b/stubs/boltons/boltons/ecoutils.pyi index 9d0f9f538ff5..3582f6b41819 100644 --- a/stubs/boltons/boltons/ecoutils.pyi +++ b/stubs/boltons/boltons/ecoutils.pyi @@ -4,7 +4,6 @@ from typing import Any, NoReturn ECO_VERSION: str PY_GT_2: bool -getrandbits: Any HAVE_URANDOM: bool INSTANCE_ID: str IS_64BIT: bool @@ -23,12 +22,13 @@ 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 = ...) -> str: ... def main() -> NoReturn: ... +def dumps(val: Any, indent: int) -> str: ... -# def dumps(val: Any, indent: int) -> str: ... # def _escape_shell_args(args, sep=' ', style=None) -> str: ... # def _args2sh(args, sep=' ') -> str: ... # def _args2cmd(args, sep=' ') -> str: ... From ed0633e171d2f104301b10ae695641a972680cc0 Mon Sep 17 00:00:00 2001 From: Alexander Burchenko Date: Sat, 26 Nov 2022 19:45:56 +0200 Subject: [PATCH 26/51] boltons: fix flake8 errors --- stubs/boltons/boltons/statsutils.pyi | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/stubs/boltons/boltons/statsutils.pyi b/stubs/boltons/boltons/statsutils.pyi index 97aa780a8228..693f8f6ee717 100644 --- a/stubs/boltons/boltons/statsutils.pyi +++ b/stubs/boltons/boltons/statsutils.pyi @@ -12,11 +12,9 @@ class _StatsProperty: def __get__(self, obj: object, objtype: Any | None = ...) -> Any: ... class Stats: - data: list[int | float] + data: list[float] default: float - def __init__( - self, data: list[int | float], default: float = ..., use_copy: bool = ..., is_sorted: bool = ... - ) -> NoReturn: ... + def __init__(self, data: list[float], default: float = ..., use_copy: bool = ..., is_sorted: bool = ...) -> NoReturn: ... def __len__(self) -> int: ... def __iter__(self) -> Iterator[Any]: ... def clear_cache(self) -> NoReturn: ... @@ -43,7 +41,7 @@ class Stats: def describe(self, quantiles: list[float] | None = ..., format: str | None = ...) -> dict[str, float] | list[float] | str: ... def describe( - data: list[int | float], quantiles: list[float] | None = ..., format: str | None = ... + data: list[float], quantiles: list[float] | None = ..., format: str | None = ... ) -> dict[str, float] | list[float] | str: ... # func: Incomplete @@ -60,5 +58,5 @@ kurtosis: Any pearson_type: Any def format_histogram_counts( - bin_counts: list[int | float], width: int | None = ..., format_bin: Callable[..., Any] | None = ... + bin_counts: list[float], width: int | None = ..., format_bin: Callable[..., Any] | None = ... ) -> str: ... From 3c35bb51d0aca7ff2db580f5f2e2ed8d280ac262 Mon Sep 17 00:00:00 2001 From: Alexander Burchenko Date: Sat, 26 Nov 2022 19:50:00 +0200 Subject: [PATCH 27/51] boltons: fix allowlist --- stubs/boltons/@tests/stubtest_allowlist.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stubs/boltons/@tests/stubtest_allowlist.txt b/stubs/boltons/@tests/stubtest_allowlist.txt index c6d348cd1a07..263630843c4e 100644 --- a/stubs/boltons/@tests/stubtest_allowlist.txt +++ b/stubs/boltons/@tests/stubtest_allowlist.txt @@ -3,10 +3,10 @@ boltons.strutils.int_list_to_int_tuples # But stubtest complains about runtime # def dumps(val: Any, indent: int) -> str: ... -boltons.ecoutils +boltons.ecoutils.dumps # Bug in boltons https://github.com/mahmoud/boltons/issues/294 # This bug is fixed only in the development version (on github). # In the PyPI repository version the bug is not fixed -# boltons.ecoutils +boltons.ecoutils From 6725d8612e92d68cc62ffac8ffcdabe006029416 Mon Sep 17 00:00:00 2001 From: Alexander Burchenko Date: Sun, 27 Nov 2022 21:52:09 +0200 Subject: [PATCH 28/51] boltons: types annotated for dictutils, fileutils, gcutils, mathutils, strutils, timeutils --- stubs/boltons/boltons/dictutils.pyi | 9 ++- stubs/boltons/boltons/fileutils.pyi | 34 +++++----- stubs/boltons/boltons/formatutils.pyi | 55 ++++++++------- stubs/boltons/boltons/gcutils.pyi | 20 +++--- stubs/boltons/boltons/mathutils.pyi | 45 ++++++------ stubs/boltons/boltons/strutils.pyi | 70 ++++++++++--------- stubs/boltons/boltons/timeutils.pyi | 98 ++++++++++++++------------- 7 files changed, 175 insertions(+), 156 deletions(-) diff --git a/stubs/boltons/boltons/dictutils.pyi b/stubs/boltons/boltons/dictutils.pyi index 50e28c93a2ec..dcafb4b0b6cc 100644 --- a/stubs/boltons/boltons/dictutils.pyi +++ b/stubs/boltons/boltons/dictutils.pyi @@ -1,10 +1,9 @@ -from _typeshed import Incomplete +# TODO: DONE! + from collections.abc import Generator, Hashable, ItemsView, Iterable, KeysView, ValuesView from typing import Any, NoReturn, TypeVar from typing_extensions import TypeAlias -def __getattr__(name: str) -> Any: ... # incomplete - _KT = TypeVar("_KT") _VT = TypeVar("_VT") @@ -46,7 +45,7 @@ class FastIterOrderedMultiDict(OrderedMultiDict[_KT, _VT]): # undocumented def iterkeys(self, multi: bool = ...) -> Generator[_KT, None, None]: ... class OneToOne(dict[_KT, _VT]): - inv: Incomplete + inv: dict[_VT, _KT] def clear(self) -> None: ... def copy(self) -> OneToOne[_KT, _VT]: ... def pop(self, key: _KT, default: _VT = ...) -> _VT: ... # type: ignore @@ -62,7 +61,7 @@ class ManyToMany: def __delitem__(self, key) -> None: ... def __eq__(self, other): ... def __getitem__(self, key): ... - def __init__(self, items: Incomplete | None = ...) -> None: ... + def __init__(self, items: Iterable[object] | None = ...) -> None: ... def __iter__(self): ... def __len__(self): ... def __setitem__(self, key, vals) -> None: ... diff --git a/stubs/boltons/boltons/fileutils.pyi b/stubs/boltons/boltons/fileutils.pyi index d1f427eb6b22..15b19dbd2d85 100644 --- a/stubs/boltons/boltons/fileutils.pyi +++ b/stubs/boltons/boltons/fileutils.pyi @@ -1,4 +1,6 @@ -from _typeshed import Incomplete, StrOrBytesPath +# TODO: DONE! + +from _typeshed import StrOrBytesPath from collections.abc import Callable, Generator, Iterable from types import TracebackType from typing import IO, Any, NoReturn @@ -70,19 +72,19 @@ class DummyFile(file): encoding: str newlines: list[str] softspace: int - def __init__(self, path, mode: str = ..., buffering: Incomplete | None = ...) -> None: ... - def close(self) -> None: ... + def __init__(self, path: StrOrBytesPath, mode: str = ..., buffering: int | None = ...) -> None: ... + def close(self) -> NoReturn: ... def fileno(self) -> int: ... - def flush(self) -> None: ... - def next(self) -> None: ... - def read(self, size: int = ...): ... - def readline(self, size: int = ...): ... - def readlines(self, size: int = ...): ... - def seek(self) -> None: ... - def tell(self): ... - def truncate(self) -> None: ... - def write(self, string) -> None: ... - def writelines(self, list_of_strings) -> None: ... - def __next__(self) -> None: ... - def __enter__(self) -> None: ... - def __exit__(self, exc_type, exc_val, exc_tb) -> None: ... + def flush(self) -> NoReturn: ... + def next(self) -> NoReturn: ... + def read(self, size: int = ...) -> str: ... + def readline(self, size: int = ...) -> str: ... + def readlines(self, size: int = ...) -> list[str]: ... + def seek(self) -> NoReturn: ... + def tell(self) -> int: ... + def truncate(self) -> NoReturn: ... + def write(self, string: str) -> NoReturn: ... + def writelines(self, list_of_strings: list[str]) -> None: ... + def __next__(self) -> NoReturn: ... + def __enter__(self) -> NoReturn: ... + def __exit__(self, exc_type, exc_val, exc_tb) -> NoReturn: ... diff --git a/stubs/boltons/boltons/formatutils.pyi b/stubs/boltons/boltons/formatutils.pyi index 2755a5db210e..c5e7379411b5 100644 --- a/stubs/boltons/boltons/formatutils.pyi +++ b/stubs/boltons/boltons/formatutils.pyi @@ -1,36 +1,39 @@ -from _typeshed import Incomplete +# TODO: DONE! + +from collections.abc import Callable +from typing import Any, NoReturn # unicode = str 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): ... -def tokenize_format_str(fstr, resolve_pos: bool = ...): ... +def get_format_args(fstr: str) -> tuple[list[str]]: ... +def tokenize_format_str(fstr: str, resolve_pos: bool = ...) -> list[str]: ... class BaseFormatField: - def __init__(self, fname, fspec: str = ..., conv: Incomplete | None = ...) -> None: ... - base_name: Incomplete - fname: Incomplete - subpath: Incomplete - is_positional: Incomplete - def set_fname(self, fname) -> None: ... - subfields: Incomplete - fspec: Incomplete - type_char: Incomplete - type_func: Incomplete - def set_fspec(self, fspec) -> None: ... - conv: Incomplete - conv_func: Incomplete - def set_conv(self, conv) -> None: ... + def __init__(self, fname: str, fspec: str = ..., conv: str | None = ...) -> None: ... + base_name: str + fname: str + subpath: str + is_positional: bool + def set_fname(self, fname: str) -> NoReturn: ... + subfields: list[str] + fspec: str + type_char: str + type_func: str + def set_fspec(self, fspec) -> NoReturn: ... + conv: str + conv_func: str | None + def set_conv(self, conv: str) -> NoReturn: ... @property - def fstr(self): ... + def fstr(self) -> str: ... class DeferredValue: - func: Incomplete - cache_value: Incomplete - def __init__(self, func, cache_value: bool = ...) -> None: ... - def get_value(self): ... - def __int__(self): ... - def __float__(self): ... - def __unicode__(self): ... - def __format__(self, fmt): ... + func: Callable[..., Any] + cache_value: bool + def __init__(self, func: Callable[..., Any], cache_value: bool = ...) -> NoReturn: ... + def get_value(self) -> Any: ... + def __int__(self) -> int: ... + def __float__(self) -> float: ... + def __unicode__(self) -> str: ... + def __format__(self, fmt: str) -> str: ... diff --git a/stubs/boltons/boltons/gcutils.pyi b/stubs/boltons/boltons/gcutils.pyi index a14616aecf2d..7de5a26b5c61 100644 --- a/stubs/boltons/boltons/gcutils.pyi +++ b/stubs/boltons/boltons/gcutils.pyi @@ -1,12 +1,16 @@ -from _typeshed import Incomplete +# TODO: DONE! -def get_all(type_obj, include_subtypes: bool = ...): ... +from typing import NoReturn, TypeVar + +_T = TypeVar("_T") + +def get_all(type_obj: _T, include_subtypes: bool = ...) -> list[_T]: ... class GCToggler: - postcollect: Incomplete - def __init__(self, postcollect: bool = ...) -> None: ... - def __enter__(self) -> None: ... - def __exit__(self, exc_type, exc_val, exc_tb) -> None: ... + postcollect: bool + def __init__(self, postcollect: bool = ...) -> NoReturn: ... + def __enter__(self) -> NoReturn: ... + def __exit__(self, exc_type, exc_val, exc_tb) -> NoReturn: ... -toggle_gc: Incomplete -toggle_gc_postcollect: Incomplete +toggle_gc: GCToggler +toggle_gc_postcollect: GCToggler diff --git a/stubs/boltons/boltons/mathutils.pyi b/stubs/boltons/boltons/mathutils.pyi index 5b5ce83eb7ac..0cd4913e99a9 100644 --- a/stubs/boltons/boltons/mathutils.pyi +++ b/stubs/boltons/boltons/mathutils.pyi @@ -1,29 +1,32 @@ -from _typeshed import Incomplete +# TODO: DONE! -def clamp(x, lower=..., upper=...): ... -def ceil(x, options: Incomplete | None = ...): ... -def floor(x, options: Incomplete | None = ...): ... +from collections.abc import Iterable +from typing import NoReturn + +def clamp(x: float, lower: float = ..., upper: float = ...) -> float: ... +def ceil(x: float, options: Iterable[float] | None = ...) -> float: ... +def floor(x: float, options: Iterable[float] | None = ...) -> float: ... # bytes = str unicode = str class Bits: - val: Incomplete - len: Incomplete - def __init__(self, val: int = ..., len_: Incomplete | None = ...) -> None: ... - def __getitem__(self, k): ... - def __len__(self): ... - def __eq__(self, other): ... - def __or__(self, other): ... - def __and__(self, other): ... - def __lshift__(self, other): ... - def __rshift__(self, other): ... - def __hash__(self): ... - def as_list(self): ... - def as_bin(self): ... - def as_hex(self): ... - def as_int(self): ... - def as_bytes(self): ... + val: int | list[bool] | str + len: int + def __init__(self, val: int | list[bool] | str = ..., len_: int | None = ...) -> NoReturn: ... + def __getitem__(self, k) -> Bits | bool: ... + def __len__(self) -> int: ... + def __eq__(self, other) -> bool: ... + def __or__(self, other) -> bool: ... + def __and__(self, other) -> bool: ... + def __lshift__(self, other) -> Bits: ... + def __rshift__(self, other) -> 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 @@ -31,6 +34,6 @@ class Bits: @classmethod def from_hex(cls, hex): ... @classmethod - def from_int(cls, int_, len_: Incomplete | None = ...): ... + def from_int(cls, int_, len_: int | None = ...): ... @classmethod def from_bytes(cls, bytes_): ... diff --git a/stubs/boltons/boltons/strutils.pyi b/stubs/boltons/boltons/strutils.pyi index 3ce2a18adec5..55b10880aa5d 100644 --- a/stubs/boltons/boltons/strutils.pyi +++ b/stubs/boltons/boltons/strutils.pyi @@ -1,7 +1,11 @@ -from _typeshed import Incomplete -from collections.abc import Generator, Iterable +# TODO: DONE! + +from collections.abc import Callable, Generator, Iterable from html.parser import HTMLParser -from typing import Any +from typing import Any, NoReturn, TypeVar + +_KT = TypeVar("_KT") +_VT = TypeVar("_VT") unichr = chr @@ -17,45 +21,45 @@ 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, ignore: bool = ...): ... -def is_ascii(text): ... +def asciify(text: str, ignore: bool = ...): ... +def is_ascii(text: str) -> bool: ... -class DeaccenterDict(dict[Incomplete, Incomplete]): - def __missing__(self, key): ... - def __getitem__(self, key): ... +class DeaccenterDict(dict[_KT, _VT]): + def __missing__(self, key: _KT) -> _VT: ... + def __getitem__(self, key: _KT) -> _VT: ... -def bytes2human(nbytes, ndigits: int = ...): ... +def bytes2human(nbytes: int, ndigits: int = ...) -> str: ... class HTMLTextExtractor(HTMLParser): strict: bool convert_charrefs: bool - result: Incomplete - def __init__(self) -> None: ... - def handle_data(self, d) -> None: ... - def handle_charref(self, number) -> None: ... - def handle_entityref(self, name) -> None: ... - def get_text(self): ... - -def html2text(html): ... -def gunzip_bytes(bytestring): ... -def gzip_bytes(bytestring, level: int = ...): ... -def iter_splitlines(text) -> Generator[Incomplete, None, None]: ... -def indent(text, margin, newline: str = ..., key=...): ... -def is_uuid(obj, version: int = ...): ... -def escape_shell_args(args, sep: str = ..., style: Incomplete | None = ...): ... -def args2sh(args, sep: str = ...): ... -def args2cmd(args, sep: str = ...): ... -def parse_int_list(range_string, delim: str = ..., range_delim: str = ...): ... -def format_int_list(int_list, delim: str = ..., range_delim: str = ..., delim_space: bool = ...): ... + result: list[str] + def __init__(self) -> NoReturn: ... + def handle_data(self, d: str) -> NoReturn: ... + def handle_charref(self, number: str) -> NoReturn: ... + def handle_entityref(self, name: str) -> NoReturn: ... + def get_text(self) -> str: ... + +def html2text(html: str) -> str: ... +def gunzip_bytes(bytestring: bytes) -> bytes: ... +def gzip_bytes(bytestring: bytes, level: int = ...) -> int: ... +def iter_splitlines(text: str) -> Generator[str, None, None]: ... +def indent(text: str, margin: str, newline: str = ..., key: Callable[..., bool] = ...) -> str: ... +def is_uuid(obj, version: int = ...) -> bool: ... +def escape_shell_args(args: list[str], sep: str = ..., style: str | 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 = ...) -> str: ... class MultiReplace: - group_map: Incomplete - combined_pattern: Incomplete - def __init__(self, sub_map, **kwargs) -> None: ... - def sub(self, text): ... + group_map: dict[str, str] + combined_pattern: str + def __init__(self, sub_map: dict[str, str], **kwargs) -> NoReturn: ... + def sub(self, text: str) -> str: ... -def multi_replace(text, sub_map, **kwargs): ... -def unwrap_text(text, ending: str = ...): ... +def multi_replace(text: str, sub_map: dict[str, str], **kwargs) -> str: ... +def unwrap_text(text: str, ending: str = ...) -> str: ... # Names in __all__ with no definition: # int_list_complement diff --git a/stubs/boltons/boltons/timeutils.pyi b/stubs/boltons/boltons/timeutils.pyi index 9eb12904cc68..9a1cd5b2eac9 100644 --- a/stubs/boltons/boltons/timeutils.pyi +++ b/stubs/boltons/boltons/timeutils.pyi @@ -1,61 +1,65 @@ -from _typeshed import Incomplete +# TODO: DONE! + from collections.abc import Generator -from datetime import tzinfo +from datetime import date, datetime, timedelta, tzinfo +from typing import NoReturn -def total_seconds(td): ... -def dt_to_timestamp(dt): ... -def isoparse(iso_str): ... -def parse_timedelta(text): ... +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, other: Incomplete | None = ..., ndigits: int = ..., cardinalize: bool = ...): ... -def relative_time(d, other: Incomplete | None = ..., ndigits: int = ...): ... -def strpdate(string, format): ... -def daterange(start, stop, step: int = ..., inclusive: bool = ...) -> Generator[Incomplete, None, Incomplete]: ... +def decimal_relative_time( + d: datetime, other: datetime | None = ..., ndigits: int = ..., cardinalize: bool = ... +) -> tuple[float, str]: ... +def relative_time(d: datetime, other: datetime | None = ..., ndigits: int = ...) -> str: ... +def strpdate(string: str, format: str) -> date: ... +def daterange(start: date, stop: date, step: int = ..., inclusive: bool = ...) -> Generator[date, None, None]: ... -ZERO: Incomplete -HOUR: Incomplete +ZERO: timedelta +HOUR: timedelta class ConstantTZInfo(tzinfo): - name: Incomplete - offset: Incomplete - def __init__(self, name: str = ..., offset=...) -> None: ... + name: str + offset: timedelta + def __init__(self, name: str = ..., offset: timedelta = ...) -> NoReturn: ... @property - def utcoffset_hours(self): ... - def utcoffset(self, dt): ... - def tzname(self, dt): ... - def dst(self, dt): ... + 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: Incomplete -EPOCH_AWARE: Incomplete -EPOCH_NAIVE: Incomplete +UTC: ConstantTZInfo +EPOCH_AWARE: datetime +EPOCH_NAIVE: datetime class LocalTZInfo(tzinfo): - def is_dst(self, dt): ... - def utcoffset(self, dt): ... - def dst(self, dt): ... - def tzname(self, dt): ... - -LocalTZ: Incomplete -DSTSTART_2007: Incomplete -DSTEND_2007: Incomplete -DSTSTART_1987_2006: Incomplete -DSTEND_1987_2006: Incomplete -DSTSTART_1967_1986: Incomplete -DSTEND_1967_1986: Incomplete + 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: Incomplete - reprname: Incomplete - stdname: Incomplete - dstname: Incomplete - def __init__(self, hours, reprname, stdname, dstname) -> None: ... - def tzname(self, dt): ... - def utcoffset(self, dt): ... - def dst(self, dt): ... - -Eastern: Incomplete -Central: Incomplete -Mountain: Incomplete -Pacific: Incomplete + stdoffset: timedelta + reprname: str + stdname: str + dstname: str + def __init__(self, hours: int, reprname: str, stdname: str, dstname: str) -> NoReturn: ... + 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 From 7d808041089aa4549deca3ec5d9bb2adcf8f506a Mon Sep 17 00:00:00 2001 From: Alexander Burchenko Date: Sun, 27 Nov 2022 21:54:18 +0200 Subject: [PATCH 29/51] boltons(ecoutils): updated --- stubs/boltons/boltons/ecoutils.pyi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stubs/boltons/boltons/ecoutils.pyi b/stubs/boltons/boltons/ecoutils.pyi index 3582f6b41819..b61b2c339065 100644 --- a/stubs/boltons/boltons/ecoutils.pyi +++ b/stubs/boltons/boltons/ecoutils.pyi @@ -22,7 +22,9 @@ RLIMIT_FDS_SOFT: int RLIMIT_FDS_HARD: int START_TIME_INFO: dict[str, str | float] -def getrandbits(__k: int) -> int: ... +# def getrandbits(__k: int) -> int: ... +getrandbits: Any + def get_python_info() -> dict[str, Any]: ... def get_profile(**kwargs) -> dict[str, Any]: ... def get_profile_json(indent: bool = ...) -> str: ... From bff5263b4bcab14ffab1773b3c3b96727d7dc6ee Mon Sep 17 00:00:00 2001 From: Alexander Burchenko Date: Sun, 27 Nov 2022 21:57:37 +0200 Subject: [PATCH 30/51] boltons: fix stubtest_allowlist --- stubs/boltons/@tests/stubtest_allowlist.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/boltons/@tests/stubtest_allowlist.txt b/stubs/boltons/@tests/stubtest_allowlist.txt index 263630843c4e..1658f8f89bff 100644 --- a/stubs/boltons/@tests/stubtest_allowlist.txt +++ b/stubs/boltons/@tests/stubtest_allowlist.txt @@ -9,4 +9,4 @@ boltons.ecoutils.dumps # Bug in boltons https://github.com/mahmoud/boltons/issues/294 # This bug is fixed only in the development version (on github). # In the PyPI repository version the bug is not fixed -boltons.ecoutils +# boltons.ecoutils From a7a969cafa085cfb6dee6b69068d8e9cd649ac89 Mon Sep 17 00:00:00 2001 From: AlexWaygood Date: Sun, 11 Dec 2022 20:52:02 +0000 Subject: [PATCH 31/51] Fiddle with stubtest allowlist --- stubs/boltons/@tests/stubtest_allowlist.txt | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/stubs/boltons/@tests/stubtest_allowlist.txt b/stubs/boltons/@tests/stubtest_allowlist.txt index 1658f8f89bff..317083328bd8 100644 --- a/stubs/boltons/@tests/stubtest_allowlist.txt +++ b/stubs/boltons/@tests/stubtest_allowlist.txt @@ -1,12 +1,9 @@ +# These names exist in __all__, but have no definition: boltons.strutils.int_list_complement boltons.strutils.int_list_to_int_tuples -# But stubtest complains about runtime -# def dumps(val: Any, indent: int) -> str: ... -boltons.ecoutils.dumps - - -# Bug in boltons https://github.com/mahmoud/boltons/issues/294 +# error: boltons.ecoutils failed to import, AttributeError: module 'pprint' has no attribute '_safe_repr' +# See https://github.com/mahmoud/boltons/issues/294 # This bug is fixed only in the development version (on github). # In the PyPI repository version the bug is not fixed -# boltons.ecoutils +boltons.ecoutils From 3c5039809f1e476f4b144ea0c0d134cdd9e235ac Mon Sep 17 00:00:00 2001 From: AlexWaygood Date: Mon, 12 Dec 2022 17:02:08 +0000 Subject: [PATCH 32/51] Fix `ecotutils.getrandbits` --- stubs/boltons/boltons/ecoutils.pyi | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/stubs/boltons/boltons/ecoutils.pyi b/stubs/boltons/boltons/ecoutils.pyi index b61b2c339065..015229320be1 100644 --- a/stubs/boltons/boltons/ecoutils.pyi +++ b/stubs/boltons/boltons/ecoutils.pyi @@ -22,9 +22,7 @@ RLIMIT_FDS_SOFT: int RLIMIT_FDS_HARD: int START_TIME_INFO: dict[str, str | float] -# def getrandbits(__k: int) -> int: ... -getrandbits: Any - +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 = ...) -> str: ... From e24405ade8c22eb88f6e07bab1c9f728eb79cff4 Mon Sep 17 00:00:00 2001 From: Alexander Burchenko Date: Wed, 21 Dec 2022 03:26:04 +0100 Subject: [PATCH 33/51] remove commented-out code and unneeded TODO --- stubs/boltons/boltons/cacheutils.pyi | 1 - stubs/boltons/boltons/debugutils.pyi | 2 -- stubs/boltons/boltons/deprutils.pyi | 2 -- stubs/boltons/boltons/dictutils.pyi | 2 -- stubs/boltons/boltons/easterutils.pyi | 2 -- stubs/boltons/boltons/ecoutils.pyi | 6 ------ stubs/boltons/boltons/excutils.pyi | 22 +--------------------- stubs/boltons/boltons/fileutils.pyi | 8 -------- stubs/boltons/boltons/formatutils.pyi | 4 ---- stubs/boltons/boltons/gcutils.pyi | 2 -- stubs/boltons/boltons/jsonutils.pyi | 2 -- stubs/boltons/boltons/mathutils.pyi | 3 --- stubs/boltons/boltons/mboxutils.pyi | 2 -- stubs/boltons/boltons/namedutils.pyi | 4 ---- stubs/boltons/boltons/pathutils.pyi | 2 -- stubs/boltons/boltons/queueutils.pyi | 2 -- stubs/boltons/boltons/socketutils.pyi | 4 ---- stubs/boltons/boltons/statsutils.pyi | 3 --- stubs/boltons/boltons/strutils.pyi | 2 -- stubs/boltons/boltons/timeutils.pyi | 2 -- stubs/boltons/boltons/urlutils.pyi | 3 --- 21 files changed, 1 insertion(+), 79 deletions(-) diff --git a/stubs/boltons/boltons/cacheutils.pyi b/stubs/boltons/boltons/cacheutils.pyi index 247f3942a555..77ebe2d93e6c 100644 --- a/stubs/boltons/boltons/cacheutils.pyi +++ b/stubs/boltons/boltons/cacheutils.pyi @@ -4,7 +4,6 @@ from typing import Any, NoReturn, TypeVar _KT = TypeVar("_KT") _VT = TypeVar("_VT") -# _T = TypeVar("_T") xrange = range basestring: Any diff --git a/stubs/boltons/boltons/debugutils.pyi b/stubs/boltons/boltons/debugutils.pyi index bd0cec81fbae..356039ad00b1 100644 --- a/stubs/boltons/boltons/debugutils.pyi +++ b/stubs/boltons/boltons/debugutils.pyi @@ -1,5 +1,3 @@ -# TODO: DONE! - from typing import NoReturn def pdb_on_signal(signalnum: int | None = ...) -> NoReturn: ... diff --git a/stubs/boltons/boltons/deprutils.pyi b/stubs/boltons/boltons/deprutils.pyi index ea358706bc3b..448060b604a6 100644 --- a/stubs/boltons/boltons/deprutils.pyi +++ b/stubs/boltons/boltons/deprutils.pyi @@ -1,5 +1,3 @@ -# TODO: DONE! - from types import ModuleType from typing import Any, NoReturn diff --git a/stubs/boltons/boltons/dictutils.pyi b/stubs/boltons/boltons/dictutils.pyi index dcafb4b0b6cc..73ad79e39f7c 100644 --- a/stubs/boltons/boltons/dictutils.pyi +++ b/stubs/boltons/boltons/dictutils.pyi @@ -1,5 +1,3 @@ -# TODO: DONE! - from collections.abc import Generator, Hashable, ItemsView, Iterable, KeysView, ValuesView from typing import Any, NoReturn, TypeVar from typing_extensions import TypeAlias diff --git a/stubs/boltons/boltons/easterutils.pyi b/stubs/boltons/boltons/easterutils.pyi index 0d137b6b899a..4ccfba3eee9a 100644 --- a/stubs/boltons/boltons/easterutils.pyi +++ b/stubs/boltons/boltons/easterutils.pyi @@ -1,5 +1,3 @@ -# TODO: DONE! - from typing import NoReturn def gobs_program() -> NoReturn: ... diff --git a/stubs/boltons/boltons/ecoutils.pyi b/stubs/boltons/boltons/ecoutils.pyi index 015229320be1..3605807c74bd 100644 --- a/stubs/boltons/boltons/ecoutils.pyi +++ b/stubs/boltons/boltons/ecoutils.pyi @@ -1,5 +1,3 @@ -# TODO: DONE! - from typing import Any, NoReturn ECO_VERSION: str @@ -28,7 +26,3 @@ def get_profile(**kwargs) -> dict[str, Any]: ... def get_profile_json(indent: bool = ...) -> str: ... def main() -> NoReturn: ... def dumps(val: Any, indent: int) -> str: ... - -# def _escape_shell_args(args, sep=' ', style=None) -> str: ... -# def _args2sh(args, sep=' ') -> str: ... -# def _args2cmd(args, sep=' ') -> str: ... diff --git a/stubs/boltons/boltons/excutils.pyi b/stubs/boltons/boltons/excutils.pyi index 584bb5dfe20b..a606d4dca38b 100644 --- a/stubs/boltons/boltons/excutils.pyi +++ b/stubs/boltons/boltons/excutils.pyi @@ -1,28 +1,8 @@ -# TODO: DONE! - -from typing import Any, NamedTuple, NoReturn +from typing import Any, NoReturn class ExceptionCauseMixin(Exception): cause: Any def __new__(cls, *args, **kw) -> NoReturn: ... def get_str(self) -> str: ... -class _BaseTBItem(NamedTuple): - filename: str - lineno: int - name: str - line: str - -class _TBItem(_BaseTBItem): ... - -class _DeferredLine: - filename: str - lineno: int - module_globals: dict[Any, Any] - def __init__(self, filename: str, lineno: int, module_globals: dict[Any, Any] | None = ...) -> None: ... - def __eq__(self, other: object) -> bool: ... - def __ne__(self, other: object) -> bool: ... - def __len__(self) -> int: ... - def strip(self) -> str: ... - class MathError(ExceptionCauseMixin, ValueError): ... diff --git a/stubs/boltons/boltons/fileutils.pyi b/stubs/boltons/boltons/fileutils.pyi index 15b19dbd2d85..df2390a7f40f 100644 --- a/stubs/boltons/boltons/fileutils.pyi +++ b/stubs/boltons/boltons/fileutils.pyi @@ -1,5 +1,3 @@ -# TODO: DONE! - from _typeshed import StrOrBytesPath from collections.abc import Callable, Generator, Iterable from types import TracebackType @@ -11,12 +9,6 @@ _PathReturn: TypeAlias = Any def mkdir_p(path: StrOrBytesPath) -> NoReturn: ... class FilePerms: - # class _FilePermProperty: - # attribute: Incomplete - # offset: Incomplete - # def __init__(self, attribute, offset) -> None: ... - # def __get__(self, fp_obj, type_: Incomplete | None = ...): ... - # def __set__(self, fp_obj, value): ... user: str group: str other: str diff --git a/stubs/boltons/boltons/formatutils.pyi b/stubs/boltons/boltons/formatutils.pyi index c5e7379411b5..763260469e25 100644 --- a/stubs/boltons/boltons/formatutils.pyi +++ b/stubs/boltons/boltons/formatutils.pyi @@ -1,10 +1,6 @@ -# TODO: DONE! - from collections.abc import Callable from typing import Any, NoReturn -# unicode = str - 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[str]]: ... diff --git a/stubs/boltons/boltons/gcutils.pyi b/stubs/boltons/boltons/gcutils.pyi index 7de5a26b5c61..1a6eef3b619b 100644 --- a/stubs/boltons/boltons/gcutils.pyi +++ b/stubs/boltons/boltons/gcutils.pyi @@ -1,5 +1,3 @@ -# TODO: DONE! - from typing import NoReturn, TypeVar _T = TypeVar("_T") diff --git a/stubs/boltons/boltons/jsonutils.pyi b/stubs/boltons/boltons/jsonutils.pyi index 8559e9a1815d..3490eb42b185 100644 --- a/stubs/boltons/boltons/jsonutils.pyi +++ b/stubs/boltons/boltons/jsonutils.pyi @@ -1,5 +1,3 @@ -# TODO: DONE! - from collections.abc import Generator from typing import IO, Any, AnyStr, NoReturn diff --git a/stubs/boltons/boltons/mathutils.pyi b/stubs/boltons/boltons/mathutils.pyi index 0cd4913e99a9..e20eddcd223c 100644 --- a/stubs/boltons/boltons/mathutils.pyi +++ b/stubs/boltons/boltons/mathutils.pyi @@ -1,5 +1,3 @@ -# TODO: DONE! - from collections.abc import Iterable from typing import NoReturn @@ -7,7 +5,6 @@ def clamp(x: float, lower: float = ..., upper: float = ...) -> float: ... def ceil(x: float, options: Iterable[float] | None = ...) -> float: ... def floor(x: float, options: Iterable[float] | None = ...) -> float: ... -# bytes = str unicode = str class Bits: diff --git a/stubs/boltons/boltons/mboxutils.pyi b/stubs/boltons/boltons/mboxutils.pyi index 0d090ca008ca..1cc291314759 100644 --- a/stubs/boltons/boltons/mboxutils.pyi +++ b/stubs/boltons/boltons/mboxutils.pyi @@ -1,5 +1,3 @@ -# TODO: DONE! - import mailbox from typing import NoReturn diff --git a/stubs/boltons/boltons/namedutils.pyi b/stubs/boltons/boltons/namedutils.pyi index 89783ab80023..89c31b4cc3fd 100644 --- a/stubs/boltons/boltons/namedutils.pyi +++ b/stubs/boltons/boltons/namedutils.pyi @@ -1,6 +1,2 @@ -# TODO: DONE! - -# OrderedDict = dict - def namedtuple(typename: str, field_names: list[str], verbose: bool = ..., rename: bool = ...): ... def namedlist(typename: str, field_names: list[str], verbose: bool = ..., rename: bool = ...): ... diff --git a/stubs/boltons/boltons/pathutils.pyi b/stubs/boltons/boltons/pathutils.pyi index 776cf69ba852..f14f02f95a99 100644 --- a/stubs/boltons/boltons/pathutils.pyi +++ b/stubs/boltons/boltons/pathutils.pyi @@ -1,5 +1,3 @@ -# TODO: DONE! - def augpath( path: str, suffix: str = ..., diff --git a/stubs/boltons/boltons/queueutils.pyi b/stubs/boltons/boltons/queueutils.pyi index adb1caec7e9e..958fabfc0779 100644 --- a/stubs/boltons/boltons/queueutils.pyi +++ b/stubs/boltons/boltons/queueutils.pyi @@ -1,5 +1,3 @@ -# TODO: DONE! - from typing import Any, NoReturn from typing_extensions import TypeAlias diff --git a/stubs/boltons/boltons/socketutils.pyi b/stubs/boltons/boltons/socketutils.pyi index b70e9aceddc4..b9a0ed1bbf5c 100644 --- a/stubs/boltons/boltons/socketutils.pyi +++ b/stubs/boltons/boltons/socketutils.pyi @@ -1,10 +1,6 @@ import socket from _typeshed import Incomplete -# class RLock: -# def __enter__(self) -> None: ... -# def __exit__(self, exctype, excinst, exctb) -> None: ... - DEFAULT_TIMEOUT: int DEFAULT_MAXSIZE: Incomplete diff --git a/stubs/boltons/boltons/statsutils.pyi b/stubs/boltons/boltons/statsutils.pyi index 693f8f6ee717..64d74482b8cf 100644 --- a/stubs/boltons/boltons/statsutils.pyi +++ b/stubs/boltons/boltons/statsutils.pyi @@ -1,5 +1,3 @@ -# TODO: DONE! - from collections.abc import Callable, Iterator from typing import Any, NoReturn @@ -44,7 +42,6 @@ def describe( data: list[float], quantiles: list[float] | None = ..., format: str | None = ... ) -> dict[str, float] | list[float] | str: ... -# func: Incomplete mean: Any median: Any iqr: Any diff --git a/stubs/boltons/boltons/strutils.pyi b/stubs/boltons/boltons/strutils.pyi index 55b10880aa5d..2c4a6bf3e37e 100644 --- a/stubs/boltons/boltons/strutils.pyi +++ b/stubs/boltons/boltons/strutils.pyi @@ -1,5 +1,3 @@ -# TODO: DONE! - from collections.abc import Callable, Generator, Iterable from html.parser import HTMLParser from typing import Any, NoReturn, TypeVar diff --git a/stubs/boltons/boltons/timeutils.pyi b/stubs/boltons/boltons/timeutils.pyi index 9a1cd5b2eac9..66c98fbfa0f6 100644 --- a/stubs/boltons/boltons/timeutils.pyi +++ b/stubs/boltons/boltons/timeutils.pyi @@ -1,5 +1,3 @@ -# TODO: DONE! - from collections.abc import Generator from datetime import date, datetime, timedelta, tzinfo from typing import NoReturn diff --git a/stubs/boltons/boltons/urlutils.pyi b/stubs/boltons/boltons/urlutils.pyi index 36fcf8663f6a..eb2f41a248d7 100644 --- a/stubs/boltons/boltons/urlutils.pyi +++ b/stubs/boltons/boltons/urlutils.pyi @@ -71,9 +71,6 @@ class URL: class _sockaddr(ctypes.Structure): ... -# WSAStringToAddressA: Incomplete -# WSAAddressToStringA: Incomplete - def parse_host(host): ... def parse_url(url_text): ... From 0948b5cc220c735346e392c879b2071012fb2b7d Mon Sep 17 00:00:00 2001 From: Alexander Burchenko Date: Sun, 1 Jan 2023 23:37:22 +0100 Subject: [PATCH 34/51] boltons.debugutils updated --- stubs/boltons/boltons/debugutils.pyi | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/stubs/boltons/boltons/debugutils.pyi b/stubs/boltons/boltons/debugutils.pyi index 356039ad00b1..bf766f684f26 100644 --- a/stubs/boltons/boltons/debugutils.pyi +++ b/stubs/boltons/boltons/debugutils.pyi @@ -1,5 +1,8 @@ -from typing import NoReturn +from collections.abc import Callable +from typing import Any -def pdb_on_signal(signalnum: int | None = ...) -> NoReturn: ... -def pdb_on_exception(limit: int = ...) -> NoReturn: ... -def wrap_trace(obj, hook=..., which: str | None = ..., events: str | None = ..., label: str | None = ...): ... +def pdb_on_signal(signalnum: int | None = ...) -> None: ... +def pdb_on_exception(limit: int = ...) -> None: ... +def wrap_trace( + obj: object, hook: Callable[Any, Any] = ..., which: str | None = ..., events: str | None = ..., label: str | None = ... +) -> object: ... From 0a5b40c71b8493a86bea07039026c6d428d3034c Mon Sep 17 00:00:00 2001 From: Alexander Burchenko Date: Thu, 30 Mar 2023 07:52:22 +0200 Subject: [PATCH 35/51] update `casheutils` and `debugutils` --- stubs/boltons/boltons/cacheutils.pyi | 10 ++++++---- stubs/boltons/boltons/debugutils.pyi | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/stubs/boltons/boltons/cacheutils.pyi b/stubs/boltons/boltons/cacheutils.pyi index 77ebe2d93e6c..d311129ace19 100644 --- a/stubs/boltons/boltons/cacheutils.pyi +++ b/stubs/boltons/boltons/cacheutils.pyi @@ -15,10 +15,12 @@ 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 = ..., values: Incomplete | None = ..., on_miss: Incomplete | None = ...) -> NoReturn: ... - def __setitem__(self, key: _KT, value: _VT) -> NoReturn: ... + def __init__(self, *, max_size: int, values: dict[_KT, _VT] | None, on_miss: Callable[[_KT], _VT]) -> None: ... + def __setitem__(self, key: _KT, value: _VT) -> None: ... def __getitem__(self, key: _KT) -> _VT: ... def get(self, key, default: Incomplete | None = ...): ... def __delitem__(self, key: _KT) -> NoReturn: ... @@ -31,8 +33,8 @@ class LRI(dict[_KT, _VT]): def __eq__(self, other): ... def __ne__(self, other): ... -class LRU(LRI[Any, Any]): - def __getitem__(self, key): ... +class LRU(LRI[_KT, _VT]): + def __getitem__(self, key: _KT) -> _VT: ... class _HashedKey(list[Incomplete]): hash_value: Incomplete diff --git a/stubs/boltons/boltons/debugutils.pyi b/stubs/boltons/boltons/debugutils.pyi index bf766f684f26..7805d6caaebf 100644 --- a/stubs/boltons/boltons/debugutils.pyi +++ b/stubs/boltons/boltons/debugutils.pyi @@ -4,5 +4,5 @@ from typing import Any def pdb_on_signal(signalnum: int | None = ...) -> None: ... def pdb_on_exception(limit: int = ...) -> None: ... def wrap_trace( - obj: object, hook: Callable[Any, Any] = ..., which: str | None = ..., events: str | None = ..., label: str | None = ... + obj: object, hook: Callable[[Any], Any] = ..., which: str | None = ..., events: str | None = ..., label: str | None = ... ) -> object: ... From e04470858904a730d40209613e3bfcf914d750cb Mon Sep 17 00:00:00 2001 From: Alexander Burchenko Date: Thu, 30 Mar 2023 08:15:43 +0200 Subject: [PATCH 36/51] fix `debugutils` --- stubs/boltons/boltons/debugutils.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/boltons/boltons/debugutils.pyi b/stubs/boltons/boltons/debugutils.pyi index 7805d6caaebf..28538e7e9f1f 100644 --- a/stubs/boltons/boltons/debugutils.pyi +++ b/stubs/boltons/boltons/debugutils.pyi @@ -4,5 +4,5 @@ from typing import Any def pdb_on_signal(signalnum: int | None = ...) -> None: ... def pdb_on_exception(limit: int = ...) -> None: ... def wrap_trace( - obj: object, hook: Callable[[Any], Any] = ..., which: str | None = ..., events: str | None = ..., label: str | None = ... + obj: object, hook: Callable[..., Any] = ..., which: str | None = ..., events: str | None = ..., label: str | None = ... ) -> object: ... From b63f68114ce48f8a34c518aa587989c5da795e21 Mon Sep 17 00:00:00 2001 From: Alexander Burchenko Date: Thu, 30 Mar 2023 08:49:54 +0200 Subject: [PATCH 37/51] update dictutils --- stubs/boltons/boltons/dictutils.pyi | 62 +++++++++++++++-------------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/stubs/boltons/boltons/dictutils.pyi b/stubs/boltons/boltons/dictutils.pyi index 73ad79e39f7c..cef14205bdbd 100644 --- a/stubs/boltons/boltons/dictutils.pyi +++ b/stubs/boltons/boltons/dictutils.pyi @@ -1,15 +1,17 @@ -from collections.abc import Generator, Hashable, ItemsView, Iterable, KeysView, ValuesView -from typing import Any, NoReturn, TypeVar +from _typeshed import Incomplete, Self +from collections.abc import Generator, ItemsView, Iterable, KeysView, ValuesView +from typing import NoReturn, TypeVar from typing_extensions import TypeAlias _KT = TypeVar("_KT") _VT = TypeVar("_VT") +_T = TypeVar("_T") class OrderedMultiDict(dict[_KT, _VT]): - def add(self, k: _KT, v: _VT) -> NoReturn: ... - def addlist(self, k: _KT, v: Iterable[object]) -> NoReturn: ... - def clear(self) -> NoReturn: ... - def copy(self) -> OrderedMultiDict[_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) -> Self: ... def counts(self) -> OrderedMultiDict[_KT, _VT]: ... @classmethod def fromkeys(cls, keys: _KT, default: _VT | None = ...) -> OrderedMultiDict[_KT, _VT]: ... # type: ignore @@ -28,15 +30,15 @@ class OrderedMultiDict(dict[_KT, _VT]): def sorted(self, key: _KT | None = ..., reverse: bool = ...) -> OrderedMultiDict[_KT, _VT]: ... def sortedvalues(self, key: _KT | None = ..., reverse: bool = ...) -> OrderedMultiDict[_KT, _VT]: ... def todict(self, multi: bool = ...) -> dict[_KT, _VT]: ... - def update(self, E: dict[_KT, _VT] | Iterable[object], **F) -> NoReturn: ... # type: ignore - def update_extend(self, E: dict[_KT, _VT] | Iterable[object], **F) -> NoReturn: ... + def update(self, E: dict[_KT, _VT] | Iterable[object], **F) -> None: ... # type: ignore + def update_extend(self, E: dict[_KT, _VT] | Iterable[object], **F) -> None: ... def values(self, multi: bool = ...) -> list[_VT]: ... # type: ignore def viewitems(self) -> ItemsView[_KT, _VT]: ... def viewkeys(self) -> KeysView[_KT]: ... def viewvalues(self) -> ValuesView[_VT]: ... -OMD: TypeAlias = OrderedMultiDict[Any, Any] -MultiDict: TypeAlias = OrderedMultiDict[Any, Any] +OMD: TypeAlias = OrderedMultiDict[_KT, _VT] +MultiDict: TypeAlias = OrderedMultiDict[_KT, _VT] class FastIterOrderedMultiDict(OrderedMultiDict[_KT, _VT]): # undocumented def iteritems(self, multi: bool = ...) -> Generator[tuple[_KT, _VT], None, None]: ... @@ -46,42 +48,42 @@ class OneToOne(dict[_KT, _VT]): inv: dict[_VT, _KT] def clear(self) -> None: ... def copy(self) -> OneToOne[_KT, _VT]: ... - def pop(self, key: _KT, default: _VT = ...) -> _VT: ... # type: ignore + def pop(self, key: _KT, default: Incomplete) -> Incomplete: ... # type: ignore def popitem(self) -> tuple[_KT, _VT]: ... def setdefault(self, key: _KT, default: _VT | None = ...) -> _VT: ... @classmethod - def unique(cls, *a, **kw) -> NoReturn: ... - def update(self, dict_or_iterable: dict[_KT, _VT] | Iterable[object], **kw) -> NoReturn: ... # type: ignore + def unique(cls: type[Self], *a, **kw) -> Self: ... + def update(self, dict_or_iterable, **kw) -> None: ... # type: ignore -class ManyToMany: - data: dict[Hashable, object] - def __contains__(self, key): ... - def __delitem__(self, key) -> None: ... +class ManyToMany(dict[_KT, tuple[_VT]]): + data: dict[_KT, _VT] + inv: dict[_VT, _KT] + # def __contains__(self, key: _KT): ... + def __delitem__(self, key: _KT) -> None: ... def __eq__(self, other): ... - def __getitem__(self, key): ... + def __getitem__(self, key: _KT): ... def __init__(self, items: Iterable[object] | None = ...) -> None: ... def __iter__(self): ... def __len__(self): ... - def __setitem__(self, key, vals) -> None: ... - def add(self, key: Hashable, val: object) -> NoReturn: ... - def get(self, key: Hashable, default: frozenset[object] = ...) -> object: ... - def iteritems(self) -> Generator[tuple[Hashable, object], None, None]: ... - def keys(self): ... # incomplete - def remove(self, key: Hashable, val: object) -> NoReturn: ... - def replace(self, key: Hashable, newkey: Hashable) -> NoReturn: ... - def update(self, iterable) -> None: ... - inv: tuple[object] + def __setitem__(self, key: _KT, vals: tuple[_VT]) -> None: ... + def add(self, key: _KT, val: _VT) -> None: ... + def get(self, key: _KT, default: frozenset[None] | _T = ...) -> frozenset[None] | _T: ... # type: ignore + 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: tuple[_KT, _VT]) -> None: ... # type: ignore -def subdict(d: dict[_KT, _VT], keep: Iterable[_VT] | None = ..., drop: Iterable[_VT] | None = ...) -> dict[_KT, _VT]: ... +def subdict(d: dict[_KT, _VT], keep: Iterable[_KT] | None = ..., drop: Iterable[_KT] | None = ...) -> dict[_KT, _VT]: ... class FrozenHashError(TypeError): ... # undocumented class FrozenDict(dict[_KT, _VT]): def __copy__(self): ... - def clear(self, *a, **kw) -> NoReturn: ... + def clear(self, *a, **kw) -> None: ... @classmethod def fromkeys(cls, keys: Iterable[_KT], value: _VT | None = ...) -> FrozenDict[_KT, _VT]: ... # type: ignore def pop(self, *a, **kw) -> NoReturn: ... def popitem(self, *a, **kw) -> NoReturn: ... def setdefault(self, *a, **kw) -> NoReturn: ... - def updated(self, *a, **kw) -> FrozenDict[_KT, _VT]: ... + def updated(self: Self, *a, **kw) -> Self: ... From 3fe149daca2e55388aabb2bd676044e3c5746490 Mon Sep 17 00:00:00 2001 From: Alexander Burchenko Date: Thu, 30 Mar 2023 09:11:29 +0200 Subject: [PATCH 38/51] fix `cacheutils` and `dictutils` --- stubs/boltons/boltons/cacheutils.pyi | 2 +- stubs/boltons/boltons/dictutils.pyi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/stubs/boltons/boltons/cacheutils.pyi b/stubs/boltons/boltons/cacheutils.pyi index d311129ace19..73eec5dc7e67 100644 --- a/stubs/boltons/boltons/cacheutils.pyi +++ b/stubs/boltons/boltons/cacheutils.pyi @@ -19,7 +19,7 @@ class LRI(dict[_KT, _VT]): soft_miss_count: int max_size: int on_miss: Callable[[_KT], _VT] - def __init__(self, *, max_size: int, values: dict[_KT, _VT] | None, on_miss: Callable[[_KT], _VT]) -> None: ... + def __init__(self, max_size: int = ..., values: Incomplete | None = ..., on_miss: Incomplete | None = ...) -> None: ... def __setitem__(self, key: _KT, value: _VT) -> None: ... def __getitem__(self, key: _KT) -> _VT: ... def get(self, key, default: Incomplete | None = ...): ... diff --git a/stubs/boltons/boltons/dictutils.pyi b/stubs/boltons/boltons/dictutils.pyi index cef14205bdbd..d6f068e8bfb0 100644 --- a/stubs/boltons/boltons/dictutils.pyi +++ b/stubs/boltons/boltons/dictutils.pyi @@ -48,7 +48,7 @@ class OneToOne(dict[_KT, _VT]): inv: dict[_VT, _KT] def clear(self) -> None: ... def copy(self) -> OneToOne[_KT, _VT]: ... - def pop(self, key: _KT, default: Incomplete) -> Incomplete: ... # type: ignore + def pop(self, key: _KT, default: Incomplete = ...) -> Incomplete: ... # type: ignore def popitem(self) -> tuple[_KT, _VT]: ... def setdefault(self, key: _KT, default: _VT | None = ...) -> _VT: ... @classmethod From cff28a546756c092977a2e656f2e4c103a5e7c74 Mon Sep 17 00:00:00 2001 From: Alexander Burchenko Date: Fri, 31 Mar 2023 22:53:56 +0200 Subject: [PATCH 39/51] update listutils --- stubs/boltons/boltons/listutils.pyi | 66 ++++++++++++++++++----------- 1 file changed, 41 insertions(+), 25 deletions(-) diff --git a/stubs/boltons/boltons/listutils.pyi b/stubs/boltons/boltons/listutils.pyi index 00eebadf3c2f..0337d52634a7 100644 --- a/stubs/boltons/boltons/listutils.pyi +++ b/stubs/boltons/boltons/listutils.pyi @@ -1,35 +1,51 @@ -from _typeshed import Incomplete +from collections.abc import Callable, Iterable +from typing import Any, NoReturn, TypeVar, overload +from typing_extensions import SupportsIndex, TypeAlias + +_T = TypeVar("_T") xrange = range -class BarrelList(list[Incomplete]): - lists: Incomplete - def __init__(self, iterable: Incomplete | None = ...) -> None: ... - def insert(self, index, item) -> None: ... - def append(self, item) -> None: ... - def extend(self, iterable) -> None: ... - def pop(self, *a): ... - def iter_slice(self, start, stop, step: Incomplete | None = ...): ... - def del_slice(self, start, stop, step: Incomplete | None = ...) -> None: ... - __delslice__: Incomplete +class BarrelList(list[_T]): + lists: list[list[_T]] + @overload + def __init__(self, iterable: Iterable[_T]) -> None: ... + @overload + def __init__(self, iterable: None) -> 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 | NoReturn: ... + def iter_slice(self, start: int, stop: int, step: int | None = ...): ... + @overload + def del_slice(self, index: int) -> None: ... # Updated + @overload + def del_slice(self, index: slice) -> None: ... # Updated + __delslice__ = del_slice @classmethod def from_iterable(cls, it): ... def __iter__(self): ... def __reversed__(self): ... - def __len__(self): ... - def __contains__(self, item): ... - def __getitem__(self, index): ... - def __delitem__(self, index) -> None: ... - def __setitem__(self, index, item) -> None: ... - def __getslice__(self, start, stop): ... - def __setslice__(self, start, stop, sequence) -> None: ... - def sort(self) -> None: ... # type: ignore + def __len__(self) -> int: ... + def __contains__(self, item: object) -> bool: ... + @overload + def __getitem__(self, index: SupportsIndex) -> _T: ... # Updated + @overload + def __getitem__(self, index: slice) -> list[_T]: ... # Updated + def __delitem__(self, index: SupportsIndex | slice) -> None: ... # Updated + @overload + def __setitem__(self, index: SupportsIndex, item: _T) -> None: ... + @overload + def __setitem__(self, index: slice, item: Iterable[_T]) -> None: ... + def __getslice__(self, start: int, stop: int): ... + def __setslice__(self, start: int, stop: int, sequence: int) -> None: ... + def sort(self, *, key: Callable[[_T], Any] | None = ..., reverse: bool = False) -> None: ... def reverse(self) -> None: ... - def count(self, item): ... - def index(self, item): ... + def count(self, item: _T) -> int: ... + def index(self, item: _T, start: SupportsIndex = ..., end: SupportsIndex = ...) -> int: ... -BList = BarrelList +BList: TypeAlias = BarrelList[_T] -class SplayList(list[Incomplete]): - def shift(self, item_index, dest_index: int = ...) -> None: ... - def swap(self, item_index, dest_index) -> None: ... +class SplayList(list[_T]): + def shift(self, item_index: int, dest_index: int = ...) -> None: ... + def swap(self, item_index: int, dest_index: int) -> None: ... From abb2d21fe5a0455325b20ac5d6d25ce29b6a45be Mon Sep 17 00:00:00 2001 From: Alexander Burchenko Date: Fri, 31 Mar 2023 23:22:15 +0200 Subject: [PATCH 40/51] update listutils --- stubs/boltons/boltons/listutils.pyi | 51 +++++++++-------------------- 1 file changed, 15 insertions(+), 36 deletions(-) diff --git a/stubs/boltons/boltons/listutils.pyi b/stubs/boltons/boltons/listutils.pyi index 0337d52634a7..8002ba9422d9 100644 --- a/stubs/boltons/boltons/listutils.pyi +++ b/stubs/boltons/boltons/listutils.pyi @@ -1,51 +1,30 @@ -from collections.abc import Callable, Iterable -from typing import Any, NoReturn, TypeVar, overload +from collections.abc import Iterable +from typing import Any, NoReturn from typing_extensions import SupportsIndex, TypeAlias -_T = TypeVar("_T") - xrange = range -class BarrelList(list[_T]): - lists: list[list[_T]] - @overload - def __init__(self, iterable: Iterable[_T]) -> None: ... - @overload - def __init__(self, iterable: None) -> 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 | NoReturn: ... +class BarrelList(list[Any]): + lists: list[list[Any]] + def __init__(self, iterable: Iterable[Any] | None = ...) -> None: ... + def insert(self, index: SupportsIndex, item: Any) -> None: ... + def append(self, item: Any) -> None: ... + def extend(self, iterable: Iterable[Any]) -> None: ... + def pop(self, *a) -> Any | NoReturn: ... def iter_slice(self, start: int, stop: int, step: int | None = ...): ... - @overload - def del_slice(self, index: int) -> None: ... # Updated - @overload - def del_slice(self, index: slice) -> None: ... # Updated + def del_slice(self, start: int, stop: int, step: int | None = ...) -> None: ... __delslice__ = del_slice @classmethod def from_iterable(cls, it): ... - def __iter__(self): ... - def __reversed__(self): ... - def __len__(self) -> int: ... - def __contains__(self, item: object) -> bool: ... - @overload - def __getitem__(self, index: SupportsIndex) -> _T: ... # Updated - @overload - def __getitem__(self, index: slice) -> list[_T]: ... # Updated - def __delitem__(self, index: SupportsIndex | slice) -> None: ... # Updated - @overload - def __setitem__(self, index: SupportsIndex, item: _T) -> None: ... - @overload - def __setitem__(self, index: slice, item: Iterable[_T]) -> None: ... def __getslice__(self, start: int, stop: int): ... def __setslice__(self, start: int, stop: int, sequence: int) -> None: ... - def sort(self, *, key: Callable[[_T], Any] | None = ..., reverse: bool = False) -> None: ... + def sort(self) -> None: ... # type: ignore[override] def reverse(self) -> None: ... - def count(self, item: _T) -> int: ... - def index(self, item: _T, start: SupportsIndex = ..., end: SupportsIndex = ...) -> int: ... + def count(self, item: Any) -> int: ... + def index(self, item: Any) -> int: ... # type: ignore[override] -BList: TypeAlias = BarrelList[_T] +BList: TypeAlias = BarrelList -class SplayList(list[_T]): +class SplayList(list[Any]): def shift(self, item_index: int, dest_index: int = ...) -> None: ... def swap(self, item_index: int, dest_index: int) -> None: ... From 019b6a93ab1e736e43c344a1651156d1b185b519 Mon Sep 17 00:00:00 2001 From: Alexander Burchenko Date: Sat, 1 Apr 2023 00:55:37 +0200 Subject: [PATCH 41/51] update tbutils and typeutils --- stubs/boltons/boltons/tbutils.pyi | 87 +++++++++++++++-------------- stubs/boltons/boltons/typeutils.pyi | 10 ++-- 2 files changed, 51 insertions(+), 46 deletions(-) diff --git a/stubs/boltons/boltons/tbutils.pyi b/stubs/boltons/boltons/tbutils.pyi index a1bf344615a7..495d2c8ee6f5 100644 --- a/stubs/boltons/boltons/tbutils.pyi +++ b/stubs/boltons/boltons/tbutils.pyi @@ -1,23 +1,28 @@ from _typeshed import Incomplete +from collections.abc import Iterator +from types import FrameType, TracebackType +from typing import Any text = str class Callpoint: - func_name: Incomplete - lineno: Incomplete - module_name: Incomplete - module_path: Incomplete - lasti: Incomplete - line: Incomplete - def __init__(self, module_name, module_path, func_name, lineno, lasti, line: Incomplete | None = ...) -> None: ... - def to_dict(self): ... + 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: ... + def to_dict(self) -> dict[str, object]: ... @classmethod def from_current(cls, level: int = ...): ... @classmethod - def from_frame(cls, frame): ... + def from_frame(cls, frame: FrameType): ... @classmethod - def from_tb(cls, tb): ... - def tb_frame_str(self): ... + def from_tb(cls, tb: TracebackType): ... + def tb_frame_str(self) -> str: ... class _DeferredLine: filename: Incomplete @@ -28,33 +33,33 @@ class _DeferredLine: def __len__(self): ... class TracebackInfo: - callpoint_type: Incomplete - frames: Incomplete - def __init__(self, frames) -> None: ... + callpoint_type: type[Callpoint] + frames: list[FrameType] + def __init__(self, frames: list[FrameType]) -> None: ... @classmethod - def from_frame(cls, frame: Incomplete | None = ..., level: int = ..., limit: Incomplete | None = ...): ... + def from_frame(cls, frame: FrameType | None = ..., level: int = ..., limit: int | None = ...): ... @classmethod - def from_traceback(cls, tb: Incomplete | None = ..., limit: Incomplete | None = ...): ... + def from_traceback(cls, tb: TracebackType | None = ..., limit: int | None = ...): ... @classmethod - def from_dict(cls, d): ... - def to_dict(self): ... - def __len__(self): ... - def __iter__(self): ... - def get_formatted(self): ... + def from_dict(cls, d: dict[str, list[FrameType]]): ... + 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: Incomplete - exc_type: Incomplete - exc_msg: Incomplete - tb_info: Incomplete - def __init__(self, exc_type, exc_msg, tb_info) -> None: ... + 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, exc_value, traceback): ... + def from_exc_info(cls, exc_type: str, exc_value: Any, traceback: TracebackType): ... @classmethod def from_current(cls): ... - def to_dict(self): ... - def get_formatted(self): ... - def get_formatted_exception_only(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: Incomplete @@ -68,23 +73,23 @@ class ContextualCallpoint(Callpoint): def to_dict(self): ... class ContextualTracebackInfo(TracebackInfo): - callpoint_type: Incomplete + callpoint_type: type[ContextualCallpoint] class ContextualExceptionInfo(ExceptionInfo): - tb_info_type: Incomplete + tb_info_type: type[ContextualTracebackInfo] -def print_exception(etype, value, tb, limit: Incomplete | None = ..., file: Incomplete | None = ...) -> None: ... +def print_exception(etype: str, value: Any, tb: TracebackType, limit: int | None = ..., file: str | None = ...) -> None: ... class ParsedException: - exc_type: Incomplete - exc_msg: Incomplete - frames: Incomplete - def __init__(self, exc_type_name, exc_msg, frames: Incomplete | None = ...) -> None: ... + exc_type: str + exc_msg: str + frames: list[FrameType] + def __init__(self, exc_type_name: str, exc_msg: str, frames: list[FrameType] | None = ...) -> None: ... @property - def source_file(self): ... - def to_dict(self): ... - def to_string(self): ... + 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): ... + def from_string(cls, tb_str: str): ... ParsedTB = ParsedException diff --git a/stubs/boltons/boltons/typeutils.pyi b/stubs/boltons/boltons/typeutils.pyi index 5463a2632df6..a98e5afc0630 100644 --- a/stubs/boltons/boltons/typeutils.pyi +++ b/stubs/boltons/boltons/typeutils.pyi @@ -1,10 +1,10 @@ -from _typeshed import Incomplete +from typing import Any -def make_sentinel(name: str = ..., var_name: Incomplete | None = ...): ... -def issubclass(subclass, baseclass): ... -def get_all_subclasses(cls): ... +def make_sentinel(name: str = ..., var_name: str | None = ...) -> object: ... +def issubclass(subclass: type, baseclass: type) -> bool: ... +def get_all_subclasses(cls) -> list[str]: ... class classproperty: - fn: Incomplete + fn: Any def __init__(self, fn) -> None: ... def __get__(self, instance, cls): ... From a536c536ea79f17bc32bd149f6f90ebb54e1b24b Mon Sep 17 00:00:00 2001 From: Alexander Burchenko Date: Sat, 1 Apr 2023 08:51:12 +0200 Subject: [PATCH 42/51] update dictutils and tbutils --- stubs/boltons/boltons/dictutils.pyi | 26 +++++++++---------- stubs/boltons/boltons/tbutils.pyi | 40 ++++++++++++----------------- 2 files changed, 29 insertions(+), 37 deletions(-) diff --git a/stubs/boltons/boltons/dictutils.pyi b/stubs/boltons/boltons/dictutils.pyi index d6f068e8bfb0..bd26ccac3e19 100644 --- a/stubs/boltons/boltons/dictutils.pyi +++ b/stubs/boltons/boltons/dictutils.pyi @@ -1,4 +1,4 @@ -from _typeshed import Incomplete, Self +from _typeshed import Self from collections.abc import Generator, ItemsView, Iterable, KeysView, ValuesView from typing import NoReturn, TypeVar from typing_extensions import TypeAlias @@ -14,25 +14,25 @@ class OrderedMultiDict(dict[_KT, _VT]): def copy(self: Self) -> Self: ... def counts(self) -> OrderedMultiDict[_KT, _VT]: ... @classmethod - def fromkeys(cls, keys: _KT, default: _VT | None = ...) -> OrderedMultiDict[_KT, _VT]: ... # type: ignore - def get(self, k: _KT, default: _VT | None = ...) -> OrderedMultiDict[_KT, _VT]: ... # type: ignore + def fromkeys(cls, keys: _KT, default: _VT | None = ...) -> OrderedMultiDict[_KT, _VT]: ... # type: ignore[override] + def get(self, k: _KT, default: _VT | 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 = ...) -> list[tuple[_KT, _VT]]: ... # type: ignore + def items(self, multi: bool = ...) -> list[tuple[_KT, _VT]]: ... # type: ignore[override] def iteritems(self, multi: bool = ...) -> Generator[tuple[_KT, _VT], None, None]: ... def iterkeys(self, multi: bool = ...) -> Generator[_KT, None, None]: ... def itervalues(self, multi: bool = ...) -> Generator[_VT, None, None]: ... - def keys(self, multi: bool = ...) -> list[_KT]: ... # type: ignore - def pop(self, k: _KT, default: _VT | None = ...) -> _VT: ... # type: ignore + def keys(self, multi: bool = ...) -> 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 = ..., reverse: bool = ...) -> OrderedMultiDict[_KT, _VT]: ... def sortedvalues(self, key: _KT | None = ..., reverse: bool = ...) -> OrderedMultiDict[_KT, _VT]: ... def todict(self, multi: bool = ...) -> dict[_KT, _VT]: ... - def update(self, E: dict[_KT, _VT] | Iterable[object], **F) -> None: ... # type: ignore + 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 = ...) -> list[_VT]: ... # type: ignore + def values(self, multi: bool = ...) -> list[_VT]: ... # type: ignore[override] def viewitems(self) -> ItemsView[_KT, _VT]: ... def viewkeys(self) -> KeysView[_KT]: ... def viewvalues(self) -> ValuesView[_VT]: ... @@ -48,12 +48,12 @@ class OneToOne(dict[_KT, _VT]): inv: dict[_VT, _KT] def clear(self) -> None: ... def copy(self) -> OneToOne[_KT, _VT]: ... - def pop(self, key: _KT, default: Incomplete = ...) -> Incomplete: ... # type: ignore + def pop(self, key: _KT, default: _VT | _T = ...) -> _VT | _T: ... def popitem(self) -> tuple[_KT, _VT]: ... def setdefault(self, key: _KT, default: _VT | None = ...) -> _VT: ... @classmethod def unique(cls: type[Self], *a, **kw) -> Self: ... - def update(self, dict_or_iterable, **kw) -> None: ... # type: ignore + def update(self, dict_or_iterable, **kw) -> None: ... # type: ignore[override] class ManyToMany(dict[_KT, tuple[_VT]]): data: dict[_KT, _VT] @@ -67,12 +67,12 @@ class ManyToMany(dict[_KT, tuple[_VT]]): def __len__(self): ... def __setitem__(self, key: _KT, vals: tuple[_VT]) -> None: ... def add(self, key: _KT, val: _VT) -> None: ... - def get(self, key: _KT, default: frozenset[None] | _T = ...) -> frozenset[None] | _T: ... # type: ignore + def get(self, key: _KT, default: frozenset[None] | _T = ...) -> frozenset[None] | _T: ... # 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: tuple[_KT, _VT]) -> None: ... # type: ignore + def update(self, iterable: tuple[_KT, _VT]) -> None: ... # type: ignore[override] def subdict(d: dict[_KT, _VT], keep: Iterable[_KT] | None = ..., drop: Iterable[_KT] | None = ...) -> dict[_KT, _VT]: ... @@ -82,7 +82,7 @@ class FrozenDict(dict[_KT, _VT]): def __copy__(self): ... def clear(self, *a, **kw) -> None: ... @classmethod - def fromkeys(cls, keys: Iterable[_KT], value: _VT | None = ...) -> FrozenDict[_KT, _VT]: ... # type: ignore + def fromkeys(cls, keys: Iterable[_KT], value: _VT | 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: ... diff --git a/stubs/boltons/boltons/tbutils.pyi b/stubs/boltons/boltons/tbutils.pyi index 495d2c8ee6f5..6dc90f763106 100644 --- a/stubs/boltons/boltons/tbutils.pyi +++ b/stubs/boltons/boltons/tbutils.pyi @@ -1,4 +1,4 @@ -from _typeshed import Incomplete +from _typeshed import Self from collections.abc import Iterator from types import FrameType, TracebackType from typing import Any @@ -17,31 +17,23 @@ class Callpoint: ) -> None: ... def to_dict(self) -> dict[str, object]: ... @classmethod - def from_current(cls, level: int = ...): ... + def from_current(cls: Self, level: int = ...) -> Self: ... @classmethod - def from_frame(cls, frame: FrameType): ... + def from_frame(cls: Self, frame: FrameType) -> Self: ... @classmethod - def from_tb(cls, tb: TracebackType): ... + def from_tb(cls: Self, tb: TracebackType) -> Self: ... def tb_frame_str(self) -> str: ... -class _DeferredLine: - filename: Incomplete - lineno: Incomplete - def __init__(self, filename, lineno, module_globals: Incomplete | None = ...) -> None: ... - def __eq__(self, other): ... - def __ne__(self, other): ... - def __len__(self): ... - class TracebackInfo: callpoint_type: type[Callpoint] frames: list[FrameType] def __init__(self, frames: list[FrameType]) -> None: ... @classmethod - def from_frame(cls, frame: FrameType | None = ..., level: int = ..., limit: int | None = ...): ... + def from_frame(cls: Self, frame: FrameType | None = ..., level: int = ..., limit: int | None = ...) -> Self: ... @classmethod - def from_traceback(cls, tb: TracebackType | None = ..., limit: int | None = ...): ... + def from_traceback(cls: Self, tb: TracebackType | None = ..., limit: int | None = ...) -> Self: ... @classmethod - def from_dict(cls, d: dict[str, list[FrameType]]): ... + def from_dict(cls: Self, d: dict[str, list[FrameType]]) -> Self: ... def to_dict(self) -> dict[str, list[FrameType]]: ... def __len__(self) -> int: ... def __iter__(self) -> Iterator[FrameType]: ... @@ -54,23 +46,23 @@ class ExceptionInfo: 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): ... + def from_exc_info(cls: Self, exc_type: str, exc_value: Any, traceback: TracebackType) -> Self: ... @classmethod - def from_current(cls): ... + def from_current(cls: Self) -> 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: Incomplete - pre_lines: Incomplete - post_lines: Incomplete + 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): ... + def from_frame(cls: Self, frame: FrameType) -> Self: ... @classmethod - def from_tb(cls, tb): ... - def to_dict(self): ... + def from_tb(cls: Self, tb: TracebackType) -> Self: ... + def to_dict(self) -> dict[str, Any]: ... class ContextualTracebackInfo(TracebackInfo): callpoint_type: type[ContextualCallpoint] @@ -90,6 +82,6 @@ class ParsedException: def to_dict(self) -> dict[str, str | list[FrameType]]: ... def to_string(self) -> str: ... @classmethod - def from_string(cls, tb_str: str): ... + def from_string(cls: Self, tb_str: str) -> Self: ... ParsedTB = ParsedException From 69e8767515c2b84a9c743d04544898aea67561cb Mon Sep 17 00:00:00 2001 From: Alexander Burchenko Date: Mon, 10 Apr 2023 00:52:46 +0300 Subject: [PATCH 43/51] update `setutils` and `socketutils` --- stubs/boltons/boltons/setutils.pyi | 162 +++++++++++++------------- stubs/boltons/boltons/socketutils.pyi | 85 +++++++------- 2 files changed, 122 insertions(+), 125 deletions(-) diff --git a/stubs/boltons/boltons/setutils.pyi b/stubs/boltons/boltons/setutils.pyi index eef9be5f3934..0cdaa13fc44a 100644 --- a/stubs/boltons/boltons/setutils.pyi +++ b/stubs/boltons/boltons/setutils.pyi @@ -1,91 +1,89 @@ -from _typeshed import Incomplete -from collections.abc import Generator, MutableSet +from collections.abc import Generator, Iterable, Iterator, MutableSet +from itertools import islice +from typing import Any +from typing_extensions import Self -class IndexedSet(MutableSet[Incomplete]): - item_index_map: Incomplete - item_list: Incomplete - dead_indices: Incomplete - def __init__(self, other: Incomplete | None = ...) -> None: ... - def __len__(self): ... - def __contains__(self, item): ... - def __iter__(self): ... - def __reversed__(self): ... - def __eq__(self, other): ... +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: ... + 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): ... - def add(self, item) -> None: ... - def remove(self, item) -> None: ... - def discard(self, item) -> None: ... + 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): ... - def issubset(self, other): ... - def issuperset(self, other): ... - def union(self, *others): ... - def iter_intersection(self, *others) -> Generator[Incomplete, None, None]: ... - def intersection(self, *others): ... - def iter_difference(self, *others) -> Generator[Incomplete, None, None]: ... - def difference(self, *others): ... - def symmetric_difference(self, *others): ... - __or__: Incomplete - __ror__: Incomplete - __and__: Incomplete - __rand__: Incomplete - __sub__: Incomplete - __xor__: Incomplete - __rxor__: Incomplete - def __rsub__(self, other): ... - def update(self, *others) -> None: ... - def intersection_update(self, *others) -> None: ... - def difference_update(self, *others) -> None: ... - def symmetric_difference_update(self, other) -> None: ... - def iter_slice(self, start, stop, step: Incomplete | None = ...): ... - def __getitem__(self, index): ... - def pop(self, index: Incomplete | None = ...): ... - def count(self, val): ... + 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 = ...) -> islice[Iterable[Any]]: ... + def __getitem__(self, index: int) -> Any: ... + def pop(self, index: int | None = ...) -> Any: ... + def count(self, val: Any) -> int: ... def reverse(self) -> None: ... def sort(self, **kwargs) -> None: ... - def index(self, val): ... + def index(self, val: Any) -> int: ... -def complement(wrapped): ... +def complement(wrapped: set[Any]) -> set[Any]: ... class _ComplementSet: - def __init__(self, included: Incomplete | None = ..., excluded: Incomplete | None = ...) -> None: ... - def complemented(self): ... - __invert__: Incomplete + def __init__(self, included: set[Any] | None = ..., excluded: set[Any] | None = ...) -> None: ... + def complemented(self) -> set[Any]: ... + __invert__ = complemented def complement(self) -> None: ... - def __contains__(self, item): ... - def add(self, item) -> None: ... - def remove(self, item) -> None: ... - def pop(self): ... - def intersection(self, other): ... - def __and__(self, other): ... - __rand__: Incomplete - def __iand__(self, other): ... - def union(self, other): ... - def __or__(self, other): ... - __ror__: Incomplete - def __ior__(self, other): ... - def update(self, items) -> None: ... - def discard(self, items) -> None: ... - def symmetric_difference(self, other): ... - def __xor__(self, other): ... - __rxor__: Incomplete - def symmetric_difference_update(self, other) -> None: ... - def isdisjoint(self, other): ... - def issubset(self, other): ... - def __le__(self, other): ... - def __lt__(self, other): ... - def issuperset(self, other): ... - def __ge__(self, other): ... - def __gt__(self, other): ... - def difference(self, other): ... - def __sub__(self, other): ... - def __rsub__(self, other): ... - def difference_update(self, other) -> None: ... - def __isub__(self, other): ... - def __eq__(self, other): ... - def __hash__(self): ... - def __len__(self): ... - def __iter__(self): ... - def __bool__(self): ... - __nonzero__: Incomplete + 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: ... diff --git a/stubs/boltons/boltons/socketutils.pyi b/stubs/boltons/boltons/socketutils.pyi index b9a0ed1bbf5c..7e2e767d2167 100644 --- a/stubs/boltons/boltons/socketutils.pyi +++ b/stubs/boltons/boltons/socketutils.pyi @@ -1,70 +1,69 @@ import socket -from _typeshed import Incomplete DEFAULT_TIMEOUT: int -DEFAULT_MAXSIZE: Incomplete +DEFAULT_MAXSIZE: int class BufferedSocket: - sock: Incomplete + sock: socket.socket rbuf: bytes - sbuf: Incomplete - maxsize: Incomplete - timeout: Incomplete - def __init__(self, sock, timeout=..., maxsize=..., recvsize=...) -> None: ... - def settimeout(self, timeout) -> None: ... - def gettimeout(self): ... - def setblocking(self, blocking) -> None: ... + sbuf: list[bytes] + maxsize: int + timeout: int + def __init__(self, sock: socket.socket, timeout: int = ..., maxsize: int = ..., 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): ... - def getsendbuffer(self): ... - def recv(self, size, flags: int = ..., timeout=...): ... - def peek(self, size, timeout=...): ... - def recv_close(self, timeout=..., maxsize=...): ... - def recv_until(self, delimiter, timeout=..., maxsize=..., with_delimiter: bool = ...): ... - def recv_size(self, size, timeout=...): ... - def send(self, data, flags: int = ..., timeout=...): ... - def sendall(self, data, flags: int = ..., timeout=...): ... + def getrecvbuffer(self) -> bytes: ... + def getsendbuffer(self) -> bytes: ... + def recv(self, size: int, flags: int = ..., 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: bytes, timeout: float = ..., maxsize: int = ..., with_delimiter: bool = ...) -> bytes: ... + def recv_size(self, size: int, timeout: float = ...) -> bytes: ... + def send(self, data: bytes, flags: int = ..., timeout: float = ...) -> str: ... + def sendall(self, data: bytes, flags: int = ..., timeout: float = ...) -> str: ... def flush(self) -> None: ... - def buffer(self, data) -> None: ... - def getsockname(self): ... - def getpeername(self): ... - def getsockopt(self, level, optname, buflen: Incomplete | None = ...): ... - def setsockopt(self, level, optname, value): ... + def buffer(self, data: bytes) -> None: ... + def getsockname(self) -> str: ... + def getpeername(self) -> str: ... + def getsockopt(self, level: int, optname: int, buflen: int | None = ...) -> bytes | int: ... + def setsockopt(self, level: int, optname: int, value: int | bytes | None) -> bytes | int: ... @property - def type(self): ... + def type(self) -> int: ... @property - def family(self): ... + def family(self) -> int: ... @property - def proto(self): ... - def fileno(self): ... - rbuf_unconsumed: Incomplete + def proto(self) -> int: ... + def fileno(self) -> int: ... + rbuf_unconsumed: bytes def close(self) -> None: ... - def shutdown(self, how) -> None: ... + def shutdown(self, how: int) -> None: ... class Error(socket.error): ... class ConnectionClosed(Error): ... class MessageTooLong(Error): - def __init__(self, bytes_read: Incomplete | None = ..., delimiter: Incomplete | None = ...) -> None: ... + def __init__(self, bytes_read: int | None = ..., delimiter: str | None = ...) -> None: ... class Timeout(socket.timeout, Error): - def __init__(self, timeout, extra: str = ...) -> None: ... + def __init__(self, timeout: float, extra: str = ...) -> None: ... class NetstringSocket: - bsock: Incomplete - timeout: Incomplete - maxsize: Incomplete - def __init__(self, sock, timeout=..., maxsize=...) -> None: ... - def fileno(self): ... - def settimeout(self, timeout) -> None: ... - def setmaxsize(self, maxsize) -> None: ... - def read_ns(self, timeout=..., maxsize=...): ... - def write_ns(self, payload) -> None: ... + bsock: BufferedSocket + timeout: float + maxsize: int + def __init__(self, sock: socket.socket, timeout: float = ..., maxsize: int = ...) -> 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) -> None: ... + def __init__(self, msg: str) -> None: ... class NetstringMessageTooLong(NetstringProtocolError): - def __init__(self, size, maxsize) -> None: ... + def __init__(self, size: int, maxsize: int) -> None: ... From f48d187511678e1f497bdec87675aa78bd0aedcd Mon Sep 17 00:00:00 2001 From: Alexander Burchenko Date: Wed, 17 May 2023 23:27:00 +0300 Subject: [PATCH 44/51] boltons: update `cacheutils` --- stubs/boltons/boltons/cacheutils.pyi | 112 ++++++++++++++------------- 1 file changed, 58 insertions(+), 54 deletions(-) diff --git a/stubs/boltons/boltons/cacheutils.pyi b/stubs/boltons/boltons/cacheutils.pyi index 73eec5dc7e67..b74a8c3a95cc 100644 --- a/stubs/boltons/boltons/cacheutils.pyi +++ b/stubs/boltons/boltons/cacheutils.pyi @@ -1,12 +1,13 @@ -from _typeshed import Incomplete -from collections.abc import Callable, Generator -from typing import Any, NoReturn, TypeVar +from _typeshed import Incomplete, Self +from collections.abc import Callable, Generator, Hashable, Iterable, Iterator, Mapping +from typing import Any, Generic, NoReturn, TypeVar, overload _KT = TypeVar("_KT") _VT = TypeVar("_VT") +_T = TypeVar("_T") xrange = range -basestring: Any +basestring: tuple[type[str], type[bytes]] PREV: int NEXT: int KEY: int @@ -22,26 +23,31 @@ class LRI(dict[_KT, _VT]): def __init__(self, max_size: int = ..., values: Incomplete | None = ..., on_miss: Incomplete | None = ...) -> None: ... def __setitem__(self, key: _KT, value: _VT) -> None: ... def __getitem__(self, key: _KT) -> _VT: ... - def get(self, key, default: Incomplete | None = ...): ... + @overload + def get(self, key: _KT, default: None = None) -> _VT | None: ... + @overload + def get(self, key: _KT, default: _T | _VT = ...) -> _T | _VT: ... def __delitem__(self, key: _KT) -> NoReturn: ... - def pop(self, key, default=...): ... - def popitem(self): ... + def pop(self, key: _KT, default: _T | _VT = ...) -> _T | _VT: ... + def popitem(self) -> tuple[_KT, _VT]: ... def clear(self) -> None: ... - def copy(self): ... - def setdefault(self, key, default: Incomplete | None = ...): ... - def update(self, E, **F) -> None: ... # type: ignore - def __eq__(self, other): ... - def __ne__(self, other): ... + 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, **F) -> None: ... # type: ignore[override] class LRU(LRI[_KT, _VT]): def __getitem__(self, key: _KT) -> _VT: ... -class _HashedKey(list[Incomplete]): - hash_value: Incomplete - def __init__(self, key) -> None: ... - def __hash__(self): ... - -def make_cache_key(args, kwargs, typed: bool = ..., kwarg_mark=..., fasttypes=...): ... +def make_cache_key( + args: Hashable, + kwargs: Hashable, + typed: bool = ..., + kwarg_mark: object = ..., + fasttypes: frozenset[int | str | bytes | frozenset[Any] | None] = ..., +): ... class CachedFunction: func: Incomplete @@ -54,7 +60,6 @@ class CachedFunction: class CachedMethod: func: Incomplete - __isabstractmethod__: Incomplete get_cache: Incomplete scoped: Incomplete typed: Incomplete @@ -64,46 +69,45 @@ class CachedMethod: def __get__(self, obj, objtype: Incomplete | None = ...): ... def __call__(self, *args, **kwargs): ... -def cached(cache, scoped: bool = ..., typed: bool = ..., key: Incomplete | None = ...): ... +def cached(cache: Mapping[Any, Any], scoped: bool = ..., typed: bool = ..., key: Incomplete | None = ...): ... def cachedmethod(cache, scoped: bool = ..., typed: bool = ..., key: Incomplete | None = ...): ... -class cachedproperty: - __isabstractmethod__: Incomplete - func: Incomplete - def __init__(self, func) -> None: ... - def __get__(self, obj, objtype: Incomplete | None = ...): ... +class cachedproperty(Generic[_T]): + func: Callable[..., _T] + def __init__(self, func: Callable[..., _T]) -> None: ... + def __get__(self, obj: _T, objtype: type | None = ...): ... -class ThresholdCounter: +class ThresholdCounter(Generic[_T]): total: int def __init__(self, threshold: float = ...) -> None: ... @property - def threshold(self): ... - def add(self, key) -> None: ... - def elements(self): ... - def most_common(self, n: Incomplete | None = ...): ... - def get_common_count(self): ... - def get_uncommon_count(self): ... - def get_commonality(self): ... - def __getitem__(self, key): ... - def __len__(self): ... - def __contains__(self, key): ... - def iterkeys(self): ... - def keys(self): ... - def itervalues(self) -> Generator[Incomplete, None, None]: ... - def values(self): ... - def iteritems(self) -> Generator[Incomplete, None, None]: ... - def items(self): ... - def get(self, key, default: int = ...): ... - def update(self, iterable, **kwargs) -> None: ... + def threshold(self) -> float: ... + def add(self, key: _T) -> None: ... + def elements(self) -> Iterator[_T]: ... + def most_common(self, n: int | 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 = ...) -> int: ... + def update(self, iterable: Iterable[_T] | Mapping[_T, int], **kwargs: Iterable[_T] | Mapping[_T, int]) -> None: ... -class MinIDMap: - mapping: Incomplete - ref_map: Incomplete - free: Incomplete +class MinIDMap(Generic[_T]): + mapping: dict[_T, int] + ref_map: dict[_T, int] + free: list[int] def __init__(self) -> None: ... - def get(self, a): ... - def drop(self, a) -> None: ... - def __contains__(self, a): ... - def __iter__(self): ... - def __len__(self): ... - def iteritems(self): ... + 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) -> Generator[_T, None, None]: ... From 9d1128c0c9886658c6e7a7eba94ac60d2e12cfae Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Tue, 6 Jun 2023 20:31:37 -0700 Subject: [PATCH 45/51] Many fixes --- stubs/boltons/@tests/stubtest_allowlist.txt | 6 --- stubs/boltons/METADATA.toml | 2 +- stubs/boltons/boltons/cacheutils.pyi | 40 +++++++++-------- stubs/boltons/boltons/debugutils.pyi | 5 ++- stubs/boltons/boltons/deprutils.pyi | 6 +-- stubs/boltons/boltons/dictutils.pyi | 27 ++++++------ stubs/boltons/boltons/ecoutils.pyi | 4 +- stubs/boltons/boltons/excutils.pyi | 5 ++- stubs/boltons/boltons/fileutils.pyi | 49 ++++++++++----------- stubs/boltons/boltons/formatutils.pyi | 14 +++--- stubs/boltons/boltons/funcutils.pyi | 3 -- stubs/boltons/boltons/gcutils.pyi | 10 ++--- stubs/boltons/boltons/ioutils.pyi | 2 +- stubs/boltons/boltons/iterutils.pyi | 10 ++--- stubs/boltons/boltons/jsonutils.pyi | 24 +++++++--- stubs/boltons/boltons/listutils.pyi | 35 ++++++++------- stubs/boltons/boltons/mathutils.pyi | 23 +++++----- stubs/boltons/boltons/mboxutils.pyi | 5 +-- stubs/boltons/boltons/namedutils.pyi | 7 ++- stubs/boltons/boltons/queueutils.pyi | 12 ++--- stubs/boltons/boltons/socketutils.pyi | 13 +++--- stubs/boltons/boltons/statsutils.pyi | 35 ++++++++------- stubs/boltons/boltons/strutils.pyi | 12 ++--- stubs/boltons/boltons/tableutils.pyi | 2 - stubs/boltons/boltons/tbutils.pyi | 26 +++++------ stubs/boltons/boltons/timeutils.pyi | 5 +-- stubs/boltons/boltons/typeutils.pyi | 2 +- stubs/boltons/boltons/urlutils.pyi | 7 +-- 28 files changed, 192 insertions(+), 199 deletions(-) diff --git a/stubs/boltons/@tests/stubtest_allowlist.txt b/stubs/boltons/@tests/stubtest_allowlist.txt index 317083328bd8..60966015ac7a 100644 --- a/stubs/boltons/@tests/stubtest_allowlist.txt +++ b/stubs/boltons/@tests/stubtest_allowlist.txt @@ -1,9 +1,3 @@ # These names exist in __all__, but have no definition: boltons.strutils.int_list_complement boltons.strutils.int_list_to_int_tuples - -# error: boltons.ecoutils failed to import, AttributeError: module 'pprint' has no attribute '_safe_repr' -# See https://github.com/mahmoud/boltons/issues/294 -# This bug is fixed only in the development version (on github). -# In the PyPI repository version the bug is not fixed -boltons.ecoutils diff --git a/stubs/boltons/METADATA.toml b/stubs/boltons/METADATA.toml index 1f08a40912f2..0243ddf543f1 100644 --- a/stubs/boltons/METADATA.toml +++ b/stubs/boltons/METADATA.toml @@ -1,4 +1,4 @@ -version = "21.0.*" +version = "23.0.*" [tool.stubtest] ignore_missing_stub = false diff --git a/stubs/boltons/boltons/cacheutils.pyi b/stubs/boltons/boltons/cacheutils.pyi index b74a8c3a95cc..4913cead6eed 100644 --- a/stubs/boltons/boltons/cacheutils.pyi +++ b/stubs/boltons/boltons/cacheutils.pyi @@ -1,13 +1,12 @@ -from _typeshed import Incomplete, Self +from _typeshed import Incomplete, Self, SupportsItems, SupportsKeysAndGetItem from collections.abc import Callable, Generator, Hashable, Iterable, Iterator, Mapping -from typing import Any, Generic, NoReturn, TypeVar, overload +from typing import Any, Generic, TypeVar, overload +import weakref _KT = TypeVar("_KT") _VT = TypeVar("_VT") _T = TypeVar("_T") -xrange = range -basestring: tuple[type[str], type[bytes]] PREV: int NEXT: int KEY: int @@ -26,27 +25,30 @@ class LRI(dict[_KT, _VT]): @overload def get(self, key: _KT, default: None = None) -> _VT | None: ... @overload - def get(self, key: _KT, default: _T | _VT = ...) -> _T | _VT: ... - def __delitem__(self, key: _KT) -> NoReturn: ... - def pop(self, key: _KT, default: _T | _VT = ...) -> _T | _VT: ... + 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, **F) -> None: ... # type: ignore[override] + 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: Hashable, - kwargs: Hashable, - typed: bool = ..., + args: Iterable[Hashable], + kwargs: SupportsItems[Hashable, Hashable], + typed: bool = False, kwarg_mark: object = ..., - fasttypes: frozenset[int | str | bytes | frozenset[Any] | None] = ..., + fasttypes: frozenset[type] = ..., ): ... class CachedFunction: @@ -55,7 +57,7 @@ class CachedFunction: scoped: Incomplete typed: Incomplete key_func: Incomplete - def __init__(self, func, cache, scoped: bool = ..., typed: bool = ..., key: Incomplete | None = ...): ... + def __init__(self, func, cache, scoped: bool = True, typed: bool = False, key: Incomplete | None = ...): ... def __call__(self, *args, **kwargs): ... class CachedMethod: @@ -65,7 +67,7 @@ class CachedMethod: typed: Incomplete key_func: Incomplete bound_to: Incomplete - def __init__(self, func, cache, scoped: bool = ..., typed: bool = ..., key: Incomplete | None = ...): ... + def __init__(self, func, cache, scoped: bool = True, typed: bool = False, key: Incomplete | None = ...): ... def __get__(self, obj, objtype: Incomplete | None = ...): ... def __call__(self, *args, **kwargs): ... @@ -73,8 +75,8 @@ def cached(cache: Mapping[Any, Any], scoped: bool = ..., typed: bool = ..., key: def cachedmethod(cache, scoped: bool = ..., typed: bool = ..., key: Incomplete | None = ...): ... class cachedproperty(Generic[_T]): - func: Callable[..., _T] - def __init__(self, func: Callable[..., _T]) -> None: ... + func: Callable[[Incomplete], _T] + def __init__(self, func: Callable[[Incomplete], _T]) -> None: ... def __get__(self, obj: _T, objtype: type | None = ...): ... class ThresholdCounter(Generic[_T]): @@ -101,7 +103,7 @@ class ThresholdCounter(Generic[_T]): def update(self, iterable: Iterable[_T] | Mapping[_T, int], **kwargs: Iterable[_T] | Mapping[_T, int]) -> None: ... class MinIDMap(Generic[_T]): - mapping: dict[_T, int] + mapping: weakref.WeakKeyDictionary[_T, int] ref_map: dict[_T, int] free: list[int] def __init__(self) -> None: ... @@ -110,4 +112,4 @@ class MinIDMap(Generic[_T]): def __contains__(self, a: _T) -> bool: ... def __iter__(self) -> Iterator[_T]: ... def __len__(self) -> int: ... - def iteritems(self) -> Generator[_T, None, None]: ... + def iteritems(self) -> Iterator[tuple[_T, int]]: ... diff --git a/stubs/boltons/boltons/debugutils.pyi b/stubs/boltons/boltons/debugutils.pyi index 28538e7e9f1f..a3ff5c21a5dd 100644 --- a/stubs/boltons/boltons/debugutils.pyi +++ b/stubs/boltons/boltons/debugutils.pyi @@ -1,8 +1,9 @@ +from _typeshed import Incomplete from collections.abc import Callable from typing import Any def pdb_on_signal(signalnum: int | None = ...) -> None: ... def pdb_on_exception(limit: int = ...) -> None: ... def wrap_trace( - obj: object, hook: Callable[..., Any] = ..., which: str | None = ..., events: str | None = ..., label: str | None = ... -) -> object: ... + obj: Incomplete, hook: Callable[..., Any] = ..., which: str | None = ..., events: str | None = ..., label: str | None = ... +) -> Incomplete: ... diff --git a/stubs/boltons/boltons/deprutils.pyi b/stubs/boltons/boltons/deprutils.pyi index 448060b604a6..2e25d98e748e 100644 --- a/stubs/boltons/boltons/deprutils.pyi +++ b/stubs/boltons/boltons/deprutils.pyi @@ -1,8 +1,8 @@ from types import ModuleType -from typing import Any, NoReturn +from typing import Any class DeprecatableModule(ModuleType): - def __init__(self, module: ModuleType) -> NoReturn: ... + def __init__(self, module: ModuleType) -> None: ... def __getattribute__(self, name: str) -> Any: ... -def deprecate_module_member(mod_name: str, name: str, message: str) -> NoReturn: ... +def deprecate_module_member(mod_name: str, name: str, message: str) -> None: ... diff --git a/stubs/boltons/boltons/dictutils.pyi b/stubs/boltons/boltons/dictutils.pyi index bd26ccac3e19..496cd21ee8cf 100644 --- a/stubs/boltons/boltons/dictutils.pyi +++ b/stubs/boltons/boltons/dictutils.pyi @@ -1,7 +1,8 @@ -from _typeshed import Self +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 TypeAlias +from typing_extensions import TypeAlias, Self _KT = TypeVar("_KT") _VT = TypeVar("_VT") @@ -11,7 +12,7 @@ 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) -> Self: ... + def copy(self) -> Self: ... def counts(self) -> OrderedMultiDict[_KT, _VT]: ... @classmethod def fromkeys(cls, keys: _KT, default: _VT | None = ...) -> OrderedMultiDict[_KT, _VT]: ... # type: ignore[override] @@ -47,43 +48,43 @@ class FastIterOrderedMultiDict(OrderedMultiDict[_KT, _VT]): # undocumented class OneToOne(dict[_KT, _VT]): inv: dict[_VT, _KT] def clear(self) -> None: ... - def copy(self) -> OneToOne[_KT, _VT]: ... + 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 = ...) -> _VT: ... @classmethod - def unique(cls: type[Self], *a, **kw) -> Self: ... + def unique(cls, *a, **kw) -> Self: ... def update(self, dict_or_iterable, **kw) -> None: ... # type: ignore[override] -class ManyToMany(dict[_KT, tuple[_VT]]): - data: dict[_KT, _VT] - inv: dict[_VT, _KT] +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[object] | None = ...) -> None: ... + def __init__(self, items: Iterable[Incomplete] | None = ...) -> None: ... def __iter__(self): ... def __len__(self): ... def __setitem__(self, key: _KT, vals: tuple[_VT]) -> None: ... def add(self, key: _KT, val: _VT) -> None: ... - def get(self, key: _KT, default: frozenset[None] | _T = ...) -> frozenset[None] | _T: ... # type: ignore[override] + 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: tuple[_KT, _VT]) -> None: ... # type: ignore[override] + 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 = ..., drop: Iterable[_KT] | None = ...) -> dict[_KT, _VT]: ... class FrozenHashError(TypeError): ... # undocumented class FrozenDict(dict[_KT, _VT]): - def __copy__(self): ... + def __copy__(self) -> Self: ... def clear(self, *a, **kw) -> None: ... @classmethod def fromkeys(cls, keys: Iterable[_KT], value: _VT | 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: Self, *a, **kw) -> Self: ... + def updated(self, *a, **kw) -> Self: ... diff --git a/stubs/boltons/boltons/ecoutils.pyi b/stubs/boltons/boltons/ecoutils.pyi index 3605807c74bd..c3987b4bc3b1 100644 --- a/stubs/boltons/boltons/ecoutils.pyi +++ b/stubs/boltons/boltons/ecoutils.pyi @@ -1,4 +1,4 @@ -from typing import Any, NoReturn +from typing import Any ECO_VERSION: str PY_GT_2: bool @@ -24,5 +24,5 @@ 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 = ...) -> str: ... -def main() -> NoReturn: ... +def main() -> None: ... def dumps(val: Any, indent: int) -> str: ... diff --git a/stubs/boltons/boltons/excutils.pyi b/stubs/boltons/boltons/excutils.pyi index a606d4dca38b..5994c849e301 100644 --- a/stubs/boltons/boltons/excutils.pyi +++ b/stubs/boltons/boltons/excutils.pyi @@ -1,8 +1,9 @@ -from typing import Any, NoReturn +from typing import Any +from typing_extensions import Self class ExceptionCauseMixin(Exception): cause: Any - def __new__(cls, *args, **kw) -> NoReturn: ... + def __new__(cls, *args, **kw) -> Self: ... def get_str(self) -> str: ... class MathError(ExceptionCauseMixin, ValueError): ... diff --git a/stubs/boltons/boltons/fileutils.pyi b/stubs/boltons/boltons/fileutils.pyi index df2390a7f40f..ce3248a78c1b 100644 --- a/stubs/boltons/boltons/fileutils.pyi +++ b/stubs/boltons/boltons/fileutils.pyi @@ -2,11 +2,9 @@ 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 TypeAlias +from typing_extensions import Self -_PathReturn: TypeAlias = Any - -def mkdir_p(path: StrOrBytesPath) -> NoReturn: ... +def mkdir_p(path: StrOrBytesPath) -> None: ... class FilePerms: user: str @@ -14,9 +12,9 @@ class FilePerms: other: str def __init__(self, user: str = ..., group: str = ..., other: str = ...) -> None: ... @classmethod - def from_int(cls, i: int) -> FilePerms: ... + def from_int(cls, i: int) -> Self: ... @classmethod - def from_path(cls, path: StrOrBytesPath) -> FilePerms: ... + def from_path(cls, path: StrOrBytesPath) -> Self: ... def __int__(self) -> int: ... def atomic_save(dest_path: str, **kwargs) -> AtomicSaver: ... @@ -30,53 +28,52 @@ class AtomicSaver: rm_part_on_exc: bool text_mode: bool buffering: int - dest_dir: StrOrBytesPath - part_path: StrOrBytesPath + dest_dir: str + part_path: str mode: str open_flags: int - part_file: str - def __init__(self, dest_path: str, **kwargs) -> NoReturn: ... - def setup(self) -> NoReturn: ... + 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 - ) -> NoReturn: ... + ) -> None: ... def iter_find_files( - directory: str, patterns: str | list[Any], ignored: str | list[Any] | None = ..., include_dirs: bool = ... + directory: str, patterns: str | Iterable[str], ignored: str | Iterable[str] | None = ..., include_dirs: bool = ... ) -> Generator[str, None, None]: ... def copy_tree( src: StrOrBytesPath, dst: StrOrBytesPath, symlinks: bool = ..., ignore: None | Callable[[str, list[str]], Iterable[str]] | Callable[[StrOrBytesPath, list[str]], Iterable[str]] = ..., -) -> _PathReturn: ... +) -> None: ... copytree = copy_tree -file = object -class DummyFile(file): +class DummyFile: name: str mode: str closed: bool - errors: list[str] + errors: None isatty: bool - encoding: str - newlines: list[str] + encoding: None + newlines: None softspace: int def __init__(self, path: StrOrBytesPath, mode: str = ..., buffering: int | None = ...) -> None: ... - def close(self) -> NoReturn: ... + def close(self) -> None: ... def fileno(self) -> int: ... - def flush(self) -> NoReturn: ... + def flush(self) -> None: ... def next(self) -> NoReturn: ... def read(self, size: int = ...) -> str: ... def readline(self, size: int = ...) -> str: ... def readlines(self, size: int = ...) -> list[str]: ... - def seek(self) -> NoReturn: ... + def seek(self) -> None: ... def tell(self) -> int: ... - def truncate(self) -> NoReturn: ... - def write(self, string: str) -> NoReturn: ... + 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) -> NoReturn: ... - def __exit__(self, exc_type, exc_val, exc_tb) -> NoReturn: ... + def __enter__(self) -> None: ... + def __exit__(self, exc_type, exc_val, exc_tb) -> None: ... diff --git a/stubs/boltons/boltons/formatutils.pyi b/stubs/boltons/boltons/formatutils.pyi index 763260469e25..0bf4bd7aed92 100644 --- a/stubs/boltons/boltons/formatutils.pyi +++ b/stubs/boltons/boltons/formatutils.pyi @@ -1,10 +1,10 @@ from collections.abc import Callable -from typing import Any, NoReturn +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[str]]: ... -def tokenize_format_str(fstr: str, resolve_pos: bool = ...) -> list[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 = ...) -> list[str | BaseFormatField]: ... class BaseFormatField: def __init__(self, fname: str, fspec: str = ..., conv: str | None = ...) -> None: ... @@ -12,22 +12,22 @@ class BaseFormatField: fname: str subpath: str is_positional: bool - def set_fname(self, fname: str) -> NoReturn: ... + def set_fname(self, fname: str) -> None: ... subfields: list[str] fspec: str type_char: str type_func: str - def set_fspec(self, fspec) -> NoReturn: ... + def set_fspec(self, fspec) -> None: ... conv: str conv_func: str | None - def set_conv(self, conv: str) -> NoReturn: ... + 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 = ...) -> NoReturn: ... + def __init__(self, func: Callable[..., Any], cache_value: bool = ...) -> None: ... def get_value(self) -> Any: ... def __int__(self) -> int: ... def __float__(self) -> float: ... diff --git a/stubs/boltons/boltons/funcutils.pyi b/stubs/boltons/boltons/funcutils.pyi index 362787a47c06..2e4ffb11d3fc 100644 --- a/stubs/boltons/boltons/funcutils.pyi +++ b/stubs/boltons/boltons/funcutils.pyi @@ -2,10 +2,7 @@ import functools from _typeshed import Incomplete from functools import total_ordering as total_ordering -make_method: Incomplete -basestring: Incomplete NO_DEFAULT: Incomplete -inspect_formatargspec: Incomplete def get_module_callables(mod, ignore: Incomplete | None = ...): ... def mro_items(type_obj): ... diff --git a/stubs/boltons/boltons/gcutils.pyi b/stubs/boltons/boltons/gcutils.pyi index 1a6eef3b619b..05f47721839c 100644 --- a/stubs/boltons/boltons/gcutils.pyi +++ b/stubs/boltons/boltons/gcutils.pyi @@ -1,14 +1,14 @@ -from typing import NoReturn, TypeVar +from typing import TypeVar _T = TypeVar("_T") -def get_all(type_obj: _T, include_subtypes: bool = ...) -> list[_T]: ... +def get_all(type_obj: type[_T], include_subtypes: bool = ...) -> list[_T]: ... class GCToggler: postcollect: bool - def __init__(self, postcollect: bool = ...) -> NoReturn: ... - def __enter__(self) -> NoReturn: ... - def __exit__(self, exc_type, exc_val, exc_tb) -> NoReturn: ... + def __init__(self, postcollect: bool = ...) -> None: ... + def __enter__(self) -> None: ... + def __exit__(self, exc_type, exc_val, exc_tb) -> None: ... toggle_gc: GCToggler toggle_gc_postcollect: GCToggler diff --git a/stubs/boltons/boltons/ioutils.pyi b/stubs/boltons/boltons/ioutils.pyi index ce7ba00d2bde..44384a35419d 100644 --- a/stubs/boltons/boltons/ioutils.pyi +++ b/stubs/boltons/boltons/ioutils.pyi @@ -84,7 +84,7 @@ class SpooledStringIO(SpooledIOBase): @property def len(self): ... -def is_text_fileobj(fileobj): ... +def is_text_fileobj(fileobj) -> bool: ... class MultiFileReader: def __init__(self, *fileobjs) -> None: ... diff --git a/stubs/boltons/boltons/iterutils.pyi b/stubs/boltons/boltons/iterutils.pyi index eb1dedad32a4..fce664975a04 100644 --- a/stubs/boltons/boltons/iterutils.pyi +++ b/stubs/boltons/boltons/iterutils.pyi @@ -1,13 +1,9 @@ from _typeshed import Incomplete from collections.abc import Generator -basestring: Incomplete -unicode = str -xrange: Incomplete - -def is_iterable(obj): ... -def is_scalar(obj): ... -def is_collection(obj): ... +def is_iterable(obj) -> bool: ... +def is_scalar(obj) -> bool: ... +def is_collection(obj) -> bool: ... def split(src, sep: Incomplete | None = ..., maxsplit: Incomplete | None = ...): ... def split_iter( src, sep: Incomplete | None = ..., maxsplit: Incomplete | None = ... diff --git a/stubs/boltons/boltons/jsonutils.pyi b/stubs/boltons/boltons/jsonutils.pyi index 3490eb42b185..da0a30ab193c 100644 --- a/stubs/boltons/boltons/jsonutils.pyi +++ b/stubs/boltons/boltons/jsonutils.pyi @@ -1,17 +1,27 @@ from collections.abc import Generator -from typing import IO, Any, AnyStr, NoReturn +from typing import IO, Any, overload +from typing_extensions import Self +@overload def reverse_iter_lines( - file_obj: IO[AnyStr], blocksize: int = ..., preseek: bool = ..., encoding: AnyStr | None = ... -) -> Generator[AnyStr, None, None]: ... + file_obj: IO[bytes], blocksize: int = ..., preseek: bool = ..., encoding: None = ... +) -> Generator[bytes, None, None]: ... +@overload +def reverse_iter_lines( + file_obj: IO[str], blocksize: int = ..., preseek: bool = ..., *, 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[AnyStr], ignore_errors: bool = ..., reverse: bool = ..., rel_seek: float | None = ... + self, file_obj: IO[str], ignore_errors: bool = ..., reverse: bool = ..., rel_seek: float | None = ... ) -> None: ... @property def cur_byte_pos(self) -> int: ... - def __iter__(self) -> NoReturn: ... - def next(self) -> Any | NoReturn: ... - __next__: Any | NoReturn + def __iter__(self) -> Self: ... + def next(self) -> Any: ... + __next__ = next diff --git a/stubs/boltons/boltons/listutils.pyi b/stubs/boltons/boltons/listutils.pyi index 8002ba9422d9..6c58f6b4dffd 100644 --- a/stubs/boltons/boltons/listutils.pyi +++ b/stubs/boltons/boltons/listutils.pyi @@ -1,30 +1,33 @@ from collections.abc import Iterable -from typing import Any, NoReturn -from typing_extensions import SupportsIndex, TypeAlias +from typing import TypeVar, overload +from typing_extensions import Self, SupportsIndex, TypeAlias -xrange = range +_T = TypeVar("_T") -class BarrelList(list[Any]): - lists: list[list[Any]] - def __init__(self, iterable: Iterable[Any] | None = ...) -> None: ... - def insert(self, index: SupportsIndex, item: Any) -> None: ... - def append(self, item: Any) -> None: ... - def extend(self, iterable: Iterable[Any]) -> None: ... - def pop(self, *a) -> Any | NoReturn: ... - def iter_slice(self, start: int, stop: int, step: int | None = ...): ... +class BarrelList(list[_T]): + lists: list[list[_T]] + @overload + def __init__(self, iterable: 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 = ...) -> Iterable[_T]: ... def del_slice(self, start: int, stop: int, step: int | None = ...) -> None: ... __delslice__ = del_slice @classmethod - def from_iterable(cls, it): ... + 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: Any) -> int: ... - def index(self, item: Any) -> int: ... # type: ignore[override] + def count(self, item: _T) -> int: ... + def index(self, item: _T) -> int: ... # type: ignore[override] -BList: TypeAlias = BarrelList +BList: TypeAlias = BarrelList[_T] -class SplayList(list[Any]): +class SplayList(list[_T]): def shift(self, item_index: int, dest_index: int = ...) -> None: ... def swap(self, item_index: int, dest_index: int) -> None: ... diff --git a/stubs/boltons/boltons/mathutils.pyi b/stubs/boltons/boltons/mathutils.pyi index e20eddcd223c..dede1e27eab2 100644 --- a/stubs/boltons/boltons/mathutils.pyi +++ b/stubs/boltons/boltons/mathutils.pyi @@ -1,23 +1,20 @@ -from collections.abc import Iterable -from typing import NoReturn +from collections.abc import Sequence def clamp(x: float, lower: float = ..., upper: float = ...) -> float: ... -def ceil(x: float, options: Iterable[float] | None = ...) -> float: ... -def floor(x: float, options: Iterable[float] | None = ...) -> float: ... - -unicode = str +def ceil(x: float, options: Sequence[float] | None = ...) -> float: ... +def floor(x: float, options: Sequence[float] | None = ...) -> float: ... class Bits: - val: int | list[bool] | str + val: int len: int - def __init__(self, val: int | list[bool] | str = ..., len_: int | None = ...) -> NoReturn: ... + def __init__(self, val: int | list[bool] | str | bytes = ..., len_: int | None = ...) -> None: ... def __getitem__(self, k) -> Bits | bool: ... def __len__(self) -> int: ... - def __eq__(self, other) -> bool: ... - def __or__(self, other) -> bool: ... - def __and__(self, other) -> bool: ... - def __lshift__(self, other) -> Bits: ... - def __rshift__(self, other) -> Bits: ... + def __eq__(self, other: Bits) -> 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: ... diff --git a/stubs/boltons/boltons/mboxutils.pyi b/stubs/boltons/boltons/mboxutils.pyi index 1cc291314759..59ebd7572d16 100644 --- a/stubs/boltons/boltons/mboxutils.pyi +++ b/stubs/boltons/boltons/mboxutils.pyi @@ -1,9 +1,8 @@ import mailbox -from typing import NoReturn DEFAULT_MAXMEM: int class mbox_readonlydir(mailbox.mbox): maxmem: int - def __init__(self, path: str, factory: type | None = ..., create: bool = ..., maxmem: int = ...) -> NoReturn: ... - def flush(self) -> NoReturn: ... + def __init__(self, path: str, factory: type | None = ..., create: bool = ..., maxmem: int = ...) -> None: ... + def flush(self) -> None: ... diff --git a/stubs/boltons/boltons/namedutils.pyi b/stubs/boltons/boltons/namedutils.pyi index 89c31b4cc3fd..d1284b00e300 100644 --- a/stubs/boltons/boltons/namedutils.pyi +++ b/stubs/boltons/boltons/namedutils.pyi @@ -1,2 +1,5 @@ -def namedtuple(typename: str, field_names: list[str], verbose: bool = ..., rename: bool = ...): ... -def namedlist(typename: str, field_names: list[str], verbose: bool = ..., rename: bool = ...): ... +from collections.abc import Sequence + + +def namedtuple(typename: str, field_names: Sequence[str], verbose: bool = ..., rename: bool = ...): ... +def namedlist(typename: str, field_names: Sequence[str], verbose: bool = ..., rename: bool = ...): ... diff --git a/stubs/boltons/boltons/queueutils.pyi b/stubs/boltons/boltons/queueutils.pyi index 958fabfc0779..5c1a05ccbaeb 100644 --- a/stubs/boltons/boltons/queueutils.pyi +++ b/stubs/boltons/boltons/queueutils.pyi @@ -1,12 +1,12 @@ -from typing import Any, NoReturn +from binascii import Incomplete from typing_extensions import TypeAlias class BasePriorityQueue: - def __init__(self, **kw) -> NoReturn: ... - def add(self, task: Any, priority: int | None = ...) -> NoReturn: ... - def remove(self, task: Any) -> NoReturn: ... - def peek(self, default: Any = ...) -> Any | NoReturn: ... - def pop(self, default: Any = ...) -> Any | NoReturn: ... + def __init__(self, **kw) -> None: ... + def add(self, task, priority: int | None = ...) -> None: ... + def remove(self, task) -> None: ... + def peek(self, default = ...) -> Incomplete: ... + def pop(self, default = ...) -> Incomplete: ... def __len__(self) -> int: ... class HeapPriorityQueue(BasePriorityQueue): ... diff --git a/stubs/boltons/boltons/socketutils.pyi b/stubs/boltons/boltons/socketutils.pyi index 7e2e767d2167..bcae599c67f5 100644 --- a/stubs/boltons/boltons/socketutils.pyi +++ b/stubs/boltons/boltons/socketutils.pyi @@ -1,4 +1,5 @@ import socket +from _typeshed import ReadableBuffer, SliceableBuffer DEFAULT_TIMEOUT: int DEFAULT_MAXSIZE: int @@ -6,7 +7,7 @@ DEFAULT_MAXSIZE: int class BufferedSocket: sock: socket.socket rbuf: bytes - sbuf: list[bytes] + sbuf: list[SliceableBuffer] maxsize: int timeout: int def __init__(self, sock: socket.socket, timeout: int = ..., maxsize: int = ..., recvsize: int = ...) -> None: ... @@ -19,16 +20,16 @@ class BufferedSocket: def recv(self, size: int, flags: int = ..., 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: bytes, timeout: float = ..., maxsize: int = ..., with_delimiter: bool = ...) -> bytes: ... + def recv_until(self, delimiter: ReadableBuffer, timeout: float = ..., maxsize: int = ..., with_delimiter: bool = ...) -> bytes: ... def recv_size(self, size: int, timeout: float = ...) -> bytes: ... - def send(self, data: bytes, flags: int = ..., timeout: float = ...) -> str: ... - def sendall(self, data: bytes, flags: int = ..., timeout: float = ...) -> str: ... + def send(self, data: SliceableBuffer, flags: int = ..., timeout: float = ...) -> str: ... + def sendall(self, data: SliceableBuffer, flags: int = ..., timeout: float = ...) -> str: ... def flush(self) -> None: ... - def buffer(self, data: bytes) -> 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 = ...) -> bytes | int: ... - def setsockopt(self, level: int, optname: int, value: int | bytes | None) -> bytes | int: ... + def setsockopt(self, level: int, optname: int, value: int | ReadableBuffer | None) -> bytes | int: ... @property def type(self) -> int: ... @property diff --git a/stubs/boltons/boltons/statsutils.pyi b/stubs/boltons/boltons/statsutils.pyi index 64d74482b8cf..d927ec109be2 100644 --- a/stubs/boltons/boltons/statsutils.pyi +++ b/stubs/boltons/boltons/statsutils.pyi @@ -1,21 +1,22 @@ +from binascii import Incomplete from collections.abc import Callable, Iterator -from typing import Any, NoReturn +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]) -> NoReturn: ... + def __init__(self, name: str, func: Callable[..., Any]) -> None: ... def __get__(self, obj: object, objtype: Any | None = ...) -> Any: ... class Stats: data: list[float] default: float - def __init__(self, data: list[float], default: float = ..., use_copy: bool = ..., is_sorted: bool = ...) -> NoReturn: ... + def __init__(self, data: list[float], default: float = ..., use_copy: bool = ..., is_sorted: bool = ...) -> None: ... def __len__(self) -> int: ... - def __iter__(self) -> Iterator[Any]: ... - def clear_cache(self) -> NoReturn: ... + def __iter__(self) -> Iterator[float]: ... + def clear_cache(self) -> None: ... count: _StatsProperty mean: _StatsProperty max: _StatsProperty @@ -33,7 +34,7 @@ class Stats: pearson_type: _StatsProperty def get_quantile(self, q: float) -> float: ... def get_zscore(self, value: float) -> float: ... - def trim_relative(self, amount: float = ...) -> NoReturn: ... + def trim_relative(self, amount: float = ...) -> None: ... def get_histogram_counts(self, bins: int | None = ..., **kw) -> int: ... def format_histogram(self, bins: int | None = ..., **kw) -> str: ... def describe(self, quantiles: list[float] | None = ..., format: str | None = ...) -> dict[str, float] | list[float] | str: ... @@ -42,17 +43,17 @@ def describe( data: list[float], quantiles: list[float] | None = ..., format: str | None = ... ) -> dict[str, float] | list[float] | str: ... -mean: Any -median: Any -iqr: Any -trimean: Any -variance: Any -std_dev: Any -median_abs_dev: Any -rel_std_dev: Any -skewness: Any -kurtosis: Any -pearson_type: Any +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 = ..., format_bin: Callable[..., Any] | None = ... diff --git a/stubs/boltons/boltons/strutils.pyi b/stubs/boltons/boltons/strutils.pyi index 2c4a6bf3e37e..c4b2bbfc4b57 100644 --- a/stubs/boltons/boltons/strutils.pyi +++ b/stubs/boltons/boltons/strutils.pyi @@ -1,6 +1,6 @@ from collections.abc import Callable, Generator, Iterable from html.parser import HTMLParser -from typing import Any, NoReturn, TypeVar +from typing import Any, TypeVar _KT = TypeVar("_KT") _VT = TypeVar("_VT") @@ -32,10 +32,10 @@ class HTMLTextExtractor(HTMLParser): strict: bool convert_charrefs: bool result: list[str] - def __init__(self) -> NoReturn: ... - def handle_data(self, d: str) -> NoReturn: ... - def handle_charref(self, number: str) -> NoReturn: ... - def handle_entityref(self, name: str) -> NoReturn: ... + 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: ... @@ -53,7 +53,7 @@ def format_int_list(int_list: list[int], delim: str = ..., range_delim: str = .. class MultiReplace: group_map: dict[str, str] combined_pattern: str - def __init__(self, sub_map: dict[str, str], **kwargs) -> NoReturn: ... + 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: ... diff --git a/stubs/boltons/boltons/tableutils.pyi b/stubs/boltons/boltons/tableutils.pyi index d997451845cc..e39f009e5a57 100644 --- a/stubs/boltons/boltons/tableutils.pyi +++ b/stubs/boltons/boltons/tableutils.pyi @@ -1,7 +1,5 @@ from _typeshed import Incomplete -unicode = str - class UnsupportedData(TypeError): ... class InputType: diff --git a/stubs/boltons/boltons/tbutils.pyi b/stubs/boltons/boltons/tbutils.pyi index 6dc90f763106..93db527942d4 100644 --- a/stubs/boltons/boltons/tbutils.pyi +++ b/stubs/boltons/boltons/tbutils.pyi @@ -1,9 +1,7 @@ -from _typeshed import Self from collections.abc import Iterator from types import FrameType, TracebackType from typing import Any - -text = str +from typing_extensions import Self class Callpoint: func_name: str @@ -17,11 +15,11 @@ class Callpoint: ) -> None: ... def to_dict(self) -> dict[str, object]: ... @classmethod - def from_current(cls: Self, level: int = ...) -> Self: ... + def from_current(cls, level: int = ...) -> Self: ... @classmethod - def from_frame(cls: Self, frame: FrameType) -> Self: ... + def from_frame(cls, frame: FrameType) -> Self: ... @classmethod - def from_tb(cls: Self, tb: TracebackType) -> Self: ... + def from_tb(cls, tb: TracebackType) -> Self: ... def tb_frame_str(self) -> str: ... class TracebackInfo: @@ -29,11 +27,11 @@ class TracebackInfo: frames: list[FrameType] def __init__(self, frames: list[FrameType]) -> None: ... @classmethod - def from_frame(cls: Self, frame: FrameType | None = ..., level: int = ..., limit: int | None = ...) -> Self: ... + def from_frame(cls, frame: FrameType | None = ..., level: int = ..., limit: int | None = ...) -> Self: ... @classmethod - def from_traceback(cls: Self, tb: TracebackType | None = ..., limit: int | None = ...) -> Self: ... + def from_traceback(cls, tb: TracebackType | None = ..., limit: int | None = ...) -> Self: ... @classmethod - def from_dict(cls: Self, d: dict[str, list[FrameType]]) -> Self: ... + 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]: ... @@ -46,9 +44,9 @@ class ExceptionInfo: tb_info: TracebackInfo def __init__(self, exc_type: str, exc_msg: str, tb_info: TracebackInfo) -> None: ... @classmethod - def from_exc_info(cls: Self, exc_type: str, exc_value: Any, traceback: TracebackType) -> Self: ... + def from_exc_info(cls, exc_type: str, exc_value: Any, traceback: TracebackType) -> Self: ... @classmethod - def from_current(cls: Self) -> Self: ... + 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: ... @@ -59,9 +57,9 @@ class ContextualCallpoint(Callpoint): post_lines: list[str] def __init__(self, *a, **kw) -> None: ... @classmethod - def from_frame(cls: Self, frame: FrameType) -> Self: ... + def from_frame(cls, frame: FrameType) -> Self: ... @classmethod - def from_tb(cls: Self, tb: TracebackType) -> Self: ... + def from_tb(cls, tb: TracebackType) -> Self: ... def to_dict(self) -> dict[str, Any]: ... class ContextualTracebackInfo(TracebackInfo): @@ -82,6 +80,6 @@ class ParsedException: def to_dict(self) -> dict[str, str | list[FrameType]]: ... def to_string(self) -> str: ... @classmethod - def from_string(cls: Self, tb_str: str) -> Self: ... + def from_string(cls, tb_str: str) -> Self: ... ParsedTB = ParsedException diff --git a/stubs/boltons/boltons/timeutils.pyi b/stubs/boltons/boltons/timeutils.pyi index 66c98fbfa0f6..ad5331e60c25 100644 --- a/stubs/boltons/boltons/timeutils.pyi +++ b/stubs/boltons/boltons/timeutils.pyi @@ -1,6 +1,5 @@ from collections.abc import Generator from datetime import date, datetime, timedelta, tzinfo -from typing import NoReturn def total_seconds(td: timedelta) -> float: ... def dt_to_timestamp(dt: datetime) -> int: ... @@ -22,7 +21,7 @@ HOUR: timedelta class ConstantTZInfo(tzinfo): name: str offset: timedelta - def __init__(self, name: str = ..., offset: timedelta = ...) -> NoReturn: ... + def __init__(self, name: str = ..., offset: timedelta = ...) -> None: ... @property def utcoffset_hours(self) -> str: ... def utcoffset(self, dt: datetime | None) -> timedelta: ... @@ -52,7 +51,7 @@ class USTimeZone(tzinfo): reprname: str stdname: str dstname: str - def __init__(self, hours: int, reprname: str, stdname: str, dstname: str) -> NoReturn: ... + 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: ... diff --git a/stubs/boltons/boltons/typeutils.pyi b/stubs/boltons/boltons/typeutils.pyi index a98e5afc0630..2c98e5885cf1 100644 --- a/stubs/boltons/boltons/typeutils.pyi +++ b/stubs/boltons/boltons/typeutils.pyi @@ -2,7 +2,7 @@ from typing import Any def make_sentinel(name: str = ..., var_name: str | None = ...) -> object: ... def issubclass(subclass: type, baseclass: type) -> bool: ... -def get_all_subclasses(cls) -> list[str]: ... +def get_all_subclasses(cls: type) -> list[type]: ... class classproperty: fn: Any diff --git a/stubs/boltons/boltons/urlutils.pyi b/stubs/boltons/boltons/urlutils.pyi index eb2f41a248d7..1e913c349463 100644 --- a/stubs/boltons/boltons/urlutils.pyi +++ b/stubs/boltons/boltons/urlutils.pyi @@ -1,10 +1,7 @@ -import ctypes from _typeshed import Incomplete from boltons.dictutils import OrderedMultiDict -unicode: Incomplete -unichr = chr SCHEME_PORT_MAP: Incomplete NO_NETLOC_SCHEMES: Incomplete @@ -12,7 +9,7 @@ class URLParseError(ValueError): ... DEFAULT_ENCODING: str -def to_unicode(obj): ... +def to_unicode(obj: object) -> str: ... def find_all_links(text, with_text: bool = ..., default_scheme: str = ..., schemes=...): ... def quote_path_part(text, full_quote: bool = ...): ... def quote_query_part(text, full_quote: bool = ...): ... @@ -69,8 +66,6 @@ class URL: def __eq__(self, other): ... def __ne__(self, other): ... -class _sockaddr(ctypes.Structure): ... - def parse_host(host): ... def parse_url(url_text): ... From f60417c56f1801b88a3dfad91dfd9d388efbac59 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Tue, 6 Jun 2023 20:32:02 -0700 Subject: [PATCH 46/51] black --- stubs/boltons/boltons/jsonutils.pyi | 4 +--- stubs/boltons/boltons/namedutils.pyi | 1 - stubs/boltons/boltons/queueutils.pyi | 4 ++-- stubs/boltons/boltons/socketutils.pyi | 4 +++- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/stubs/boltons/boltons/jsonutils.pyi b/stubs/boltons/boltons/jsonutils.pyi index da0a30ab193c..5e84ba09653b 100644 --- a/stubs/boltons/boltons/jsonutils.pyi +++ b/stubs/boltons/boltons/jsonutils.pyi @@ -11,9 +11,7 @@ def reverse_iter_lines( file_obj: IO[str], blocksize: int = ..., preseek: bool = ..., *, 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]: ... +def reverse_iter_lines(file_obj: IO[str], blocksize: int, preseek: bool, encoding: str) -> Generator[str, None, None]: ... class JSONLIterator: ignore_errors: bool diff --git a/stubs/boltons/boltons/namedutils.pyi b/stubs/boltons/boltons/namedutils.pyi index d1284b00e300..f835eb8e90bf 100644 --- a/stubs/boltons/boltons/namedutils.pyi +++ b/stubs/boltons/boltons/namedutils.pyi @@ -1,5 +1,4 @@ from collections.abc import Sequence - def namedtuple(typename: str, field_names: Sequence[str], verbose: bool = ..., rename: bool = ...): ... def namedlist(typename: str, field_names: Sequence[str], verbose: bool = ..., rename: bool = ...): ... diff --git a/stubs/boltons/boltons/queueutils.pyi b/stubs/boltons/boltons/queueutils.pyi index 5c1a05ccbaeb..428d985241b4 100644 --- a/stubs/boltons/boltons/queueutils.pyi +++ b/stubs/boltons/boltons/queueutils.pyi @@ -5,8 +5,8 @@ class BasePriorityQueue: def __init__(self, **kw) -> None: ... def add(self, task, priority: int | None = ...) -> None: ... def remove(self, task) -> None: ... - def peek(self, default = ...) -> Incomplete: ... - def pop(self, default = ...) -> Incomplete: ... + def peek(self, default=...) -> Incomplete: ... + def pop(self, default=...) -> Incomplete: ... def __len__(self) -> int: ... class HeapPriorityQueue(BasePriorityQueue): ... diff --git a/stubs/boltons/boltons/socketutils.pyi b/stubs/boltons/boltons/socketutils.pyi index bcae599c67f5..aabf14a895f0 100644 --- a/stubs/boltons/boltons/socketutils.pyi +++ b/stubs/boltons/boltons/socketutils.pyi @@ -20,7 +20,9 @@ class BufferedSocket: def recv(self, size: int, flags: int = ..., 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 = ...) -> bytes: ... + def recv_until( + self, delimiter: ReadableBuffer, timeout: float = ..., maxsize: int = ..., with_delimiter: bool = ... + ) -> bytes: ... def recv_size(self, size: int, timeout: float = ...) -> bytes: ... def send(self, data: SliceableBuffer, flags: int = ..., timeout: float = ...) -> str: ... def sendall(self, data: SliceableBuffer, flags: int = ..., timeout: float = ...) -> str: ... From 700ab61127c515f11d091cb880bfcfe835029629 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Tue, 6 Jun 2023 20:33:16 -0700 Subject: [PATCH 47/51] stubdefaulter --- stubs/boltons/boltons/cacheutils.pyi | 20 ++++++------ stubs/boltons/boltons/debugutils.pyi | 6 ++-- stubs/boltons/boltons/dictutils.pyi | 34 ++++++++++---------- stubs/boltons/boltons/ecoutils.pyi | 2 +- stubs/boltons/boltons/fileutils.pyi | 16 +++++----- stubs/boltons/boltons/formatutils.pyi | 6 ++-- stubs/boltons/boltons/funcutils.pyi | 24 +++++++------- stubs/boltons/boltons/gcutils.pyi | 4 +-- stubs/boltons/boltons/ioutils.pyi | 32 +++++++++---------- stubs/boltons/boltons/iterutils.pyi | 46 +++++++++++++-------------- stubs/boltons/boltons/jsonutils.pyi | 6 ++-- stubs/boltons/boltons/listutils.pyi | 8 ++--- stubs/boltons/boltons/mathutils.pyi | 8 ++--- stubs/boltons/boltons/mboxutils.pyi | 2 +- stubs/boltons/boltons/namedutils.pyi | 4 +-- stubs/boltons/boltons/pathutils.pyi | 14 ++++---- stubs/boltons/boltons/queueutils.pyi | 2 +- stubs/boltons/boltons/setutils.pyi | 8 ++--- stubs/boltons/boltons/socketutils.pyi | 18 +++++------ stubs/boltons/boltons/statsutils.pyi | 16 +++++----- stubs/boltons/boltons/strutils.pyi | 28 ++++++++-------- stubs/boltons/boltons/tableutils.pyi | 24 +++++++------- stubs/boltons/boltons/tbutils.pyi | 12 +++---- stubs/boltons/boltons/timeutils.pyi | 8 ++--- stubs/boltons/boltons/typeutils.pyi | 2 +- stubs/boltons/boltons/urlutils.pyi | 44 ++++++++++++------------- 26 files changed, 197 insertions(+), 197 deletions(-) diff --git a/stubs/boltons/boltons/cacheutils.pyi b/stubs/boltons/boltons/cacheutils.pyi index 4913cead6eed..f7c5b96e5efa 100644 --- a/stubs/boltons/boltons/cacheutils.pyi +++ b/stubs/boltons/boltons/cacheutils.pyi @@ -19,7 +19,7 @@ class LRI(dict[_KT, _VT]): soft_miss_count: int max_size: int on_miss: Callable[[_KT], _VT] - def __init__(self, max_size: int = ..., values: Incomplete | None = ..., on_miss: Incomplete | None = ...) -> None: ... + 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 @@ -57,7 +57,7 @@ class CachedFunction: scoped: Incomplete typed: Incomplete key_func: Incomplete - def __init__(self, func, cache, scoped: bool = True, typed: bool = False, key: Incomplete | None = ...): ... + def __init__(self, func, cache, scoped: bool = True, typed: bool = False, key: Incomplete | None = None): ... def __call__(self, *args, **kwargs): ... class CachedMethod: @@ -67,26 +67,26 @@ class CachedMethod: typed: Incomplete key_func: Incomplete bound_to: Incomplete - def __init__(self, func, cache, scoped: bool = True, typed: bool = False, key: Incomplete | None = ...): ... - def __get__(self, obj, objtype: Incomplete | None = ...): ... + 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 = ..., typed: bool = ..., key: Incomplete | None = ...): ... -def cachedmethod(cache, scoped: bool = ..., typed: bool = ..., key: Incomplete | None = ...): ... +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 = ...): ... + def __get__(self, obj: _T, objtype: type | None = None): ... class ThresholdCounter(Generic[_T]): total: int - def __init__(self, threshold: float = ...) -> None: ... + 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 = ...) -> list[tuple[_T, int]]: ... + 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: ... @@ -99,7 +99,7 @@ class ThresholdCounter(Generic[_T]): 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 = ...) -> 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]): diff --git a/stubs/boltons/boltons/debugutils.pyi b/stubs/boltons/boltons/debugutils.pyi index a3ff5c21a5dd..02a7df4faeff 100644 --- a/stubs/boltons/boltons/debugutils.pyi +++ b/stubs/boltons/boltons/debugutils.pyi @@ -2,8 +2,8 @@ from _typeshed import Incomplete from collections.abc import Callable from typing import Any -def pdb_on_signal(signalnum: int | None = ...) -> None: ... -def pdb_on_exception(limit: int = ...) -> None: ... +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 = ..., events: str | None = ..., label: str | None = ... + obj: Incomplete, hook: Callable[..., Any] = ..., which: str | None = None, events: str | None = None, label: str | None = None ) -> Incomplete: ... diff --git a/stubs/boltons/boltons/dictutils.pyi b/stubs/boltons/boltons/dictutils.pyi index 496cd21ee8cf..06ec03f866c5 100644 --- a/stubs/boltons/boltons/dictutils.pyi +++ b/stubs/boltons/boltons/dictutils.pyi @@ -15,25 +15,25 @@ class OrderedMultiDict(dict[_KT, _VT]): def copy(self) -> Self: ... def counts(self) -> OrderedMultiDict[_KT, _VT]: ... @classmethod - def fromkeys(cls, keys: _KT, default: _VT | None = ...) -> OrderedMultiDict[_KT, _VT]: ... # type: ignore[override] - def get(self, k: _KT, default: _VT | None = ...) -> OrderedMultiDict[_KT, _VT]: ... # type: ignore[override] + 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 = ...) -> list[tuple[_KT, _VT]]: ... # type: ignore[override] - def iteritems(self, multi: bool = ...) -> Generator[tuple[_KT, _VT], None, None]: ... - def iterkeys(self, multi: bool = ...) -> Generator[_KT, None, None]: ... - def itervalues(self, multi: bool = ...) -> Generator[_VT, None, None]: ... - def keys(self, multi: bool = ...) -> list[_KT]: ... # type: ignore[override] + 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 = ..., reverse: bool = ...) -> OrderedMultiDict[_KT, _VT]: ... - def sortedvalues(self, key: _KT | None = ..., reverse: bool = ...) -> OrderedMultiDict[_KT, _VT]: ... - def todict(self, multi: bool = ...) -> dict[_KT, _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 = ...) -> list[_VT]: ... # type: ignore[override] + 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]: ... @@ -42,8 +42,8 @@ OMD: TypeAlias = OrderedMultiDict[_KT, _VT] MultiDict: TypeAlias = OrderedMultiDict[_KT, _VT] class FastIterOrderedMultiDict(OrderedMultiDict[_KT, _VT]): # undocumented - def iteritems(self, multi: bool = ...) -> Generator[tuple[_KT, _VT], None, None]: ... - def iterkeys(self, multi: bool = ...) -> Generator[_KT, None, None]: ... + 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] @@ -51,7 +51,7 @@ class OneToOne(dict[_KT, _VT]): 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 = ...) -> _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] @@ -63,7 +63,7 @@ class ManyToMany(dict[_KT, frozenset[_VT]]): def __delitem__(self, key: _KT) -> None: ... def __eq__(self, other): ... def __getitem__(self, key: _KT): ... - def __init__(self, items: Iterable[Incomplete] | None = ...) -> None: ... + def __init__(self, items: Iterable[Incomplete] | None = None) -> None: ... def __iter__(self): ... def __len__(self): ... def __setitem__(self, key: _KT, vals: tuple[_VT]) -> None: ... @@ -75,7 +75,7 @@ class ManyToMany(dict[_KT, frozenset[_VT]]): 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 = ..., drop: Iterable[_KT] | None = ...) -> dict[_KT, _VT]: ... +def subdict(d: dict[_KT, _VT], keep: Iterable[_KT] | None = None, drop: Iterable[_KT] | None = None) -> dict[_KT, _VT]: ... class FrozenHashError(TypeError): ... # undocumented @@ -83,7 +83,7 @@ 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 = ...) -> FrozenDict[_KT, _VT]: ... # type: ignore[override] + 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: ... diff --git a/stubs/boltons/boltons/ecoutils.pyi b/stubs/boltons/boltons/ecoutils.pyi index c3987b4bc3b1..ef2da2178e60 100644 --- a/stubs/boltons/boltons/ecoutils.pyi +++ b/stubs/boltons/boltons/ecoutils.pyi @@ -23,6 +23,6 @@ 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 = ...) -> str: ... +def get_profile_json(indent: bool = False) -> str: ... def main() -> None: ... def dumps(val: Any, indent: int) -> str: ... diff --git a/stubs/boltons/boltons/fileutils.pyi b/stubs/boltons/boltons/fileutils.pyi index ce3248a78c1b..7360738f0a15 100644 --- a/stubs/boltons/boltons/fileutils.pyi +++ b/stubs/boltons/boltons/fileutils.pyi @@ -10,7 +10,7 @@ class FilePerms: user: str group: str other: str - def __init__(self, user: str = ..., group: str = ..., other: str = ...) -> None: ... + def __init__(self, user: str = '', group: str = '', other: str = '') -> None: ... @classmethod def from_int(cls, i: int) -> Self: ... @classmethod @@ -41,13 +41,13 @@ class AtomicSaver: ) -> None: ... def iter_find_files( - directory: str, patterns: str | Iterable[str], ignored: str | Iterable[str] | None = ..., include_dirs: bool = ... + 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 = ..., - ignore: None | Callable[[str, list[str]], Iterable[str]] | Callable[[StrOrBytesPath, list[str]], Iterable[str]] = ..., + symlinks: bool = False, + ignore: None | Callable[[str, list[str]], Iterable[str]] | Callable[[StrOrBytesPath, list[str]], Iterable[str]] = None, ) -> None: ... copytree = copy_tree @@ -61,14 +61,14 @@ class DummyFile: encoding: None newlines: None softspace: int - def __init__(self, path: StrOrBytesPath, mode: str = ..., buffering: int | None = ...) -> None: ... + 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 = ...) -> str: ... - def readline(self, size: int = ...) -> str: ... - def readlines(self, size: int = ...) -> list[str]: ... + 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: ... diff --git a/stubs/boltons/boltons/formatutils.pyi b/stubs/boltons/boltons/formatutils.pyi index 0bf4bd7aed92..868ef7e931d0 100644 --- a/stubs/boltons/boltons/formatutils.pyi +++ b/stubs/boltons/boltons/formatutils.pyi @@ -4,10 +4,10 @@ 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 = ...) -> list[str | BaseFormatField]: ... +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: ... + def __init__(self, fname: str, fspec: str = '', conv: str | None = None) -> None: ... base_name: str fname: str subpath: str @@ -27,7 +27,7 @@ class BaseFormatField: class DeferredValue: func: Callable[..., Any] cache_value: bool - def __init__(self, func: Callable[..., Any], cache_value: bool = ...) -> None: ... + def __init__(self, func: Callable[..., Any], cache_value: bool = True) -> None: ... def get_value(self) -> Any: ... def __int__(self) -> int: ... def __float__(self) -> float: ... diff --git a/stubs/boltons/boltons/funcutils.pyi b/stubs/boltons/boltons/funcutils.pyi index 2e4ffb11d3fc..1897538820b5 100644 --- a/stubs/boltons/boltons/funcutils.pyi +++ b/stubs/boltons/boltons/funcutils.pyi @@ -4,10 +4,10 @@ from functools import total_ordering as total_ordering NO_DEFAULT: Incomplete -def get_module_callables(mod, ignore: Incomplete | None = ...): ... +def get_module_callables(mod, ignore: Incomplete | None = None): ... def mro_items(type_obj): ... -def dir_dict(obj, raise_exc: bool = ...): ... -def copy_function(orig, copy_dict: bool = ...): ... +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]): @@ -22,30 +22,30 @@ class CachedInstancePartial(functools.partial[Incomplete]): partial = CachedInstancePartial -def format_invocation(name: str = ..., args=..., kwargs: Incomplete | None = ..., **kw): ... +def format_invocation(name: str = '', args=(), kwargs: Incomplete | None = None, **kw): ... def format_exp_repr( - obj, pos_names, req_names: Incomplete | None = ..., opt_names: Incomplete | None = ..., opt_key: Incomplete | None = ... + 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 = ..., opt_names: Incomplete | None = ..., opt_key: Incomplete | None = ... + obj, req_names: Incomplete | None = None, opt_names: Incomplete | None = None, opt_key: Incomplete | None = None ): ... -def wraps(func, injected: Incomplete | None = ..., expected: Incomplete | None = ..., **kw): ... +def wraps(func, injected: Incomplete | None = None, expected: Incomplete | None = None, **kw): ... def update_wrapper( - wrapper, func, injected: Incomplete | None = ..., expected: Incomplete | None = ..., build_from: Incomplete | None = ..., **kw + 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 = ...): ... + 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 = ..., add_source: bool = ..., with_dict: bool = ...): ... + 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 = ...): ... + def get_arg_names(self, only_required: bool = False): ... defaults: Incomplete - def add_arg(self, arg_name, default=..., kwonly: bool = ...) -> None: ... + def add_arg(self, arg_name, default=..., kwonly: bool = False) -> None: ... def remove_arg(self, arg_name) -> None: ... class MissingArgument(ValueError): ... diff --git a/stubs/boltons/boltons/gcutils.pyi b/stubs/boltons/boltons/gcutils.pyi index 05f47721839c..455af78e315e 100644 --- a/stubs/boltons/boltons/gcutils.pyi +++ b/stubs/boltons/boltons/gcutils.pyi @@ -2,11 +2,11 @@ from typing import TypeVar _T = TypeVar("_T") -def get_all(type_obj: type[_T], include_subtypes: bool = ...) -> list[_T]: ... +def get_all(type_obj: type[_T], include_subtypes: bool = True) -> list[_T]: ... class GCToggler: postcollect: bool - def __init__(self, postcollect: bool = ...) -> None: ... + def __init__(self, postcollect: bool = False) -> None: ... def __enter__(self) -> None: ... def __exit__(self, exc_type, exc_val, exc_tb) -> None: ... diff --git a/stubs/boltons/boltons/ioutils.pyi b/stubs/boltons/boltons/ioutils.pyi index 44384a35419d..e2586ac183f5 100644 --- a/stubs/boltons/boltons/ioutils.pyi +++ b/stubs/boltons/boltons/ioutils.pyi @@ -9,17 +9,17 @@ EINVAL: Incomplete class SpooledIOBase(metaclass=abc.ABCMeta): __metaclass__: Incomplete - def __init__(self, max_size: int = ..., dir: Incomplete | None = ...) -> None: ... + def __init__(self, max_size: int = 5000000, dir: Incomplete | None = None) -> None: ... @abstractmethod - def read(self, n: int = ...): ... + def read(self, n: int = -1): ... @abstractmethod def write(self, s): ... @abstractmethod - def seek(self, pos, mode: int = ...): ... + def seek(self, pos, mode: int = 0): ... @abstractmethod - def readline(self, length: Incomplete | None = ...): ... + def readline(self, length: Incomplete | None = None): ... @abstractmethod - def readlines(self, sizehint: int = ...): ... + def readlines(self, sizehint: int = 0): ... @abstractmethod def rollover(self): ... @abstractmethod @@ -42,7 +42,7 @@ class SpooledIOBase(metaclass=abc.ABCMeta): @property def buf(self): ... def fileno(self): ... - def truncate(self, size: Incomplete | None = ...): ... + def truncate(self, size: Incomplete | None = None): ... def getvalue(self): ... def seekable(self): ... def readable(self): ... @@ -58,11 +58,11 @@ class SpooledIOBase(metaclass=abc.ABCMeta): __nonzero__: Incomplete class SpooledBytesIO(SpooledIOBase): - def read(self, n: int = ...): ... + def read(self, n: int = -1): ... def write(self, s) -> None: ... - def seek(self, pos, mode: int = ...): ... - def readline(self, length: Incomplete | None = ...): ... - def readlines(self, sizehint: int = ...): ... + 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): ... @@ -72,11 +72,11 @@ class SpooledBytesIO(SpooledIOBase): class SpooledStringIO(SpooledIOBase): def __init__(self, *args, **kwargs) -> None: ... - def read(self, n: int = ...): ... + def read(self, n: int = -1): ... def write(self, s) -> None: ... - def seek(self, pos, mode: int = ...): ... - def readline(self, length: Incomplete | None = ...): ... - def readlines(self, sizehint: int = ...): ... + 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: ... @@ -88,5 +88,5 @@ def is_text_fileobj(fileobj) -> bool: ... class MultiFileReader: def __init__(self, *fileobjs) -> None: ... - def read(self, amt: Incomplete | None = ...): ... - def seek(self, offset, whence=...) -> None: ... + def read(self, amt: Incomplete | None = None): ... + def seek(self, offset, whence=0) -> None: ... diff --git a/stubs/boltons/boltons/iterutils.pyi b/stubs/boltons/boltons/iterutils.pyi index fce664975a04..4ad2021702ac 100644 --- a/stubs/boltons/boltons/iterutils.pyi +++ b/stubs/boltons/boltons/iterutils.pyi @@ -4,35 +4,35 @@ 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 = ..., maxsplit: Incomplete | None = ...): ... +def split(src, sep: Incomplete | None = None, maxsplit: Incomplete | None = None): ... def split_iter( - src, sep: Incomplete | None = ..., maxsplit: Incomplete | None = ... + src, sep: Incomplete | None = None, maxsplit: Incomplete | None = None ) -> Generator[Incomplete, None, Incomplete]: ... -def lstrip(iterable, strip_value: Incomplete | None = ...): ... -def lstrip_iter(iterable, strip_value: Incomplete | None = ...) -> Generator[Incomplete, None, None]: ... -def rstrip(iterable, strip_value: Incomplete | None = ...): ... -def rstrip_iter(iterable, strip_value: Incomplete | None = ...) -> Generator[Incomplete, None, None]: ... -def strip(iterable, strip_value: Incomplete | None = ...): ... -def strip_iter(iterable, strip_value: Incomplete | None = ...): ... -def chunked(src, size, count: Incomplete | None = ..., **kw): ... +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 pairwise(src): ... def pairwise_iter(src): ... def windowed(src, size): ... def windowed_iter(src, size): ... -def xfrange(stop, start: Incomplete | None = ..., step: float = ...) -> Generator[Incomplete, None, None]: ... -def frange(stop, start: Incomplete | None = ..., step: float = ...): ... -def backoff(start, stop, count: Incomplete | None = ..., factor: float = ..., jitter: bool = ...): ... +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 = ..., factor: float = ..., jitter: bool = ... + 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 = ..., key_filter: Incomplete | 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 = ...): ... -def unique_iter(src, key: Incomplete | None = ...) -> Generator[Incomplete, None, Incomplete]: ... -def redundant(src, key: Incomplete | None = ..., groups: bool = ...): ... -def one(src, default: Incomplete | None = ..., key: Incomplete | None = ...): ... -def first(iterable, default: Incomplete | None = ..., key: Incomplete | None = ...): ... +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=...): ... @@ -48,12 +48,12 @@ class PathAccessError(KeyError, IndexError, TypeError): def __init__(self, exc, seg, path) -> None: ... def get_path(root, path, default=...): ... -def research(root, query=..., reraise: bool = ...): ... +def research(root, query=..., reraise: bool = False): ... class GUIDerator: size: Incomplete count: Incomplete - def __init__(self, size: int = ...) -> None: ... + def __init__(self, size: int = 24) -> None: ... pid: Incomplete salt: Incomplete def reseed(self) -> None: ... @@ -71,6 +71,6 @@ guid_iter: Incomplete seq_guid_iter: Incomplete def soft_sorted( - iterable, first: Incomplete | None = ..., last: Incomplete | None = ..., key: Incomplete | None = ..., reverse: bool = ... + iterable, first: Incomplete | None = None, last: Incomplete | None = None, key: Incomplete | None = None, reverse: bool = False ): ... -def untyped_sorted(iterable, key: Incomplete | None = ..., reverse: bool = ...): ... +def untyped_sorted(iterable, key: Incomplete | None = None, reverse: bool = False): ... diff --git a/stubs/boltons/boltons/jsonutils.pyi b/stubs/boltons/boltons/jsonutils.pyi index 5e84ba09653b..bd6a6d23fbea 100644 --- a/stubs/boltons/boltons/jsonutils.pyi +++ b/stubs/boltons/boltons/jsonutils.pyi @@ -4,11 +4,11 @@ from typing_extensions import Self @overload def reverse_iter_lines( - file_obj: IO[bytes], blocksize: int = ..., preseek: bool = ..., encoding: None = ... + 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 = ..., preseek: bool = ..., *, encoding: str + 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]: ... @@ -16,7 +16,7 @@ def reverse_iter_lines(file_obj: IO[str], blocksize: int, preseek: bool, encodin class JSONLIterator: ignore_errors: bool def __init__( - self, file_obj: IO[str], ignore_errors: bool = ..., reverse: bool = ..., rel_seek: float | None = ... + 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: ... diff --git a/stubs/boltons/boltons/listutils.pyi b/stubs/boltons/boltons/listutils.pyi index 6c58f6b4dffd..af490dc466fa 100644 --- a/stubs/boltons/boltons/listutils.pyi +++ b/stubs/boltons/boltons/listutils.pyi @@ -7,15 +7,15 @@ _T = TypeVar("_T") class BarrelList(list[_T]): lists: list[list[_T]] @overload - def __init__(self, iterable: None = ...) -> None: ... + 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 = ...) -> Iterable[_T]: ... - def del_slice(self, start: int, stop: int, step: int | None = ...) -> None: ... + 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: ... @@ -29,5 +29,5 @@ class BarrelList(list[_T]): BList: TypeAlias = BarrelList[_T] class SplayList(list[_T]): - def shift(self, item_index: int, dest_index: int = ...) -> None: ... + def shift(self, item_index: int, dest_index: int = 0) -> None: ... def swap(self, item_index: int, dest_index: int) -> None: ... diff --git a/stubs/boltons/boltons/mathutils.pyi b/stubs/boltons/boltons/mathutils.pyi index dede1e27eab2..101fcdc2cc1b 100644 --- a/stubs/boltons/boltons/mathutils.pyi +++ b/stubs/boltons/boltons/mathutils.pyi @@ -1,13 +1,13 @@ from collections.abc import Sequence def clamp(x: float, lower: float = ..., upper: float = ...) -> float: ... -def ceil(x: float, options: Sequence[float] | None = ...) -> float: ... -def floor(x: float, options: Sequence[float] | None = ...) -> 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 = ..., len_: int | None = ...) -> None: ... + 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: Bits) -> bool: ... @@ -28,6 +28,6 @@ class Bits: @classmethod def from_hex(cls, hex): ... @classmethod - def from_int(cls, int_, len_: int | None = ...): ... + def from_int(cls, int_, len_: int | None = None): ... @classmethod def from_bytes(cls, bytes_): ... diff --git a/stubs/boltons/boltons/mboxutils.pyi b/stubs/boltons/boltons/mboxutils.pyi index 59ebd7572d16..ca61fb7008dd 100644 --- a/stubs/boltons/boltons/mboxutils.pyi +++ b/stubs/boltons/boltons/mboxutils.pyi @@ -4,5 +4,5 @@ DEFAULT_MAXMEM: int class mbox_readonlydir(mailbox.mbox): maxmem: int - def __init__(self, path: str, factory: type | None = ..., create: bool = ..., maxmem: int = ...) -> None: ... + def __init__(self, path: str, factory: type | None = None, create: bool = True, maxmem: int = 1048576) -> None: ... def flush(self) -> None: ... diff --git a/stubs/boltons/boltons/namedutils.pyi b/stubs/boltons/boltons/namedutils.pyi index f835eb8e90bf..5d3f117f9784 100644 --- a/stubs/boltons/boltons/namedutils.pyi +++ b/stubs/boltons/boltons/namedutils.pyi @@ -1,4 +1,4 @@ from collections.abc import Sequence -def namedtuple(typename: str, field_names: Sequence[str], verbose: bool = ..., rename: bool = ...): ... -def namedlist(typename: str, field_names: Sequence[str], verbose: bool = ..., rename: bool = ...): ... +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): ... diff --git a/stubs/boltons/boltons/pathutils.pyi b/stubs/boltons/boltons/pathutils.pyi index f14f02f95a99..a936816fdb5c 100644 --- a/stubs/boltons/boltons/pathutils.pyi +++ b/stubs/boltons/boltons/pathutils.pyi @@ -1,11 +1,11 @@ def augpath( path: str, - suffix: str = ..., - prefix: str = ..., - ext: str | None = ..., - base: str | None = ..., - dpath: str | None = ..., - multidot: bool = ..., + 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 shrinkuser(path: str, home: str = '~') -> str: ... def expandpath(path: str) -> str: ... diff --git a/stubs/boltons/boltons/queueutils.pyi b/stubs/boltons/boltons/queueutils.pyi index 428d985241b4..701298e78911 100644 --- a/stubs/boltons/boltons/queueutils.pyi +++ b/stubs/boltons/boltons/queueutils.pyi @@ -3,7 +3,7 @@ from typing_extensions import TypeAlias class BasePriorityQueue: def __init__(self, **kw) -> None: ... - def add(self, task, priority: int | None = ...) -> 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: ... diff --git a/stubs/boltons/boltons/setutils.pyi b/stubs/boltons/boltons/setutils.pyi index 0cdaa13fc44a..9926b6fa7caa 100644 --- a/stubs/boltons/boltons/setutils.pyi +++ b/stubs/boltons/boltons/setutils.pyi @@ -7,7 +7,7 @@ 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: ... + def __init__(self, other: Iterable[Any] | None = None) -> None: ... def __len__(self) -> int: ... def __contains__(self, item: Any) -> bool: ... def __iter__(self) -> Iterator[Any]: ... @@ -39,9 +39,9 @@ class IndexedSet(MutableSet[Any]): 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 = ...) -> islice[Iterable[Any]]: ... + 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 = ...) -> Any: ... + def pop(self, index: int | None = None) -> Any: ... def count(self, val: Any) -> int: ... def reverse(self) -> None: ... def sort(self, **kwargs) -> None: ... @@ -50,7 +50,7 @@ class IndexedSet(MutableSet[Any]): def complement(wrapped: set[Any]) -> set[Any]: ... class _ComplementSet: - def __init__(self, included: set[Any] | None = ..., excluded: set[Any] | None = ...) -> None: ... + 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: ... diff --git a/stubs/boltons/boltons/socketutils.pyi b/stubs/boltons/boltons/socketutils.pyi index aabf14a895f0..f3218a12d093 100644 --- a/stubs/boltons/boltons/socketutils.pyi +++ b/stubs/boltons/boltons/socketutils.pyi @@ -10,27 +10,27 @@ class BufferedSocket: sbuf: list[SliceableBuffer] maxsize: int timeout: int - def __init__(self, sock: socket.socket, timeout: int = ..., maxsize: int = ..., recvsize: int = ...) -> None: ... + 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 = ..., timeout: float = ...) -> 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 = ... + 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 = ..., timeout: float = ...) -> str: ... - def sendall(self, data: SliceableBuffer, flags: int = ..., timeout: float = ...) -> str: ... + 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 = ...) -> bytes | int: ... + 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: ... @@ -47,16 +47,16 @@ class Error(socket.error): ... class ConnectionClosed(Error): ... class MessageTooLong(Error): - def __init__(self, bytes_read: int | None = ..., delimiter: str | None = ...) -> None: ... + 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: ... + def __init__(self, timeout: float, extra: str = '') -> None: ... class NetstringSocket: bsock: BufferedSocket timeout: float maxsize: int - def __init__(self, sock: socket.socket, timeout: float = ..., maxsize: int = ...) -> None: ... + 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: ... diff --git a/stubs/boltons/boltons/statsutils.pyi b/stubs/boltons/boltons/statsutils.pyi index d927ec109be2..34719e83ce77 100644 --- a/stubs/boltons/boltons/statsutils.pyi +++ b/stubs/boltons/boltons/statsutils.pyi @@ -8,12 +8,12 @@ class _StatsProperty: internal_name: str __doc__: str | None def __init__(self, name: str, func: Callable[..., Any]) -> None: ... - def __get__(self, obj: object, objtype: Any | None = ...) -> Any: ... + 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 = ..., use_copy: bool = ..., is_sorted: bool = ...) -> None: ... + 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: ... @@ -34,13 +34,13 @@ class Stats: pearson_type: _StatsProperty def get_quantile(self, q: float) -> float: ... def get_zscore(self, value: float) -> float: ... - def trim_relative(self, amount: float = ...) -> None: ... - def get_histogram_counts(self, bins: int | None = ..., **kw) -> int: ... - def format_histogram(self, bins: int | None = ..., **kw) -> str: ... - def describe(self, quantiles: list[float] | None = ..., format: str | None = ...) -> dict[str, float] | list[float] | str: ... + 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 = ..., format: str | None = ... + data: list[float], quantiles: list[float] | None = None, format: str | None = None ) -> dict[str, float] | list[float] | str: ... mean: Incomplete @@ -56,5 +56,5 @@ kurtosis: Incomplete pearson_type: Incomplete def format_histogram_counts( - bin_counts: list[float], width: int | None = ..., format_bin: Callable[..., Any] | None = ... + bin_counts: list[float], width: int | None = None, format_bin: Callable[..., Any] | None = None ) -> str: ... diff --git a/stubs/boltons/boltons/strutils.pyi b/stubs/boltons/boltons/strutils.pyi index c4b2bbfc4b57..c912aa74099d 100644 --- a/stubs/boltons/boltons/strutils.pyi +++ b/stubs/boltons/boltons/strutils.pyi @@ -9,24 +9,24 @@ unichr = chr def camel2under(camel_string: str) -> str: ... def under2camel(under_string: str) -> str: ... -def slugify(text: str, delim: str = ..., lower: bool = ..., ascii: bool = ...) -> 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 = ...) -> str: ... -def ordinalize(number: int | str, ext_only: bool = ...) -> 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 = ...): ... +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 = ...) -> str: ... +def bytes2human(nbytes: int, ndigits: int = 0) -> str: ... class HTMLTextExtractor(HTMLParser): strict: bool @@ -40,15 +40,15 @@ class HTMLTextExtractor(HTMLParser): def html2text(html: str) -> str: ... def gunzip_bytes(bytestring: bytes) -> bytes: ... -def gzip_bytes(bytestring: bytes, level: int = ...) -> int: ... +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 = ..., key: Callable[..., bool] = ...) -> str: ... -def is_uuid(obj, version: int = ...) -> bool: ... -def escape_shell_args(args: list[str], sep: str = ..., style: str | 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 = ...) -> str: ... +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] @@ -57,7 +57,7 @@ class MultiReplace: 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 = ...) -> str: ... +def unwrap_text(text: str, ending: str = '\n\n') -> str: ... # Names in __all__ with no definition: # int_list_complement diff --git a/stubs/boltons/boltons/tableutils.pyi b/stubs/boltons/boltons/tableutils.pyi index e39f009e5a57..ce6d5b72f2a8 100644 --- a/stubs/boltons/boltons/tableutils.pyi +++ b/stubs/boltons/boltons/tableutils.pyi @@ -38,26 +38,26 @@ class NamedTupleInputType(InputType): class Table: headers: Incomplete metadata: Incomplete - def __init__(self, data: Incomplete | None = ..., headers=..., metadata: Incomplete | None = ...) -> None: ... + 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 = ..., metadata: Incomplete | None = ...): ... + def from_dict(cls, data, headers=..., max_depth: int = 1, metadata: Incomplete | None = None): ... @classmethod - def from_list(cls, data, headers=..., max_depth: int = ..., metadata: Incomplete | None = ...): ... + def from_list(cls, data, headers=..., max_depth: int = 1, metadata: Incomplete | None = None): ... @classmethod - def from_object(cls, data, headers=..., max_depth: int = ..., metadata: Incomplete | None = ...): ... + def from_object(cls, data, headers=..., max_depth: int = 1, metadata: Incomplete | None = None): ... @classmethod - def from_data(cls, data, headers=..., max_depth: int = ..., **kwargs): ... + 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 = ..., - wrapped: bool = ..., - with_headers: bool = ..., - with_newlines: bool = ..., - with_metadata: bool = ..., - max_depth: int = ..., + 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 = ..., maxlen: Incomplete | None = ...): ... + def to_text(self, with_headers: bool = True, maxlen: Incomplete | None = None): ... diff --git a/stubs/boltons/boltons/tbutils.pyi b/stubs/boltons/boltons/tbutils.pyi index 93db527942d4..b0129b623748 100644 --- a/stubs/boltons/boltons/tbutils.pyi +++ b/stubs/boltons/boltons/tbutils.pyi @@ -11,11 +11,11 @@ class Callpoint: lasti: int line: str def __init__( - self, module_name: str, module_path: str, func_name: str, lineno: int, lasti: int, line: str | None = ... + 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 = ...) -> Self: ... + def from_current(cls, level: int = 1) -> Self: ... @classmethod def from_frame(cls, frame: FrameType) -> Self: ... @classmethod @@ -27,9 +27,9 @@ class TracebackInfo: frames: list[FrameType] def __init__(self, frames: list[FrameType]) -> None: ... @classmethod - def from_frame(cls, frame: FrameType | None = ..., level: int = ..., limit: int | None = ...) -> Self: ... + def from_frame(cls, frame: FrameType | None = None, level: int = 1, limit: int | None = None) -> Self: ... @classmethod - def from_traceback(cls, tb: TracebackType | None = ..., limit: int | None = ...) -> Self: ... + 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]]: ... @@ -68,13 +68,13 @@ class ContextualTracebackInfo(TracebackInfo): class ContextualExceptionInfo(ExceptionInfo): tb_info_type: type[ContextualTracebackInfo] -def print_exception(etype: str, value: Any, tb: TracebackType, limit: int | None = ..., file: str | None = ...) -> None: ... +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: ... + 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]]: ... diff --git a/stubs/boltons/boltons/timeutils.pyi b/stubs/boltons/boltons/timeutils.pyi index ad5331e60c25..90cb76d9fc52 100644 --- a/stubs/boltons/boltons/timeutils.pyi +++ b/stubs/boltons/boltons/timeutils.pyi @@ -9,11 +9,11 @@ def parse_timedelta(text: str) -> timedelta: ... parse_td = parse_timedelta def decimal_relative_time( - d: datetime, other: datetime | None = ..., ndigits: int = ..., cardinalize: bool = ... + d: datetime, other: datetime | None = None, ndigits: int = 0, cardinalize: bool = True ) -> tuple[float, str]: ... -def relative_time(d: datetime, other: datetime | None = ..., ndigits: int = ...) -> 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 = ..., inclusive: bool = ...) -> Generator[date, None, None]: ... +def daterange(start: date, stop: date, step: int = 1, inclusive: bool = False) -> Generator[date, None, None]: ... ZERO: timedelta HOUR: timedelta @@ -21,7 +21,7 @@ HOUR: timedelta class ConstantTZInfo(tzinfo): name: str offset: timedelta - def __init__(self, name: str = ..., offset: timedelta = ...) -> None: ... + def __init__(self, name: str = 'ConstantTZ', offset: timedelta = ...) -> None: ... @property def utcoffset_hours(self) -> str: ... def utcoffset(self, dt: datetime | None) -> timedelta: ... diff --git a/stubs/boltons/boltons/typeutils.pyi b/stubs/boltons/boltons/typeutils.pyi index 2c98e5885cf1..d082ed361369 100644 --- a/stubs/boltons/boltons/typeutils.pyi +++ b/stubs/boltons/boltons/typeutils.pyi @@ -1,6 +1,6 @@ from typing import Any -def make_sentinel(name: str = ..., var_name: str | None = ...) -> object: ... +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]: ... diff --git a/stubs/boltons/boltons/urlutils.pyi b/stubs/boltons/boltons/urlutils.pyi index 1e913c349463..83d2362771ca 100644 --- a/stubs/boltons/boltons/urlutils.pyi +++ b/stubs/boltons/boltons/urlutils.pyi @@ -10,21 +10,21 @@ class URLParseError(ValueError): ... DEFAULT_ENCODING: str def to_unicode(obj: object) -> str: ... -def find_all_links(text, with_text: bool = ..., default_scheme: str = ..., schemes=...): ... -def quote_path_part(text, full_quote: bool = ...): ... -def quote_query_part(text, full_quote: bool = ...): ... -def quote_fragment_part(text, full_quote: bool = ...): ... -def quote_userinfo_part(text, full_quote: bool = ...): ... -def unquote(string, encoding: str = ..., errors: 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 = ..., default_port: Incomplete | None = ...) -> None: ... +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 = ...): ... + def __get__(self, obj, objtype: Incomplete | None = None): ... class URL: scheme: Incomplete @@ -35,18 +35,18 @@ class URL: port: Incomplete path_parts: Incomplete fragment: Incomplete - def __init__(self, url: str = ...) -> None: ... + def __init__(self, url: str = '') -> None: ... @classmethod def from_parts( cls, - scheme: Incomplete | None = ..., - host: Incomplete | None = ..., - path_parts=..., - query_params=..., - fragment: str = ..., - port: Incomplete | None = ..., - username: Incomplete | None = ..., - password: Incomplete | None = ..., + 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 @@ -58,10 +58,10 @@ class URL: def uses_netloc(self): ... @property def default_port(self): ... - def normalize(self, with_case: bool = ...) -> None: ... + def normalize(self, with_case: bool = True) -> None: ... def navigate(self, dest): ... - def get_authority(self, full_quote: bool = ..., with_userinfo: bool = ...): ... - def to_text(self, full_quote: bool = ...): ... + 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): ... @@ -71,7 +71,7 @@ def parse_url(url_text): ... DEFAULT_PARSED_URL: Incomplete -def parse_qsl(qs, keep_blank_values: bool = ..., encoding=...): ... +def parse_qsl(qs, keep_blank_values: bool = True, encoding='utf8'): ... PREV: Incomplete NEXT: Incomplete @@ -83,4 +83,4 @@ SNEXT: Incomplete class QueryParamDict(OrderedMultiDict[Incomplete, Incomplete]): @classmethod def from_text(cls, query_string): ... - def to_text(self, full_quote: bool = ...): ... + def to_text(self, full_quote: bool = False): ... From f7b8936db2a27158ba29e9de783101053badc6dc Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Tue, 6 Jun 2023 20:33:29 -0700 Subject: [PATCH 48/51] black --- stubs/boltons/boltons/fileutils.pyi | 4 ++-- stubs/boltons/boltons/formatutils.pyi | 2 +- stubs/boltons/boltons/funcutils.pyi | 9 +++++++-- stubs/boltons/boltons/iterutils.pyi | 6 +++++- stubs/boltons/boltons/pathutils.pyi | 6 +++--- stubs/boltons/boltons/socketutils.pyi | 2 +- stubs/boltons/boltons/statsutils.pyi | 4 +++- stubs/boltons/boltons/strutils.pyi | 18 +++++++++--------- stubs/boltons/boltons/timeutils.pyi | 2 +- stubs/boltons/boltons/typeutils.pyi | 2 +- stubs/boltons/boltons/urlutils.pyi | 10 +++++----- 11 files changed, 38 insertions(+), 27 deletions(-) diff --git a/stubs/boltons/boltons/fileutils.pyi b/stubs/boltons/boltons/fileutils.pyi index 7360738f0a15..d8c97c51b19d 100644 --- a/stubs/boltons/boltons/fileutils.pyi +++ b/stubs/boltons/boltons/fileutils.pyi @@ -10,7 +10,7 @@ class FilePerms: user: str group: str other: str - def __init__(self, user: str = '', group: str = '', other: str = '') -> None: ... + def __init__(self, user: str = "", group: str = "", other: str = "") -> None: ... @classmethod def from_int(cls, i: int) -> Self: ... @classmethod @@ -61,7 +61,7 @@ class DummyFile: encoding: None newlines: None softspace: int - def __init__(self, path: StrOrBytesPath, mode: str = 'r', buffering: int | None = None) -> None: ... + 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: ... diff --git a/stubs/boltons/boltons/formatutils.pyi b/stubs/boltons/boltons/formatutils.pyi index 868ef7e931d0..20ac5f0a83b0 100644 --- a/stubs/boltons/boltons/formatutils.pyi +++ b/stubs/boltons/boltons/formatutils.pyi @@ -7,7 +7,7 @@ def get_format_args(fstr: str) -> tuple[list[tuple[int, type]], list[tuple[str, 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: ... + def __init__(self, fname: str, fspec: str = "", conv: str | None = None) -> None: ... base_name: str fname: str subpath: str diff --git a/stubs/boltons/boltons/funcutils.pyi b/stubs/boltons/boltons/funcutils.pyi index 1897538820b5..f5fc35fa1947 100644 --- a/stubs/boltons/boltons/funcutils.pyi +++ b/stubs/boltons/boltons/funcutils.pyi @@ -22,7 +22,7 @@ class CachedInstancePartial(functools.partial[Incomplete]): partial = CachedInstancePartial -def format_invocation(name: str = '', args=(), kwargs: Incomplete | None = None, **kw): ... +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 ): ... @@ -31,7 +31,12 @@ def format_nonexp_repr( ): ... 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 + wrapper, + func, + injected: Incomplete | None = None, + expected: Incomplete | None = None, + build_from: Incomplete | None = None, + **kw, ): ... class FunctionBuilder: diff --git a/stubs/boltons/boltons/iterutils.pyi b/stubs/boltons/boltons/iterutils.pyi index 4ad2021702ac..479d92327314 100644 --- a/stubs/boltons/boltons/iterutils.pyi +++ b/stubs/boltons/boltons/iterutils.pyi @@ -71,6 +71,10 @@ 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 + 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): ... diff --git a/stubs/boltons/boltons/pathutils.pyi b/stubs/boltons/boltons/pathutils.pyi index a936816fdb5c..ecb8004b8771 100644 --- a/stubs/boltons/boltons/pathutils.pyi +++ b/stubs/boltons/boltons/pathutils.pyi @@ -1,11 +1,11 @@ def augpath( path: str, - suffix: str = '', - prefix: 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 shrinkuser(path: str, home: str = "~") -> str: ... def expandpath(path: str) -> str: ... diff --git a/stubs/boltons/boltons/socketutils.pyi b/stubs/boltons/boltons/socketutils.pyi index f3218a12d093..30b438e689c3 100644 --- a/stubs/boltons/boltons/socketutils.pyi +++ b/stubs/boltons/boltons/socketutils.pyi @@ -50,7 +50,7 @@ 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: ... + def __init__(self, timeout: float, extra: str = "") -> None: ... class NetstringSocket: bsock: BufferedSocket diff --git a/stubs/boltons/boltons/statsutils.pyi b/stubs/boltons/boltons/statsutils.pyi index 34719e83ce77..67a7de29e997 100644 --- a/stubs/boltons/boltons/statsutils.pyi +++ b/stubs/boltons/boltons/statsutils.pyi @@ -37,7 +37,9 @@ class Stats: 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( + 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 diff --git a/stubs/boltons/boltons/strutils.pyi b/stubs/boltons/boltons/strutils.pyi index c912aa74099d..9519a95e4eaa 100644 --- a/stubs/boltons/boltons/strutils.pyi +++ b/stubs/boltons/boltons/strutils.pyi @@ -9,9 +9,9 @@ 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 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 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: ... @@ -42,13 +42,13 @@ 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 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: ... +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] @@ -57,7 +57,7 @@ class MultiReplace: 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: ... +def unwrap_text(text: str, ending: str = "\n\n") -> str: ... # Names in __all__ with no definition: # int_list_complement diff --git a/stubs/boltons/boltons/timeutils.pyi b/stubs/boltons/boltons/timeutils.pyi index 90cb76d9fc52..cf5dd4ab0792 100644 --- a/stubs/boltons/boltons/timeutils.pyi +++ b/stubs/boltons/boltons/timeutils.pyi @@ -21,7 +21,7 @@ HOUR: timedelta class ConstantTZInfo(tzinfo): name: str offset: timedelta - def __init__(self, name: str = 'ConstantTZ', offset: timedelta = ...) -> None: ... + def __init__(self, name: str = "ConstantTZ", offset: timedelta = ...) -> None: ... @property def utcoffset_hours(self) -> str: ... def utcoffset(self, dt: datetime | None) -> timedelta: ... diff --git a/stubs/boltons/boltons/typeutils.pyi b/stubs/boltons/boltons/typeutils.pyi index d082ed361369..bfb0980d5e89 100644 --- a/stubs/boltons/boltons/typeutils.pyi +++ b/stubs/boltons/boltons/typeutils.pyi @@ -1,6 +1,6 @@ from typing import Any -def make_sentinel(name: str = '_MISSING', var_name: str | None = None) -> object: ... +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]: ... diff --git a/stubs/boltons/boltons/urlutils.pyi b/stubs/boltons/boltons/urlutils.pyi index 83d2362771ca..93cba19ed8b4 100644 --- a/stubs/boltons/boltons/urlutils.pyi +++ b/stubs/boltons/boltons/urlutils.pyi @@ -10,12 +10,12 @@ 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 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(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): ... @@ -35,7 +35,7 @@ class URL: port: Incomplete path_parts: Incomplete fragment: Incomplete - def __init__(self, url: str = '') -> None: ... + def __init__(self, url: str = "") -> None: ... @classmethod def from_parts( cls, @@ -43,7 +43,7 @@ class URL: host: Incomplete | None = None, path_parts=(), query_params=(), - fragment: str = '', + fragment: str = "", port: Incomplete | None = None, username: Incomplete | None = None, password: Incomplete | None = None, @@ -71,7 +71,7 @@ def parse_url(url_text): ... DEFAULT_PARSED_URL: Incomplete -def parse_qsl(qs, keep_blank_values: bool = True, encoding='utf8'): ... +def parse_qsl(qs, keep_blank_values: bool = True, encoding="utf8"): ... PREV: Incomplete NEXT: Incomplete From c83e076a7859f91238fc3bebf09afc72e7fb5208 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 7 Jun 2023 03:34:44 +0000 Subject: [PATCH 49/51] [pre-commit.ci] auto fixes from pre-commit.com hooks --- stubs/boltons/boltons/cacheutils.pyi | 2 +- stubs/boltons/boltons/dictutils.pyi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/stubs/boltons/boltons/cacheutils.pyi b/stubs/boltons/boltons/cacheutils.pyi index f7c5b96e5efa..178171647c31 100644 --- a/stubs/boltons/boltons/cacheutils.pyi +++ b/stubs/boltons/boltons/cacheutils.pyi @@ -1,7 +1,7 @@ +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 -import weakref _KT = TypeVar("_KT") _VT = TypeVar("_VT") diff --git a/stubs/boltons/boltons/dictutils.pyi b/stubs/boltons/boltons/dictutils.pyi index 06ec03f866c5..fa8a048731f6 100644 --- a/stubs/boltons/boltons/dictutils.pyi +++ b/stubs/boltons/boltons/dictutils.pyi @@ -2,7 +2,7 @@ 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 TypeAlias, Self +from typing_extensions import Self, TypeAlias _KT = TypeVar("_KT") _VT = TypeVar("_VT") From de2d52ac3d7970d30835036719b4bdb1ca6e327d Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Tue, 6 Jun 2023 20:44:00 -0700 Subject: [PATCH 50/51] Some mypy fixes --- stubs/boltons/boltons/dictutils.pyi | 2 +- stubs/boltons/boltons/mathutils.pyi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/stubs/boltons/boltons/dictutils.pyi b/stubs/boltons/boltons/dictutils.pyi index fa8a048731f6..2b74aaaf2f63 100644 --- a/stubs/boltons/boltons/dictutils.pyi +++ b/stubs/boltons/boltons/dictutils.pyi @@ -66,7 +66,7 @@ class ManyToMany(dict[_KT, frozenset[_VT]]): def __init__(self, items: Iterable[Incomplete] | None = None) -> None: ... def __iter__(self): ... def __len__(self): ... - def __setitem__(self, key: _KT, vals: tuple[_VT]) -> None: ... + 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]: ... diff --git a/stubs/boltons/boltons/mathutils.pyi b/stubs/boltons/boltons/mathutils.pyi index 101fcdc2cc1b..2590a3e50b45 100644 --- a/stubs/boltons/boltons/mathutils.pyi +++ b/stubs/boltons/boltons/mathutils.pyi @@ -10,7 +10,7 @@ class Bits: 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: Bits) -> bool: ... + def __eq__(self, other) -> bool: ... def __or__(self, other: Bits) -> Bits: ... def __and__(self, other: Bits) -> Bits: ... def __lshift__(self, other: int) -> Bits: ... From 8479b28c00eb9b396d5f300fd3efc17529d3b755 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Tue, 6 Jun 2023 20:50:55 -0700 Subject: [PATCH 51/51] stubtest fixes --- stubs/boltons/@tests/stubtest_allowlist.txt | 7 +++++++ stubs/boltons/boltons/ioutils.pyi | 1 + stubs/boltons/boltons/iterutils.pyi | 3 +++ stubs/boltons/boltons/statsutils.pyi | 2 +- 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/stubs/boltons/@tests/stubtest_allowlist.txt b/stubs/boltons/@tests/stubtest_allowlist.txt index 60966015ac7a..1d73fe8b20ab 100644 --- a/stubs/boltons/@tests/stubtest_allowlist.txt +++ b/stubs/boltons/@tests/stubtest_allowlist.txt @@ -1,3 +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 diff --git a/stubs/boltons/boltons/ioutils.pyi b/stubs/boltons/boltons/ioutils.pyi index e2586ac183f5..2660eb510f71 100644 --- a/stubs/boltons/boltons/ioutils.pyi +++ b/stubs/boltons/boltons/ioutils.pyi @@ -20,6 +20,7 @@ class SpooledIOBase(metaclass=abc.ABCMeta): def readline(self, length: Incomplete | None = None): ... @abstractmethod def readlines(self, sizehint: int = 0): ... + def writelines(self, lines) -> None: ... @abstractmethod def rollover(self): ... @abstractmethod diff --git a/stubs/boltons/boltons/iterutils.pyi b/stubs/boltons/boltons/iterutils.pyi index 479d92327314..c448e742783d 100644 --- a/stubs/boltons/boltons/iterutils.pyi +++ b/stubs/boltons/boltons/iterutils.pyi @@ -16,6 +16,9 @@ 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): ... diff --git a/stubs/boltons/boltons/statsutils.pyi b/stubs/boltons/boltons/statsutils.pyi index 67a7de29e997..5697064a971c 100644 --- a/stubs/boltons/boltons/statsutils.pyi +++ b/stubs/boltons/boltons/statsutils.pyi @@ -1,4 +1,4 @@ -from binascii import Incomplete +from _typeshed import Incomplete from collections.abc import Callable, Iterator from typing import Any