Update stubs

This commit is contained in:
Trinh Anh Ngoc
2022-10-17 09:17:41 +07:00
parent dc8138f50b
commit 65914f8883

View File

@@ -2,7 +2,9 @@ import datetime
import pickle as pickle_
from collections import deque
from collections.abc import Mapping, MutableMapping, MutableSet
from logging import Filter, LogRecord
from contextlib import ContextDecorator, suppress
from logging import Handler, LogRecord
from re import Pattern
from types import ModuleType
from typing import Any, Collection, Generic, IO, AnyStr, ItemsView, Iterable, Iterator, NoReturn, TypeVar, Callable
@@ -16,13 +18,14 @@ from .cache import *
from .parse_version import parse_version as parse_version
from ..api import Environment
from ..loglevels import exception_to_unicode as exception_to_unicode, get_encodings as get_encodings
from ..sql_db import Cursor
_T = TypeVar('_T')
_T1 = TypeVar('_T1')
_KT = TypeVar('_KT')
_VT = TypeVar('_VT')
_CallableT = TypeVar('_CallableT', bound=Callable)
_LowerLoggingT = TypeVar('_LowerLoggingT', bound=lower_logging)
_ReplaceExceptionsT = TypeVar('_ReplaceExceptionsT', bound=replace_exceptions)
SKIPPED_ELEMENT_TYPES: tuple
NON_BREAKING_SPACE: str
@@ -72,9 +75,10 @@ POSIX_TO_LDML: dict[str, str]
def posix_to_ldml(fmt: str, locale: Locale) -> str: ...
def split_every(n: int, iterable: Iterable[_T], piece_maker: Callable[[Iterable[_T]], _T1] = ...) -> Iterator[_T1]: ...
def get_and_group_by_field(cr: Cursor, uid: int, obj, ids, field: str, context: dict | None = ...) -> dict: ...
def get_and_group_by_company(cr: Cursor, uid: int, obj, ids, context: dict | None = ...) -> dict: ...
def resolve_attr(obj, attr: str): ...
raise_error: object
def resolve_attr(obj, attr: str, default: object = ...): ...
def attrgetter(*items): ...
def discardattr(obj, key: str) -> None: ...
def remove_accents(input_str: str) -> str: ...
@@ -82,17 +86,25 @@ def remove_accents(input_str: str) -> str: ...
class unquote(str):
def __repr__(self) -> str: ...
class UnquoteEvalContext(defaultdict):
def __init__(self, *args, **kwargs) -> None: ...
def __missing__(self, key) -> unquote: ...
class mute_logger(Filter):
class mute_logger(Handler):
loggers: tuple[str]
old_params: dict[str, tuple[list[Handler], bool]]
def __init__(self, *loggers: str) -> None: ...
def filter(self, record: LogRecord) -> int: ...
def __enter__(self) -> None: ...
def __exit__(self, exc_type: Any | None = ..., exc_val: Any | None = ..., exc_tb: Any | None = ...) -> None: ...
def __call__(self, func: _CallableT) -> _CallableT: ...
def emit(self, record: LogRecord) -> None: ...
class lower_logging(Handler):
old_handlers: list[Handler] | None
old_propagate: bool | None
had_error_log: bool
max_level: int | None
to_level: int | None
def __init__(self, max_level: int, to_level: int | None = ...) -> None: ...
def __enter__(self: _LowerLoggingT) -> _LowerLoggingT: ...
def __exit__(self, exc_type: Any | None = ..., exc_val: Any | None = ..., exc_tb: Any | None = ...) -> None: ...
def emit(self, record: LogRecord) -> None: ...
_ph: Any
@@ -175,15 +187,16 @@ class Callbacks:
def run(self) -> None: ...
def clear(self) -> None: ...
class IterableGenerator(Generic[_T]):
__slots__ = ['func', 'args']
func: Callable
args: tuple
def __init__(self, func: Callable[..., _T], *args) -> None: ...
def __iter__(self) -> _T: ...
class ReversedIterable(Generic[_T]):
__slots__ = ['iterable']
iterable: Iterable[_T]
def __init__(self, iterable: Iterable[_T]) -> None: ...
def __iter__(self) -> Iterator[_T]: ...
def __reversed__(self) -> Iterator[_T]: ...
def groupby(iterable: Iterable[_T], key: Callable[..., _T1] | None = ...) -> ItemsView[_T1, _T]: ...
def unique(it: Iterable[_T]) -> Iterator[_T]: ...
def submap(mapping: Mapping[_KT, _VT], keys: Iterable[_KT]) -> dict[_KT, _VT]: ...
class Reverse:
__slots__ = ['val']
@@ -196,7 +209,14 @@ class Reverse:
def __le__(self, other) -> bool: ...
def __lt__(self, other) -> bool: ...
def ignore(*exc) -> None: ...
def ignore(*exc) -> suppress: ...
class replace_exceptions(ContextDecorator):
exceptions: tuple[type[Exception], ...]
by: Exception
def __init__(self, *exceptions: type[Exception], by: Exception) -> None: ...
def __enter__(self: _ReplaceExceptionsT) -> _ReplaceExceptionsT: ...
def __exit__(self, exc_type, exc_value, traceback) -> None: ...
html_escape = markupsafe.escape
@@ -216,7 +236,6 @@ def format_decimalized_number(number: float, decimal: int = ...) -> str: ...
def format_decimalized_amount(amount: float, currency: 'odoo.model.res_currency | None' = ...) -> str: ...
def format_amount(env: Environment, amount: float, currency: 'odoo.model.res_currency', lang_code: str = ...) -> str: ...
def format_duration(value: float) -> str: ...
def _consteq(str1: str, str2: str) -> bool: ...
consteq: Callable[[str, str], bool]
@@ -232,5 +251,10 @@ class DotDict(dict):
def __getattr__(self, attrib): ...
def get_diff(data_from: tuple[str, str], data_to: tuple[str, str], custom_style: bool = ...) -> str: ...
def traverse_containers(val, type_) -> Iterator: ...
def hmac(env: Environment, scope, message, hash_function = ...) -> str: ...
ADDRESS_REGEX: Pattern
def street_split(street: str) -> dict[str, str]: ...
def is_list_of(values: list | tuple, type_: type | tuple[type, ...]) -> bool: ...
def has_list_types(values: list | tuple, types: Collection[type | tuple[type, ...]]) -> bool: ...