Update stubs

This commit is contained in:
Trinh Anh Ngoc
2022-11-19 11:54:21 +07:00
parent 4628f2009a
commit 86f17ff7f2

View File

@@ -1,124 +1,123 @@
from collections import defaultdict
from typing import Any, Callable, Generator, Iterable, Iterator, KeysView, Literal, Mapping, Optional, TypeVar, Union
from weakref import WeakSet from weakref import WeakSet
from collections import Mapping, defaultdict from werkzeug.local import Local
from copy import deepcopy as deepcopy
from decorator import decorator as decorator
from typing import Any, Optional
from .fields import Field
from .models import BaseModel
from .modules.registry import Registry from .modules.registry import Registry
from .sql_db import Cursor from .sql_db import Cursor
from .tools import StackMap from .tools import StackMap
__all__: Any _T = TypeVar('_T')
_logger: Any _ModelT = TypeVar('_ModelT', bound=BaseModel)
INHERITED_ATTRS: Any _CallableT = TypeVar('_CallableT', bound=Callable)
INHERITED_ATTRS: tuple[str, ...]
class Params: class Params:
args: Any = ... args: tuple
kwargs: Any = ... kwargs: dict
def __init__(self, args: Any, kwargs: Any) -> None: ... def __init__(self, args: tuple, kwargs: dict) -> None: ...
def __str__(self): ... def __str__(self) -> str: ...
class Meta(type): class Meta(type):
def __new__(meta: Any, name: Any, bases: Any, attrs: Any): ... def __new__(meta, name: str, bases: tuple, attrs: dict): ...
def attrsetter(attr: Any, value: Any): ... def attrsetter(attr, value) -> Callable[[_T], _T]: ...
def propagate(method1: Any, method2: Any): ... def propagate(method1: Callable, method2: _CallableT) -> _CallableT: ...
def constrains(*args: Any): ... def constrains(*args: str) -> Callable[[_T], _T]: ...
def onchange(*args: Any): ... def onchange(*args: str) -> Callable[[_T], _T]: ...
def depends(*args: Any): ... def depends(*args: Union[str, Callable]) -> Callable[[_T], _T]: ...
def depends_context(*args: Any): ... def depends_context(*args: str) -> Callable[[_T], _T]: ...
def returns(model: Any, downgrade: Optional[Any] = ..., upgrade: Optional[Any] = ...): ... def returns(model: str | None, downgrade: Callable | None = ..., upgrade: Callable | None = ...) -> Callable[[_T], _T]: ...
def downgrade(method: Any, value: Any, self: Any, args: Any, kwargs: Any): ... def downgrade(method: Callable, value, self, args, kwargs): ...
def split_context(method: Any, args: Any, kwargs: Any): ... def split_context(method: Callable, args, kwargs) -> tuple: ...
def model(method: Any): ... def model(method: _CallableT) -> _CallableT: ...
_create_logger: Any def _model_create_single(create: Callable[..., _ModelT], self: _ModelT, arg) -> _ModelT: ...
def model_create_single(method: _CallableT) -> _CallableT: ...
def _model_create_multi(create: Callable[..., _ModelT], self: _ModelT, arg) -> _ModelT: ...
def model_create_multi(method: _CallableT) -> _CallableT: ...
def _call_kw_model(method: Callable[..., _ModelT], self: _ModelT, args, kwargs): ...
def _call_kw_model_create(method: Callable[..., _ModelT], self: _ModelT, args, kwargs) -> list[int] | int | Literal[False]: ...
def _call_kw_multi(method: Callable[..., _ModelT], self: _ModelT, args, kwargs): ...
def call_kw(model: BaseModel, name: str, args, kwargs): ...
def _model_create_single(create: Any, self: Any, arg: Any): ... class Environment(Mapping[str, BaseModel]):
def model_create_single(method: Any): ...
def _model_create_multi(create: Any, self: Any, arg: Any): ...
def model_create_multi(method: Any): ...
def _call_kw_model(method: Any, self: Any, args: Any, kwargs: Any): ...
def _call_kw_model_create(method: Any, self: Any, args: Any, kwargs: Any): ...
def _call_kw_multi(method: Any, self: Any, args: Any, kwargs: Any): ...
def call_kw(model: Any, name: Any, args: Any, kwargs: Any): ...
class Environment(Mapping):
_local: Any = ...
cr: Cursor = ... cr: Cursor = ...
uid: int = ... uid: int = ...
context: dict = ... context: dict[str, Any] = ...
su: bool = ... su: bool = ...
envs: Environments = ... _local: Local
envs: Environments
args: tuple[Cursor, int, dict, bool]
@classmethod @classmethod
def manage(cls) -> None: ... def manage(cls) -> Generator[None, None, None]: ...
@classmethod @classmethod
def reset(cls) -> None: ... def reset(cls) -> None: ...
registry: Registry = ... all: Environments
cache: Cache = ... registry: Registry
_protected: Any = ... cache: Cache
all: Environments = ... _protected: StackMap[Field, set[int]]
def __new__(cls, cr: Cursor, uid: Any, context: Any, su: bool = ...) -> Environment: ... def __new__(cls, cr: Cursor, uid: int, context: dict, su: bool = ...) -> Environment: ...
def __contains__(self, model_name: Any) -> bool: ... def __contains__(self, model_name: str) -> bool: ...
def __getitem__(self, model_name: Any): ... def __getitem__(self, model_name: str) -> BaseModel: ...
def __iter__(self) -> Any: ... def __iter__(self) -> Iterator[str]: ...
def __len__(self) -> int: ... def __len__(self) -> int: ...
def __eq__(self, other: Any) -> bool: ... def __eq__(self, other) -> bool: ...
def __ne__(self, other: Any) -> bool: ... def __ne__(self, other) -> bool: ...
def __hash__(self) -> int: ... def __hash__(self) -> int: ...
def __call__(self, cr: Optional[Cursor] = ..., user: Optional[Any] = ..., context: Optional[Any] = ..., su: Optional[Any] = ...) -> Environment: ... def __call__(self, cr: Cursor | None = ..., user: Union['odoo.model.res_users', int, None] = ..., context: dict | None = ..., su: bool | None = ...) -> Environment: ...
def ref(self, xml_id: Any, raise_if_not_found: bool = ...): ... def ref(self, xml_id: str, raise_if_not_found: bool = ...) -> Optional[BaseModel]: ...
def is_superuser(self) -> bool: ... def is_superuser(self) -> bool: ...
def is_admin(self) -> bool: ... def is_admin(self) -> bool: ...
def is_system(self) -> bool: ... def is_system(self) -> bool: ...
@property @property
def user(self): def user(self) -> 'odoo.model.res_users': ...
return self['res.users']
@property @property
def company(self): def company(self) -> 'odoo.model.res_company': ...
return self['res.company']
@property @property
def companies(self): def companies(self) -> 'odoo.model.res_company': ...
return self['res.company']
@property @property
def lang(self) -> str: ... def lang(self) -> str: ...
def clear(self) -> None: ... def clear(self) -> None: ...
def clear_upon_failure(self) -> None: ... def clear_upon_failure(self) -> Generator[None, None, None]: ...
def is_protected(self, field: Any, record: Any): ... def is_protected(self, field: Field, record: BaseModel) -> bool: ...
def protected(self, field: Any): ... def protected(self, field: Field) -> BaseModel: ...
def protecting(self, what: Any, records: Optional[Any] = ...) -> None: ... def protecting(self, what, records: Optional[BaseModel] = ...) -> Generator[None, None, None]: ...
def fields_to_compute(self): ... def fields_to_compute(self) -> KeysView[Field]: ...
def records_to_compute(self, field: Any): ... def records_to_compute(self, field: Field) -> BaseModel: ...
def is_to_compute(self, field: Any, record: Any): ... def is_to_compute(self, field: Field, record: BaseModel) -> bool: ...
def not_to_compute(self, field: Any, records: Any): ... def not_to_compute(self, field: Field, records: _ModelT) -> _ModelT: ...
def add_to_compute(self, field: Any, records: Any): ... def add_to_compute(self, field: Field, records: BaseModel): ...
def remove_to_compute(self, field: Any, records: Any) -> None: ... def remove_to_compute(self, field: Field, records: BaseModel) -> None: ...
def norecompute(self) -> None: ... def norecompute(self) -> Generator[None, None, None]: ...
class Environments: class Environments:
envs: WeakSet = ... envs: WeakSet[Environment]
cache: Cache = ... cache: Cache
protected: StackMap = ... protected: StackMap[Field, set[int]]
tocompute: defaultdict = ... tocompute: defaultdict[Field, set[int]]
towrite: defaultdict = ... towrite: defaultdict[str, dict[int, dict[str, Any]]]
def __init__(self): ... def __init__(self): ...
def add(self, env: Any) -> None: ... def add(self, env: Environment) -> None: ...
def __iter__(self) -> Any: ... def __iter__(self) -> Iterator[Environment]: ...
NOTHING: Any NOTHING: object
class Cache: class Cache:
_data: Any = ... _data: defaultdict[Field, dict]
def __init__(self) -> None: ... def __init__(self) -> None: ...
def contains(self, record: Any, field: Any): ... def contains(self, record: BaseModel, field: Field) -> bool: ...
def get(self, record: Any, field: Any, default: Any = ...): ... def get(self, record: BaseModel, field: Field, default=...): ...
def set(self, record: Any, field: Any, value: Any) -> None: ... def set(self, record: BaseModel, field: Field, value) -> None: ...
def update(self, records: Any, field: Any, values: Any) -> None: ... def update(self, records: BaseModel, field: Field, values) -> None: ...
def remove(self, record: Any, field: Any) -> None: ... def remove(self, record: BaseModel, field: Field) -> None: ...
def get_values(self, records: Any, field: Any) -> None: ... def get_values(self, records: BaseModel, field: Field) -> Iterator: ...
def get_records_different_from(self, records: Any, field: Any, value: Any): ... def get_records_different_from(self, records: _ModelT, field: Field, value) -> _ModelT: ...
def get_fields(self, record: Any) -> None: ... def get_fields(self, record: BaseModel) -> Iterator[Field]: ...
def get_records(self, model: Any, field: Any): ... def get_records(self, model: _ModelT, field: Field) -> _ModelT: ...
def get_missing_ids(self, records: Any, field: Any) -> None: ... def get_missing_ids(self, records: BaseModel, field: Field) -> Iterator[int]: ...
def invalidate(self, spec: Optional[Any] = ...) -> None: ... def invalidate(self, spec: list[tuple[Field, Iterable[int] | None]] | None = ...) -> None: ...
def check(self, env: Any) -> None: ... def check(self, env: Environment) -> None: ...