isort + black

This commit is contained in:
Trinh Anh Ngoc
2023-05-18 21:36:44 +07:00
parent 2470e81401
commit 4dc5d15f45
51 changed files with 1428 additions and 424 deletions

View File

@@ -1,22 +1,21 @@
from psycopg2 import connection from psycopg2 import connection
from . import ( from . import addons as addons
addons as addons, from . import api as api
api as api, from . import conf as conf
conf as conf, from . import fields as fields
fields as fields, from . import http as http
http as http, from . import loglevels as loglevels
loglevels as loglevels, from . import models as models
models as models, from . import netsvc as netsvc
netsvc as netsvc, from . import osv as osv
osv as osv, from . import release as release
release as release, from . import service as service
service as service, from . import sql_db as sql_db
sql_db as sql_db, from . import tools as tools
tools as tools
)
from .api import Registry from .api import Registry
from .tools.translate import _ as _, _lt as _lt from .tools.translate import _ as _
from .tools.translate import _lt as _lt
evented: bool evented: bool

View File

@@ -1,6 +1,19 @@
from collections import defaultdict from collections import defaultdict
from typing import Any, Callable, Generator, Iterable, Iterator, KeysView, Literal, Mapping, Optional, TypeVar, Union from typing import (
Any,
Callable,
Generator,
Iterable,
Iterator,
KeysView,
Literal,
Mapping,
Optional,
TypeVar,
Union,
)
from weakref import WeakSet from weakref import WeakSet
from werkzeug.local import Local from werkzeug.local import Local
from .fields import Field from .fields import Field
@@ -9,9 +22,9 @@ from .modules.registry import Registry
from .sql_db import Cursor from .sql_db import Cursor
from .tools import StackMap from .tools import StackMap
_T = TypeVar('_T') _T = TypeVar("_T")
_ModelT = TypeVar('_ModelT', bound=BaseModel) _ModelT = TypeVar("_ModelT", bound=BaseModel)
_CallableT = TypeVar('_CallableT', bound=Callable) _CallableT = TypeVar("_CallableT", bound=Callable)
INHERITED_ATTRS: tuple[str, ...] INHERITED_ATTRS: tuple[str, ...]
@@ -30,17 +43,24 @@ def constrains(*args: str) -> Callable[[_T], _T]: ...
def onchange(*args: str) -> Callable[[_T], _T]: ... def onchange(*args: str) -> Callable[[_T], _T]: ...
def depends(*args: Union[str, Callable]) -> Callable[[_T], _T]: ... def depends(*args: Union[str, Callable]) -> Callable[[_T], _T]: ...
def depends_context(*args: str) -> Callable[[_T], _T]: ... def depends_context(*args: str) -> Callable[[_T], _T]: ...
def returns(model: str | None, downgrade: Callable | None = ..., upgrade: Callable | None = ...) -> Callable[[_T], _T]: ... def returns(
model: str | None, downgrade: Callable | None = ..., upgrade: Callable | None = ...
) -> Callable[[_T], _T]: ...
def downgrade(method: Callable, value, self, args, kwargs): ... def downgrade(method: Callable, value, self, args, kwargs): ...
def split_context(method: Callable, args, kwargs) -> tuple: ... def split_context(method: Callable, args, kwargs) -> tuple: ...
def model(method: _CallableT) -> _CallableT: ... def model(method: _CallableT) -> _CallableT: ...
def _model_create_single(
def _model_create_single(create: Callable[..., _ModelT], self: _ModelT, arg) -> _ModelT: ... create: Callable[..., _ModelT], self: _ModelT, arg
) -> _ModelT: ...
def model_create_single(method: _CallableT) -> _CallableT: ... def model_create_single(method: _CallableT) -> _CallableT: ...
def _model_create_multi(create: Callable[..., _ModelT], self: _ModelT, arg) -> _ModelT: ... def _model_create_multi(
create: Callable[..., _ModelT], self: _ModelT, arg
) -> _ModelT: ...
def model_create_multi(method: _CallableT) -> _CallableT: ... def model_create_multi(method: _CallableT) -> _CallableT: ...
def _call_kw_model(method: Callable[..., _ModelT], self: _ModelT, args, kwargs): ... 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_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_multi(method: Callable[..., _ModelT], self: _ModelT, args, kwargs): ...
def call_kw(model: BaseModel, name: str, args, kwargs): ... def call_kw(model: BaseModel, name: str, args, kwargs): ...
@@ -60,7 +80,9 @@ class Environment(Mapping[str, BaseModel]):
registry: Registry registry: Registry
cache: Cache cache: Cache
_protected: StackMap[Field, set[int]] _protected: StackMap[Field, set[int]]
def __new__(cls, cr: Cursor, uid: int, context: dict, su: bool = ...) -> Environment: ... def __new__(
cls, cr: Cursor, uid: int, context: dict, su: bool = ...
) -> Environment: ...
def __contains__(self, model_name: str) -> bool: ... def __contains__(self, model_name: str) -> bool: ...
def __getitem__(self, model_name: str) -> BaseModel: ... def __getitem__(self, model_name: str) -> BaseModel: ...
def __iter__(self) -> Iterator[str]: ... def __iter__(self) -> Iterator[str]: ...
@@ -68,24 +90,34 @@ class Environment(Mapping[str, BaseModel]):
def __eq__(self, other) -> bool: ... def __eq__(self, other) -> bool: ...
def __ne__(self, other) -> bool: ... def __ne__(self, other) -> bool: ...
def __hash__(self) -> int: ... def __hash__(self) -> int: ...
def __call__(self, cr: Cursor | None = ..., user: Union['odoo.model.res_users', int, None] = ..., context: dict | None = ..., su: bool | None = ...) -> Environment: ... def __call__(
def ref(self, xml_id: str, raise_if_not_found: bool = ...) -> Optional[BaseModel]: ... self,
cr: Cursor | None = ...,
user: Union["odoo.model.res_users", int, None] = ...,
context: dict | None = ...,
su: bool | None = ...,
) -> Environment: ...
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) -> 'odoo.model.res_users': ... def user(self) -> "odoo.model.res_users": ...
@property @property
def company(self) -> 'odoo.model.res_company': ... def company(self) -> "odoo.model.res_company": ...
@property @property
def companies(self) -> 'odoo.model.res_company': ... def companies(self) -> "odoo.model.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) -> Generator[None, None, None]: ... def clear_upon_failure(self) -> Generator[None, None, None]: ...
def is_protected(self, field: Field, record: BaseModel) -> bool: ... def is_protected(self, field: Field, record: BaseModel) -> bool: ...
def protected(self, field: Field) -> BaseModel: ... def protected(self, field: Field) -> BaseModel: ...
def protecting(self, what, records: Optional[BaseModel] = ...) -> Generator[None, None, None]: ... def protecting(
self, what, records: Optional[BaseModel] = ...
) -> Generator[None, None, None]: ...
def fields_to_compute(self) -> KeysView[Field]: ... def fields_to_compute(self) -> KeysView[Field]: ...
def records_to_compute(self, field: Field) -> BaseModel: ... def records_to_compute(self, field: Field) -> BaseModel: ...
def is_to_compute(self, field: Field, record: BaseModel) -> bool: ... def is_to_compute(self, field: Field, record: BaseModel) -> bool: ...
@@ -115,9 +147,13 @@ class Cache:
def update(self, records: BaseModel, field: Field, values) -> None: ... def update(self, records: BaseModel, field: Field, values) -> None: ...
def remove(self, record: BaseModel, field: Field) -> None: ... def remove(self, record: BaseModel, field: Field) -> None: ...
def get_values(self, records: BaseModel, field: Field) -> Iterator: ... def get_values(self, records: BaseModel, field: Field) -> Iterator: ...
def get_records_different_from(self, records: _ModelT, field: Field, value) -> _ModelT: ... def get_records_different_from(
self, records: _ModelT, field: Field, value
) -> _ModelT: ...
def get_fields(self, record: BaseModel) -> Iterator[Field]: ... def get_fields(self, record: BaseModel) -> Iterator[Field]: ...
def get_records(self, model: _ModelT, field: Field) -> _ModelT: ... def get_records(self, model: _ModelT, field: Field) -> _ModelT: ...
def get_missing_ids(self, records: BaseModel, field: Field) -> Iterator[int]: ... def get_missing_ids(self, records: BaseModel, field: Field) -> Iterator[int]: ...
def invalidate(self, spec: list[tuple[Field, Iterable[int] | None]] | None = ...) -> None: ... def invalidate(
self, spec: list[tuple[Field, Iterable[int] | None]] | None = ...
) -> None: ...
def check(self, env: Environment) -> None: ... def check(self, env: Environment) -> None: ...

View File

@@ -1,5 +1,16 @@
import datetime import datetime
from typing import Any, Callable, Collection, Generic, Iterator, Sequence, Type, TypeVar, Union, overload from typing import (
Any,
Callable,
Collection,
Generic,
Iterator,
Sequence,
Type,
TypeVar,
Union,
overload,
)
import psycopg2 import psycopg2
from markupsafe import Markup from markupsafe import Markup
@@ -8,15 +19,15 @@ from .api import Environment
from .models import BaseModel from .models import BaseModel
from .tools import date_utils, frozendict from .tools import date_utils, frozendict
_FieldT = TypeVar('_FieldT', bound=Field) _FieldT = TypeVar("_FieldT", bound=Field)
_FieldValueT = TypeVar('_FieldValueT') _FieldValueT = TypeVar("_FieldValueT")
_ModelT = TypeVar('_ModelT', bound=BaseModel) _ModelT = TypeVar("_ModelT", bound=BaseModel)
_Selection = list[tuple[str, str]] _Selection = list[tuple[str, str]]
_SelectionRaw = _Selection | Callable[..., _Selection] | str _SelectionRaw = _Selection | Callable[..., _Selection] | str
_Domain = list _Domain = list
_DomainRaw = _Domain | Callable[..., _Domain] _DomainRaw = _Domain | Callable[..., _Domain]
_CommandList = list[tuple[BaseModel, list]] _CommandList = list[tuple[BaseModel, list]]
_SeqIntT = TypeVar('_SeqIntT', bound=Sequence[int]) _SeqIntT = TypeVar("_SeqIntT", bound=Sequence[int])
DATE_LENGTH: int DATE_LENGTH: int
DATETIME_LENGTH: int DATETIME_LENGTH: int
@@ -136,7 +147,9 @@ class Field(Generic[_FieldValueT], metaclass=MetaField):
def _description_string(self, env: Environment) -> str | None: ... def _description_string(self, env: Environment) -> str | None: ...
def _description_help(self, env: Environment) -> str | None: ... def _description_help(self, env: Environment) -> str | None: ...
def null(self, record: BaseModel) -> bool: ... def null(self, record: BaseModel) -> bool: ...
def convert_to_column(self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...): ... def convert_to_column(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
): ...
def convert_to_cache(self, value, record: BaseModel, validate: bool = ...): ... def convert_to_cache(self, value, record: BaseModel, validate: bool = ...): ...
def convert_to_record(self, value, record: BaseModel): ... def convert_to_record(self, value, record: BaseModel): ...
def convert_to_read(self, value, record: BaseModel, use_name_get: bool = ...): ... def convert_to_read(self, value, record: BaseModel, use_name_get: bool = ...): ...
@@ -164,16 +177,24 @@ class Field(Generic[_FieldValueT], metaclass=MetaField):
class Boolean(Field[bool]): class Boolean(Field[bool]):
type: str type: str
column_type: tuple[str, str] column_type: tuple[str, str]
def convert_to_column(self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...) -> bool: ... def convert_to_column(
def convert_to_cache(self, value, record: BaseModel, validate: bool = ...) -> bool: ... self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
) -> bool: ...
def convert_to_cache(
self, value, record: BaseModel, validate: bool = ...
) -> bool: ...
def convert_to_export(self, value, record: BaseModel): ... def convert_to_export(self, value, record: BaseModel): ...
class Integer(Field[int]): class Integer(Field[int]):
type: str type: str
column_type: tuple[str, str] column_type: tuple[str, str]
_slots: dict[str, Any] _slots: dict[str, Any]
def convert_to_column(self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...) -> int: ... def convert_to_column(
def convert_to_cache(self, value, record: BaseModel, validate: bool = ...) -> int | None: ... self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
) -> int: ...
def convert_to_cache(
self, value, record: BaseModel, validate: bool = ...
) -> int | None: ...
def convert_to_record(self, value, record: BaseModel): ... def convert_to_record(self, value, record: BaseModel): ...
def convert_to_read(self, value, record: BaseModel, use_name_get: bool = ...): ... def convert_to_read(self, value, record: BaseModel, use_name_get: bool = ...): ...
def _update(self, records: BaseModel, value) -> None: ... def _update(self, records: BaseModel, value) -> None: ...
@@ -184,14 +205,20 @@ class Float(Field[float]):
column_cast_from: tuple[str, str, str] column_cast_from: tuple[str, str, str]
_slots: dict[str, Any] _slots: dict[str, Any]
_digits: tuple[int, int] | str | None _digits: tuple[int, int] | str | None
def __init__(self, string: str = ..., digits: tuple[int, int] | str | None =..., **kwargs) -> None: ... def __init__(
self, string: str = ..., digits: tuple[int, int] | str | None = ..., **kwargs
) -> None: ...
@property @property
def column_type(self): ... def column_type(self): ...
def get_digits(self, env: Environment) -> tuple[int, int]: ... def get_digits(self, env: Environment) -> tuple[int, int]: ...
_related__digits: Any _related__digits: Any
def _description_digits(self, env: Environment) -> tuple[int, int]: ... def _description_digits(self, env: Environment) -> tuple[int, int]: ...
def convert_to_column(self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...) -> float: ... def convert_to_column(
def convert_to_cache(self, value, record: BaseModel, validate: bool = ...) -> float: ... self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
) -> float: ...
def convert_to_cache(
self, value, record: BaseModel, validate: bool = ...
) -> float: ...
def convert_to_record(self, value, record: BaseModel): ... def convert_to_record(self, value, record: BaseModel): ...
def convert_to_export(self, value, record: BaseModel): ... def convert_to_export(self, value, record: BaseModel): ...
@@ -202,13 +229,19 @@ class Monetary(Field[float]):
_slots: dict[str, Any] _slots: dict[str, Any]
currency_field: str | None currency_field: str | None
group_operator: str group_operator: str
def __init__(self, string: str = ..., currency_field : str =..., **kwargs) -> None: ... def __init__(
self, string: str = ..., currency_field: str = ..., **kwargs
) -> None: ...
_description_currency_field: str | None _description_currency_field: str | None
def _setup_currency_field(self, model: BaseModel) -> None: ... def _setup_currency_field(self, model: BaseModel) -> None: ...
def _setup_regular_full(self, model: BaseModel) -> None: ... def _setup_regular_full(self, model: BaseModel) -> None: ...
def _setup_related_full(self, model: BaseModel) -> None: ... def _setup_related_full(self, model: BaseModel) -> None: ...
def convert_to_column(self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...) -> float: ... def convert_to_column(
def convert_to_cache(self, value, record: BaseModel, validate: bool = ...) -> float: ... self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
) -> float: ...
def convert_to_cache(
self, value, record: BaseModel, validate: bool = ...
) -> float: ...
def convert_to_record(self, value, record: BaseModel): ... def convert_to_record(self, value, record: BaseModel): ...
def convert_to_read(self, value, record: BaseModel, use_name_get: bool = ...): ... def convert_to_read(self, value, record: BaseModel, use_name_get: bool = ...): ...
def convert_to_write(self, value, record: BaseModel): ... def convert_to_write(self, value, record: BaseModel): ...
@@ -240,8 +273,12 @@ class Char(_String):
_description_size: int | None _description_size: int | None
_description_trim: bool _description_trim: bool
def _setup_regular_base(self, model: BaseModel) -> None: ... def _setup_regular_base(self, model: BaseModel) -> None: ...
def convert_to_column(self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...) -> str | None: ... def convert_to_column(
def convert_to_cache(self, value, record: BaseModel, validate: bool = ...) -> str | None: ... self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
) -> str | None: ...
def convert_to_cache(
self, value, record: BaseModel, validate: bool = ...
) -> str | None: ...
class Text(_String): class Text(_String):
type: str type: str
@@ -273,8 +310,12 @@ class Html(_String):
_description_sanitize_style: bool _description_sanitize_style: bool
_description_strip_style: bool _description_strip_style: bool
_description_strip_classes: bool _description_strip_classes: bool
def convert_to_column(self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...) -> Markup | None: ... def convert_to_column(
def convert_to_cache(self, value, record: BaseModel, validate: bool = ...) -> Markup | None: ... self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
) -> Markup | None: ...
def convert_to_cache(
self, value, record: BaseModel, validate: bool = ...
) -> Markup | None: ...
class Date(Field[datetime.date]): class Date(Field[datetime.date]):
type: str type: str
@@ -287,13 +328,17 @@ class Date(Field[datetime.date]):
@staticmethod @staticmethod
def today(*args) -> datetime.date: ... def today(*args) -> datetime.date: ...
@staticmethod @staticmethod
def context_today(record: BaseModel, timestamp: datetime.datetime | None = ...) -> datetime.date: ... def context_today(
record: BaseModel, timestamp: datetime.datetime | None = ...
) -> datetime.date: ...
@staticmethod @staticmethod
def to_date(value) -> datetime.date | None: ... def to_date(value) -> datetime.date | None: ...
from_string = to_date from_string = to_date
@staticmethod @staticmethod
def to_string(value: datetime.datetime | datetime.date) -> str: ... def to_string(value: datetime.datetime | datetime.date) -> str: ...
def convert_to_cache(self, value, record: BaseModel, validate: bool = ...) -> datetime.date | None: ... def convert_to_cache(
self, value, record: BaseModel, validate: bool = ...
) -> datetime.date | None: ...
def convert_to_export(self, value, record: BaseModel): ... def convert_to_export(self, value, record: BaseModel): ...
class Datetime(Field[datetime.datetime]): class Datetime(Field[datetime.datetime]):
@@ -309,13 +354,17 @@ class Datetime(Field[datetime.datetime]):
@staticmethod @staticmethod
def today(*args) -> datetime.datetime: ... def today(*args) -> datetime.datetime: ...
@staticmethod @staticmethod
def context_timestamp(record: BaseModel, timestamp: datetime.datetime) -> datetime.datetime: ... def context_timestamp(
record: BaseModel, timestamp: datetime.datetime
) -> datetime.datetime: ...
@staticmethod @staticmethod
def to_datetime(value) -> datetime.datetime | None: ... def to_datetime(value) -> datetime.datetime | None: ...
from_string = to_datetime from_string = to_datetime
@staticmethod @staticmethod
def to_string(value: datetime.datetime | datetime.date) -> str: ... def to_string(value: datetime.datetime | datetime.date) -> str: ...
def convert_to_cache(self, value, record: BaseModel, validate: bool = ...) -> datetime.datetime | None: ... def convert_to_cache(
self, value, record: BaseModel, validate: bool = ...
) -> datetime.datetime | None: ...
def convert_to_export(self, value, record: BaseModel): ... def convert_to_export(self, value, record: BaseModel): ...
def convert_to_display_name(self, value, record: BaseModel) -> str: ... def convert_to_display_name(self, value, record: BaseModel) -> str: ...
@@ -331,8 +380,12 @@ class Binary(Field[bytes]):
def column_type(self) -> tuple[str, str] | None: ... def column_type(self) -> tuple[str, str] | None: ...
def _get_attrs(self, model: BaseModel, name: str) -> dict[str, Any]: ... def _get_attrs(self, model: BaseModel, name: str) -> dict[str, Any]: ...
_description_attachment: bool _description_attachment: bool
def convert_to_column(self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...) -> psycopg2.Binary | None: ... def convert_to_column(
def convert_to_cache(self, value, record: BaseModel, validate: bool = ...) -> bytes | None: ... self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
) -> psycopg2.Binary | None: ...
def convert_to_cache(
self, value, record: BaseModel, validate: bool = ...
) -> bytes | None: ...
def convert_to_record(self, value, record: BaseModel) -> bytes: ... def convert_to_record(self, value, record: BaseModel) -> bytes: ...
def compute_value(self, records: BaseModel) -> None: ... def compute_value(self, records: BaseModel) -> None: ...
def read(self, records: BaseModel) -> None: ... def read(self, records: BaseModel) -> None: ...
@@ -355,14 +408,18 @@ class Selection(Field[str]):
_slots: dict[str, Any] _slots: dict[str, Any]
selection: _SelectionRaw selection: _SelectionRaw
validate: bool validate: bool
def __init__(self, selection: _SelectionRaw = ..., string: str = ..., **kwargs) -> None: ... def __init__(
self, selection: _SelectionRaw = ..., string: str = ..., **kwargs
) -> None: ...
def _setup_regular_base(self, model: BaseModel) -> None: ... def _setup_regular_base(self, model: BaseModel) -> None: ...
def _setup_related_full(self, model: BaseModel) -> None: ... def _setup_related_full(self, model: BaseModel) -> None: ...
def _setup_attrs(self, model: BaseModel, name: str) -> None: ... def _setup_attrs(self, model: BaseModel, name: str) -> None: ...
def _selection_modules(self, model: BaseModel) -> dict[str, set[str, str]]: ... def _selection_modules(self, model: BaseModel) -> dict[str, set[str, str]]: ...
def _description_selection(self, env: Environment) -> _Selection: ... def _description_selection(self, env: Environment) -> _Selection: ...
def get_values(self, env: Environment) -> list[str]: ... def get_values(self, env: Environment) -> list[str]: ...
def convert_to_column(self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...): ... def convert_to_column(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
): ...
def convert_to_cache(self, value, record: BaseModel, validate: bool = ...): ... def convert_to_cache(self, value, record: BaseModel, validate: bool = ...): ...
def convert_to_export(self, value, record: BaseModel): ... def convert_to_export(self, value, record: BaseModel): ...
@@ -370,10 +427,16 @@ class Reference(Selection):
type: str type: str
@property @property
def column_type(self) -> tuple[str, str]: ... def column_type(self) -> tuple[str, str]: ...
def convert_to_column(self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...) -> str | None: ... def convert_to_column(
def convert_to_cache(self, value, record: BaseModel, validate: bool = ...) -> str | None: ... self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
) -> str | None: ...
def convert_to_cache(
self, value, record: BaseModel, validate: bool = ...
) -> str | None: ...
def convert_to_record(self, value, record: BaseModel) -> Union[BaseModel, None]: ... def convert_to_record(self, value, record: BaseModel) -> Union[BaseModel, None]: ...
def convert_to_read(self, value, record: BaseModel, use_name_get: bool = ...) -> str | bool: ... def convert_to_read(
self, value, record: BaseModel, use_name_get: bool = ...
) -> str | bool: ...
def convert_to_export(self, value, record: BaseModel) -> str: ... def convert_to_export(self, value, record: BaseModel) -> str: ...
def convert_to_display_name(self, value, record: BaseModel) -> str: ... def convert_to_display_name(self, value, record: BaseModel) -> str: ...
@@ -401,14 +464,18 @@ class Many2one(_Relational):
ondelete: str | None ondelete: str | None
auto_join: bool auto_join: bool
delegate: bool delegate: bool
def __init__(self, comodel_name: str = ..., string: str = ..., **kwargs) -> None: ... def __init__(
self, comodel_name: str = ..., string: str = ..., **kwargs
) -> None: ...
def _setup_attrs(self, model: BaseModel, name: str) -> None: ... def _setup_attrs(self, model: BaseModel, name: str) -> None: ...
def _setup_regular_base(self, model: BaseModel) -> None: ... def _setup_regular_base(self, model: BaseModel) -> None: ...
def update_db(self, model: BaseModel, columns): ... def update_db(self, model: BaseModel, columns): ...
def update_db_column(self, model: BaseModel, column) -> None: ... def update_db_column(self, model: BaseModel, column) -> None: ...
def update_db_foreign_key(self, model: BaseModel, column) -> None: ... def update_db_foreign_key(self, model: BaseModel, column) -> None: ...
def _update(self, records: BaseModel, value) -> None: ... def _update(self, records: BaseModel, value) -> None: ...
def convert_to_column(self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...): ... def convert_to_column(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
): ...
def convert_to_cache(self, value, record: BaseModel, validate: bool = ...): ... def convert_to_cache(self, value, record: BaseModel, validate: bool = ...): ...
def convert_to_record(self, value, record: BaseModel): ... def convert_to_record(self, value, record: BaseModel): ...
def convert_to_read(self, value, record: BaseModel, use_name_get: bool = ...): ... def convert_to_read(self, value, record: BaseModel, use_name_get: bool = ...): ...
@@ -451,7 +518,13 @@ class One2many(_RelationalMulti):
auto_join: bool auto_join: bool
limit: int | None limit: int | None
copy: bool copy: bool
def __init__(self, comodel_name: str = ..., inverse_name: str = ..., string: str = ..., **kwargs) -> None: ... def __init__(
self,
comodel_name: str = ...,
inverse_name: str = ...,
string: str = ...,
**kwargs
) -> None: ...
def _setup_regular_full(self, model: BaseModel) -> None: ... def _setup_regular_full(self, model: BaseModel) -> None: ...
_description_relation_field: str | None _description_relation_field: str | None
def update_db(self, model: BaseModel, columns) -> None: ... def update_db(self, model: BaseModel, columns) -> None: ...
@@ -470,7 +543,15 @@ class Many2many(_RelationalMulti):
auto_join: bool auto_join: bool
limit: int | None limit: int | None
ondelete: str ondelete: str
def __init__(self, comodel_name: str =..., relation: str = ..., column1: str = ..., column2: str = ..., string: str = ..., **kwargs) -> None: ... def __init__(
self,
comodel_name: str = ...,
relation: str = ...,
column1: str = ...,
column2: str = ...,
string: str = ...,
**kwargs
) -> None: ...
def _setup_regular_base(self, model: BaseModel) -> None: ... def _setup_regular_base(self, model: BaseModel) -> None: ...
def _setup_regular_full(self, model: BaseModel) -> None: ... def _setup_regular_full(self, model: BaseModel) -> None: ...
def update_db(self, model: BaseModel, columns) -> None: ... def update_db(self, model: BaseModel, columns) -> None: ...

View File

@@ -12,7 +12,7 @@ from .api import Environment
from .modules.registry import Registry from .modules.registry import Registry
from .sql_db import Cursor from .sql_db import Cursor
_T = TypeVar('_T') _T = TypeVar("_T")
rpc_request: Logger rpc_request: Logger
rpc_response: Logger rpc_response: Logger
@@ -27,7 +27,9 @@ def replace_request_password(args) -> tuple: ...
NO_POSTMORTEM: tuple[type[Exception], ...] NO_POSTMORTEM: tuple[type[Exception], ...]
def dispatch_rpc(service_name: str, method: str, params): ... def dispatch_rpc(service_name: str, method: str, params): ...
def local_redirect(path: str, query: dict | None = ..., keep_hash: bool = ..., code: int = ...) -> werkzeug.wrappers.Response: ... def local_redirect(
path: str, query: dict | None = ..., keep_hash: bool = ..., code: int = ...
) -> werkzeug.wrappers.Response: ...
def redirect_with_hash(url: str, code: int = ...) -> werkzeug.wrappers.Response: ... def redirect_with_hash(url: str, code: int = ...) -> werkzeug.wrappers.Response: ...
class WebRequest: class WebRequest:
@@ -37,11 +39,11 @@ class WebRequest:
endpoint: EndPoint | None endpoint: EndPoint | None
endpoint_arguments: Any endpoint_arguments: Any
auth_method: str | None auth_method: str | None
website: 'odoo.model.website' website: "odoo.model.website"
website_routing: int website_routing: int
is_frontend: bool is_frontend: bool
is_frontend_multilang: bool is_frontend_multilang: bool
lang: 'odoo.model.res_lang' lang: "odoo.model.res_lang"
_cr: Cursor | None _cr: Cursor | None
_uid: int | None _uid: int | None
_context: dict | None _context: dict | None
@@ -75,13 +77,15 @@ class WebRequest:
def csrf_token(self, time_limit: int | None = ...): ... def csrf_token(self, time_limit: int | None = ...): ...
def validate_csrf(self, csrf) -> bool: ... def validate_csrf(self, csrf) -> bool: ...
def route(route: str | list[str] | None = ..., def route(
route: str | list[str] | None = ...,
type: str = ..., type: str = ...,
auth: str = ..., auth: str = ...,
methods: list[str] = ..., methods: list[str] = ...,
cors: str = ..., cors: str = ...,
csrf: bool = ..., csrf: bool = ...,
**kw): ... **kw
): ...
class JsonRequest(WebRequest): class JsonRequest(WebRequest):
_request_type: str _request_type: str
@@ -89,7 +93,9 @@ class JsonRequest(WebRequest):
jsonrequest: Any jsonrequest: Any
context: dict context: dict
def __init__(self, *args) -> None: ... def __init__(self, *args) -> None: ...
def _json_response(self, result: Any | None = ..., error: dict | None = ...) -> Response: ... def _json_response(
self, result: Any | None = ..., error: dict | None = ...
) -> Response: ...
def _handle_exception(self, exception: Exception) -> Response: ... def _handle_exception(self, exception: Exception) -> Response: ...
def dispatch(self) -> Response: ... def dispatch(self) -> Response: ...
@@ -101,8 +107,15 @@ class HttpRequest(WebRequest):
def __init__(self, *args) -> None: ... def __init__(self, *args) -> None: ...
def _handle_exception(self, exception: Exception): ... def _handle_exception(self, exception: Exception): ...
def dispatch(self): ... def dispatch(self): ...
def make_response(self, data, headers: list[tuple[str, str]] | None = ..., cookies: dict | None = ...) -> Response: ... def make_response(
def render(self, template, qcontext: dict | None = ..., lazy: bool = ..., **kw) -> Response: ... self,
data,
headers: list[tuple[str, str]] | None = ...,
cookies: dict | None = ...,
) -> Response: ...
def render(
self, template, qcontext: dict | None = ..., lazy: bool = ..., **kw
) -> Response: ...
def not_found(self, description: str | Any | None = ...) -> NotFound: ... def not_found(self, description: str | Any | None = ...) -> NotFound: ...
addons_manifest: dict addons_manifest: dict
@@ -111,7 +124,7 @@ controllers_per_module: dict[str, list]
class ControllerType(type): class ControllerType(type):
def __init__(cls, name: str, bases: tuple, attrs: dict) -> None: ... def __init__(cls, name: str, bases: tuple, attrs: dict) -> None: ...
Controller = ControllerType('Controller', (object,), {}) Controller = ControllerType("Controller", (object,), {})
class EndPoint: class EndPoint:
method: Callable method: Callable
@@ -127,7 +140,9 @@ class EndPoint:
def _as_tuple(self) -> tuple[Callable, dict]: ... def _as_tuple(self) -> tuple[Callable, dict]: ...
def __repr__(self) -> str: ... def __repr__(self) -> str: ...
def _generate_routing_rules(modules: Collection[str], nodb_only: bool, converters: Any | None = ...) -> Generator[tuple[str, EndPoint, dict], None, None]: ... def _generate_routing_rules(
modules: Collection[str], nodb_only: bool, converters: Any | None = ...
) -> Generator[tuple[str, EndPoint, dict], None, None]: ...
class AuthenticationError(Exception): ... class AuthenticationError(Exception): ...
class SessionExpiredException(Exception): ... class SessionExpiredException(Exception): ...
@@ -143,7 +158,13 @@ class OpenERPSession(werkzeug.contrib.sessions.Session):
uid: int uid: int
login: str | None login: str | None
session_token: str | None session_token: str | None
def authenticate(self, db: str, login: str | None = ..., password: str | None = ..., uid: int | None = ...) -> int: ... def authenticate(
self,
db: str,
login: str | None = ...,
password: str | None = ...,
uid: int | None = ...,
) -> int: ...
def check_security(self) -> None: ... def check_security(self) -> None: ...
def logout(self, keep_db: bool = ...) -> None: ... def logout(self, keep_db: bool = ...) -> None: ...
def _default_values(self) -> None: ... def _default_values(self) -> None: ...
@@ -155,7 +176,9 @@ class OpenERPSession(werkzeug.contrib.sessions.Session):
def save_request_data(self) -> None: ... def save_request_data(self) -> None: ...
def load_request_data(self) -> Generator[CombinedMultiDict | None, None, None]: ... def load_request_data(self) -> Generator[CombinedMultiDict | None, None, None]: ...
def session_gc(session_store: werkzeug.contrib.sessions.FilesystemSessionStore) -> None: ... def session_gc(
session_store: werkzeug.contrib.sessions.FilesystemSessionStore,
) -> None: ...
class Response(werkzeug.wrappers.Response): class Response(werkzeug.wrappers.Response):
default_mimetype: str default_mimetype: str
@@ -163,7 +186,12 @@ class Response(werkzeug.wrappers.Response):
template: Any template: Any
qcontext: dict qcontext: dict
uid: int uid: int
def set_default(self, template: Any | None = ..., qcontext: dict | None = ..., uid: int | None = ...) -> None: ... def set_default(
self,
template: Any | None = ...,
qcontext: dict | None = ...,
uid: int | None = ...,
) -> None: ...
@property @property
def is_qweb(self) -> bool: ... def is_qweb(self) -> bool: ...
def render(self): ... def render(self): ...
@@ -186,16 +214,33 @@ class Root:
def setup_session(self, httprequest: werkzeug.wrappers.Request) -> bool: ... def setup_session(self, httprequest: werkzeug.wrappers.Request) -> bool: ...
def setup_db(self, httprequest: werkzeug.wrappers.Request) -> None: ... def setup_db(self, httprequest: werkzeug.wrappers.Request) -> None: ...
def setup_lang(self, httprequest: werkzeug.wrappers.Request) -> None: ... def setup_lang(self, httprequest: werkzeug.wrappers.Request) -> None: ...
def get_request(self, httprequest: werkzeug.wrappers.Request) -> HttpRequest | JsonRequest: ... def get_request(
def get_response(self, httprequest: werkzeug.wrappers.Request, result, explicit_session: bool) -> Any: ... self, httprequest: werkzeug.wrappers.Request
) -> HttpRequest | JsonRequest: ...
def get_response(
self, httprequest: werkzeug.wrappers.Request, result, explicit_session: bool
) -> Any: ...
def set_csp(self, response: werkzeug.wrappers.Response) -> None: ... def set_csp(self, response: werkzeug.wrappers.Response) -> None: ...
def dispatch(self, environ: dict, start_response: Callable): ... def dispatch(self, environ: dict, start_response: Callable): ...
def get_db_router(self, db: str) -> Map: ... def get_db_router(self, db: str) -> Map: ...
def db_list(force: bool = ..., httprequest: werkzeug.wrappers.Request | None = ...) -> list[str]: ... def db_list(
def db_filter(dbs, httprequest: werkzeug.wrappers.Request | None = ...) -> list[str]: ... force: bool = ..., httprequest: werkzeug.wrappers.Request | None = ...
) -> list[str]: ...
def db_filter(
dbs, httprequest: werkzeug.wrappers.Request | None = ...
) -> list[str]: ...
def db_monodb(httprequest: werkzeug.wrappers.Request | None = ...) -> str | None: ... def db_monodb(httprequest: werkzeug.wrappers.Request | None = ...) -> str | None: ...
def send_file(filepath_or_fp, mimetype: str | None = ..., as_attachment: bool = ..., filename: str | None = ..., mtime: Any | None = ..., add_etags: bool = ..., cache_timeout: int =..., conditional: bool = ...) -> Response: ... def send_file(
filepath_or_fp,
mimetype: str | None = ...,
as_attachment: bool = ...,
filename: str | None = ...,
mtime: Any | None = ...,
add_etags: bool = ...,
cache_timeout: int = ...,
conditional: bool = ...,
) -> Response: ...
def content_disposition(filename: str) -> str: ... def content_disposition(filename: str) -> str: ...
def set_safe_image_headers(headers, content): ... def set_safe_image_headers(headers, content): ...

View File

@@ -1,6 +1,19 @@
from collections import defaultdict from collections import defaultdict
from re import Pattern from re import Pattern
from typing import Any, Callable, Collection, Container, Iterable, Iterator, Literal, MutableMapping, Sequence, TypeVar, Union, overload from typing import (
Any,
Callable,
Collection,
Container,
Iterable,
Iterator,
Literal,
MutableMapping,
Sequence,
TypeVar,
Union,
overload,
)
import psycopg2 import psycopg2
from lxml.etree import _Element from lxml.etree import _Element
@@ -12,8 +25,8 @@ from .modules.registry import Registry
from .osv.query import Query from .osv.query import Query
from .sql_db import Cursor from .sql_db import Cursor
_T = TypeVar('_T') _T = TypeVar("_T")
_ModelT = TypeVar('_ModelT', bound=BaseModel) _ModelT = TypeVar("_ModelT", bound=BaseModel)
_Domain = list _Domain = list
regex_order: Pattern[str] regex_order: Pattern[str]
@@ -35,7 +48,9 @@ def trigger_tree_merge(node1: dict, node2: dict) -> None: ...
class MetaModel(api.Meta): class MetaModel(api.Meta):
module_to_models: defaultdict[str, list[type[BaseModel]]] module_to_models: defaultdict[str, list[type[BaseModel]]]
def __init__(self: type[BaseModel], name: str, bases: tuple, attrs: dict) -> None: ... def __init__(
self: type[BaseModel], name: str, bases: tuple, attrs: dict
) -> None: ...
def _get_addon_name(self, full_name: str) -> str: ... def _get_addon_name(self, full_name: str) -> str: ...
class NewId: class NewId:
@@ -96,11 +111,11 @@ class BaseModel(metaclass=MetaModel):
env: Environment = ... env: Environment = ...
pool: Registry pool: Registry
id = fields.Id() id = fields.Id()
display_name = fields.Char(string='Display Name') display_name = fields.Char(string="Display Name")
create_uid = fields.Many2one('res.users', string='Created by') create_uid = fields.Many2one("res.users", string="Created by")
create_date = fields.Datetime(string='Created on') create_date = fields.Datetime(string="Created on")
write_uid = fields.Many2one('res.users', string='Last Updated by') write_uid = fields.Many2one("res.users", string="Last Updated by")
write_date = fields.Datetime(string='Last Updated on') write_date = fields.Datetime(string="Last Updated on")
CONCURRENCY_CHECK_FIELD: str CONCURRENCY_CHECK_FIELD: str
def view_init(self, fields_list: list[str]) -> None: ... def view_init(self, fields_list: list[str]) -> None: ...
def _reflect(self) -> None: ... def _reflect(self) -> None: ...
@@ -114,7 +129,9 @@ class BaseModel(metaclass=MetaModel):
@classmethod @classmethod
def _build_model_check_base(model_class, cls: type[BaseModel]) -> None: ... def _build_model_check_base(model_class, cls: type[BaseModel]) -> None: ...
@classmethod @classmethod
def _build_model_check_parent(model_class, cls: type[BaseModel], parent_class: type[BaseModel]) -> None: ... def _build_model_check_parent(
model_class, cls: type[BaseModel], parent_class: type[BaseModel]
) -> None: ...
@classmethod @classmethod
def _build_model_attributes(cls, pool: Registry) -> None: ... def _build_model_attributes(cls, pool: Registry) -> None: ...
@classmethod @classmethod
@@ -126,15 +143,31 @@ class BaseModel(metaclass=MetaModel):
def __new__(cls) -> None: ... def __new__(cls) -> None: ...
def __init__(self, pool: Registry, cr: Cursor) -> None: ... def __init__(self, pool: Registry, cr: Cursor) -> None: ...
def _is_an_ordinary_table(self) -> bool: ... def _is_an_ordinary_table(self) -> bool: ...
def __ensure_xml_id(self: _ModelT, skip: bool = ...) -> Iterator[tuple[_ModelT, str | None]]: ... def __ensure_xml_id(
def _export_rows(self, fields: list[list[str]], *, _is_toplevel_call: bool = ...) -> list[list]: ... self: _ModelT, skip: bool = ...
) -> Iterator[tuple[_ModelT, str | None]]: ...
def _export_rows(
self, fields: list[list[str]], *, _is_toplevel_call: bool = ...
) -> list[list]: ...
__export_rows = _export_rows __export_rows = _export_rows
def export_data(self, fields_to_export: list[str]) -> dict[str, list[list]]: ... def export_data(self, fields_to_export: list[str]) -> dict[str, list[list]]: ...
def load(self, fields: list[str], data: list[list[str]]) -> dict[str, Any]: ... def load(self, fields: list[str], data: list[list[str]]) -> dict[str, Any]: ...
def _add_fake_fields(self, fields: dict[str | None, Field]) -> dict[str | None, Field]: ... def _add_fake_fields(
def _extract_records(self, fields_: Iterable[Sequence[str]], data, log: Callable = ..., limit: float = ...) -> Iterator[tuple[BaseModel, dict[str, dict[str, int]]]]: ... self, fields: dict[str | None, Field]
def _convert_records(self, records, log: Callable = ...) -> Iterator[tuple[Any, Any, Any, dict]]: ... ) -> dict[str | None, Field]: ...
def _validate_fields(self, field_names: Iterable[str], excluded_names: Iterable[str] = ...) -> None: ... def _extract_records(
self,
fields_: Iterable[Sequence[str]],
data,
log: Callable = ...,
limit: float = ...,
) -> Iterator[tuple[BaseModel, dict[str, dict[str, int]]]]: ...
def _convert_records(
self, records, log: Callable = ...
) -> Iterator[tuple[Any, Any, Any, dict]]: ...
def _validate_fields(
self, field_names: Iterable[str], excluded_names: Iterable[str] = ...
) -> None: ...
def default_get(self, fields_list: list[str]) -> dict[str, Any]: ... def default_get(self, fields_list: list[str]) -> dict[str, Any]: ...
def fields_get_keys(self) -> list[str]: ... def fields_get_keys(self) -> list[str]: ...
def _rec_name_fallback(self) -> str: ... def _rec_name_fallback(self) -> str: ...
@@ -148,35 +181,129 @@ class BaseModel(metaclass=MetaModel):
def _get_default_graph_view(self) -> _Element: ... def _get_default_graph_view(self) -> _Element: ...
def _get_default_calendar_view(self) -> _Element: ... def _get_default_calendar_view(self) -> _Element: ...
def load_views(self, views: list, options: dict | None = ...) -> dict[str, Any]: ... def load_views(self, views: list, options: dict | None = ...) -> dict[str, Any]: ...
def _fields_view_get(self, view_id: int | None = ..., view_type: str = ..., toolbar: bool = ..., submenu: bool = ...) -> dict[str, Any]: ... def _fields_view_get(
def fields_view_get(self, view_id: int | None = ..., view_type: str = ..., toolbar: bool = ..., submenu: bool = ...) -> dict[str, Any]: ... self,
view_id: int | None = ...,
view_type: str = ...,
toolbar: bool = ...,
submenu: bool = ...,
) -> dict[str, Any]: ...
def fields_view_get(
self,
view_id: int | None = ...,
view_type: str = ...,
toolbar: bool = ...,
submenu: bool = ...,
) -> dict[str, Any]: ...
def get_formview_id(self, access_uid: int | None = ...): ... def get_formview_id(self, access_uid: int | None = ...): ...
def get_formview_action(self, access_uid: int | None = ...) -> dict[str, Any]: ... def get_formview_action(self, access_uid: int | None = ...) -> dict[str, Any]: ...
def get_access_action(self, access_uid: int | None = ...) -> dict[str, Any]: ... def get_access_action(self, access_uid: int | None = ...) -> dict[str, Any]: ...
def search_count(self, args: _Domain) -> int: ... def search_count(self, args: _Domain) -> int: ...
@overload @overload
def search(self: _ModelT, args: _Domain, offset: int = ..., limit: int | None = ..., order: str | None = ..., count: Literal[False] = ...) -> _ModelT: ... def search(
self: _ModelT,
args: _Domain,
offset: int = ...,
limit: int | None = ...,
order: str | None = ...,
count: Literal[False] = ...,
) -> _ModelT: ...
@overload @overload
def search(self: _ModelT, args: _Domain, offset: int = ..., limit: int | None = ..., order: str | None = ..., count: Literal[True] = ...) -> int: ... def search(
self: _ModelT,
args: _Domain,
offset: int = ...,
limit: int | None = ...,
order: str | None = ...,
count: Literal[True] = ...,
) -> int: ...
def _compute_display_name(self) -> None: ... def _compute_display_name(self) -> None: ...
def name_get(self) -> list[tuple[int, str]]: ... def name_get(self) -> list[tuple[int, str]]: ...
def name_create(self, name: str) -> tuple[int, str]: ... def name_create(self, name: str) -> tuple[int, str]: ...
def name_search(self, name: str = ..., args: _Domain | None = ..., operator: str = ..., limit: int = ...) -> list[tuple[int, str]]: ... def name_search(
def _name_search(self, name: str = ..., args: _Domain | None = ..., operator: str = ..., limit: int = ..., name_get_uid: int | None = ...) -> list[int]: ... self,
name: str = ...,
args: _Domain | None = ...,
operator: str = ...,
limit: int = ...,
) -> list[tuple[int, str]]: ...
def _name_search(
self,
name: str = ...,
args: _Domain | None = ...,
operator: str = ...,
limit: int = ...,
name_get_uid: int | None = ...,
) -> list[int]: ...
def _add_missing_default_values(self, values: dict[str, Any]) -> dict[str, Any]: ... def _add_missing_default_values(self, values: dict[str, Any]) -> dict[str, Any]: ...
@classmethod @classmethod
def clear_caches(cls) -> None: ... def clear_caches(cls) -> None: ...
def _read_group_fill_results(self, domain: _Domain, groupby: str, remaining_groupbys: list[str], aggregated_fields: list[str], count_field: str, read_group_result, read_group_order: str | None = ...) -> list: ... def _read_group_fill_results(
def _read_group_fill_temporal(self, data: list, groupby: list[str], aggregated_fields: list[str], annotated_groupbys: list[dict], interval = ...) -> list: ... self,
def _read_group_prepare(self, orderby: str, aggregated_fields: list[str], annotated_groupbys: list[dict], query: Query) -> tuple[list, list]: ... domain: _Domain,
groupby: str,
remaining_groupbys: list[str],
aggregated_fields: list[str],
count_field: str,
read_group_result,
read_group_order: str | None = ...,
) -> list: ...
def _read_group_fill_temporal(
self,
data: list,
groupby: list[str],
aggregated_fields: list[str],
annotated_groupbys: list[dict],
interval=...,
) -> list: ...
def _read_group_prepare(
self,
orderby: str,
aggregated_fields: list[str],
annotated_groupbys: list[dict],
query: Query,
) -> tuple[list, list]: ...
def _read_group_process_groupby(self, gb: str, query: Query) -> dict[str, Any]: ... def _read_group_process_groupby(self, gb: str, query: Query) -> dict[str, Any]: ...
def _read_group_prepare_data(self, key, value, groupby_dict: dict[str, dict[str, Any]]) -> Any: ... def _read_group_prepare_data(
def _read_group_format_result(self, data: dict, annotated_groupbys: list[dict], groupby: list, domain: _Domain) -> dict: ... self, key, value, groupby_dict: dict[str, dict[str, Any]]
def read_group(self, domain: _Domain, fields: list[str], groupby: str | list[str], offset: int = ..., limit: int | None = ..., orderby: str | None = ..., lazy: bool = ...) -> list[dict[str, Any]]: ... ) -> Any: ...
def _read_group_raw(self, domain: _Domain, fields: list[str], groupby: str | list[str], offset: int = ..., limit: int | None = ..., orderby: str | None = ..., lazy: bool = ...) -> list[dict[str, Any]]: ... def _read_group_format_result(
def _read_group_resolve_many2one_fields(self, data: list[dict[str, Any]], fields: list[dict[str, Any]]) -> None: ... self, data: dict, annotated_groupbys: list[dict], groupby: list, domain: _Domain
def _inherits_join_add(self, current_model: BaseModel, parent_model_name: str, query: Query) -> str: ... ) -> dict: ...
def _inherits_join_calc(self, alias: str, fname: str, query: Query, implicit: bool = ..., outer: bool = ...) -> str: ... def read_group(
self,
domain: _Domain,
fields: list[str],
groupby: str | list[str],
offset: int = ...,
limit: int | None = ...,
orderby: str | None = ...,
lazy: bool = ...,
) -> list[dict[str, Any]]: ...
def _read_group_raw(
self,
domain: _Domain,
fields: list[str],
groupby: str | list[str],
offset: int = ...,
limit: int | None = ...,
orderby: str | None = ...,
lazy: bool = ...,
) -> list[dict[str, Any]]: ...
def _read_group_resolve_many2one_fields(
self, data: list[dict[str, Any]], fields: list[dict[str, Any]]
) -> None: ...
def _inherits_join_add(
self, current_model: BaseModel, parent_model_name: str, query: Query
) -> str: ...
def _inherits_join_calc(
self,
alias: str,
fname: str,
query: Query,
implicit: bool = ...,
outer: bool = ...,
) -> str: ...
def _parent_store_compute(self): ... def _parent_store_compute(self): ...
def _check_removed_columns(self, log: bool = ...) -> None: ... def _check_removed_columns(self, log: bool = ...) -> None: ...
def _init_column(self, column_name: str) -> None: ... def _init_column(self, column_name: str) -> None: ...
@@ -192,24 +319,32 @@ class BaseModel(metaclass=MetaModel):
def _setup_base(self) -> None: ... def _setup_base(self) -> None: ...
def _setup_fields(self) -> None: ... def _setup_fields(self) -> None: ...
def _setup_complete(self) -> None: ... def _setup_complete(self) -> None: ...
def fields_get(self, allfields: list[str] | None = ..., attributes: list[str] | None = ...) -> dict[str, dict[str, Any]]: ... def fields_get(
self, allfields: list[str] | None = ..., attributes: list[str] | None = ...
) -> dict[str, dict[str, Any]]: ...
def get_empty_list_help(self, help: str) -> str: ... def get_empty_list_help(self, help: str) -> str: ...
def check_field_access_rights(self, operation: str, fields: Collection[str]): ... def check_field_access_rights(self, operation: str, fields: Collection[str]): ...
def read(self, fields: Collection[str] | None = ..., load: str = ...) -> list[dict[str, Any]]: ... def read(
self, fields: Collection[str] | None = ..., load: str = ...
) -> list[dict[str, Any]]: ...
def _fetch_field(self, field: Field) -> None: ... def _fetch_field(self, field: Field) -> None: ...
def _read(self, fields: Collection[str]): ... def _read(self, fields: Collection[str]): ...
def get_metadata(self) -> list[dict[str, Any]]: ... def get_metadata(self) -> list[dict[str, Any]]: ...
def get_base_url(self) -> str: ... def get_base_url(self) -> str: ...
def _check_concurrency(self) -> None: ... def _check_concurrency(self) -> None: ...
def _check_company(self, fnames: Collection[str] | None = ...) -> None: ... def _check_company(self, fnames: Collection[str] | None = ...) -> None: ...
def check_access_rights(self, operation: str, raise_exception: bool = ...) -> bool: ... def check_access_rights(
self, operation: str, raise_exception: bool = ...
) -> bool: ...
def check_access_rule(self, operation: str) -> None: ... def check_access_rule(self, operation: str) -> None: ...
def _filter_access_rules(self: _ModelT, operation: str) -> _ModelT: ... def _filter_access_rules(self: _ModelT, operation: str) -> _ModelT: ...
def _filter_access_rules_python(self, operation: str) -> _ModelT: ... def _filter_access_rules_python(self, operation: str) -> _ModelT: ...
def unlink(self): ... def unlink(self): ...
def write(self, vals: dict[str, Any]): ... def write(self, vals: dict[str, Any]): ...
def _write(self, vals: dict[str, Any]): ... def _write(self, vals: dict[str, Any]): ...
def create(self: _ModelT, vals_list: list[dict[str, Any]] | dict[str, Any]) -> _ModelT: ... def create(
self: _ModelT, vals_list: list[dict[str, Any]] | dict[str, Any]
) -> _ModelT: ...
def _create(self: _ModelT, data_list: list[dict[str, Any]]) -> _ModelT: ... def _create(self: _ModelT, data_list: list[dict[str, Any]]) -> _ModelT: ...
def _compute_field_value(self, field: Field) -> None: ... def _compute_field_value(self, field: Field) -> None: ...
def _parent_store_create(self) -> None: ... def _parent_store_create(self) -> None: ...
@@ -221,14 +356,48 @@ class BaseModel(metaclass=MetaModel):
def _where_calc(self, domain: _Domain, active_test: bool = ...) -> Query: ... def _where_calc(self, domain: _Domain, active_test: bool = ...) -> Query: ...
def _check_qorder(self, word: str) -> bool: ... def _check_qorder(self, word: str) -> bool: ...
def _apply_ir_rules(self, query: Query, mode: str = ...) -> None: ... def _apply_ir_rules(self, query: Query, mode: str = ...) -> None: ...
def _generate_translated_field(self, table_alias: str, field: str, query: Query) -> str: ... def _generate_translated_field(
def _generate_m2o_order_by(self, alias: str, order_field: str, query: Query, reverse_direction: bool, seen: set | None) -> list[str]: ... self, table_alias: str, field: str, query: Query
def _generate_order_by_inner(self, alias: str, order_spec: str, query: Query, reverse_direction: bool = ..., seen: set | None = ...) -> list[str]: ... ) -> str: ...
def _generate_m2o_order_by(
self,
alias: str,
order_field: str,
query: Query,
reverse_direction: bool,
seen: set | None,
) -> list[str]: ...
def _generate_order_by_inner(
self,
alias: str,
order_spec: str,
query: Query,
reverse_direction: bool = ...,
seen: set | None = ...,
) -> list[str]: ...
def _generate_order_by(self, order_spec: str | None, query: Query) -> str: ... def _generate_order_by(self, order_spec: str | None, query: Query) -> str: ...
def _flush_search(self, domain: _Domain, fields: Sequence[str] | None = ..., order: str | None = ..., seen: set | None = ...) -> None: ... def _flush_search(
def _search(self: _ModelT, args: _Domain, offset: int = ..., limit: int | None = ..., order: str | None = ..., count: bool = ..., access_rights_uid: int | None = ...) -> Query | int: ... self,
def copy_data(self, default: dict[str, Any] | None = ...) -> list[dict[str, Any]]: ... domain: _Domain,
def copy_translations(old: _ModelT, new: _ModelT, excluded: Container[str] = ...) -> None: ... fields: Sequence[str] | None = ...,
order: str | None = ...,
seen: set | None = ...,
) -> None: ...
def _search(
self: _ModelT,
args: _Domain,
offset: int = ...,
limit: int | None = ...,
order: str | None = ...,
count: bool = ...,
access_rights_uid: int | None = ...,
) -> Query | int: ...
def copy_data(
self, default: dict[str, Any] | None = ...
) -> list[dict[str, Any]]: ...
def copy_translations(
old: _ModelT, new: _ModelT, excluded: Container[str] = ...
) -> None: ...
def copy(self: _ModelT, default: dict[str, Any] | None = ...) -> _ModelT: ... def copy(self: _ModelT, default: dict[str, Any] | None = ...) -> _ModelT: ...
def exists(self: _ModelT) -> _ModelT: ... def exists(self: _ModelT) -> _ModelT: ...
def _check_recursion(self, parent: str | None = ...) -> bool: ... def _check_recursion(self, parent: str | None = ...) -> bool: ...
@@ -242,9 +411,18 @@ class BaseModel(metaclass=MetaModel):
def _transient_clean_rows_older_than(self, seconds: int) -> None: ... def _transient_clean_rows_older_than(self, seconds: int) -> None: ...
def _transient_clean_old_rows(self, max_count: int) -> None: ... def _transient_clean_old_rows(self, max_count: int) -> None: ...
def _transient_vacuum(self, force: bool = ...): ... def _transient_vacuum(self, force: bool = ...): ...
def resolve_2many_commands(self, field_name: str, commands: list, fields: list[str] | None = ...): ... def resolve_2many_commands(
self, field_name: str, commands: list, fields: list[str] | None = ...
): ...
resolve_o2m_commands_to_record_dicts = resolve_2many_commands resolve_o2m_commands_to_record_dicts = resolve_2many_commands
def search_read(self, domain: _Domain | None = ..., fields: list[str] | None = ..., offset: int = ..., limit: int | None = ..., order: str | None = ...) -> list[dict[str, Any]]: ... def search_read(
self,
domain: _Domain | None = ...,
fields: list[str] | None = ...,
offset: int = ...,
limit: int | None = ...,
order: str | None = ...,
) -> list[dict[str, Any]]: ...
def toggle_active(self) -> None: ... def toggle_active(self) -> None: ...
def action_archive(self): ... def action_archive(self): ...
def action_unarchive(self): ... def action_unarchive(self): ...
@@ -255,8 +433,12 @@ class BaseModel(metaclass=MetaModel):
@classmethod @classmethod
def _revert_method(cls, name: str) -> None: ... def _revert_method(cls, name: str) -> None: ...
@classmethod @classmethod
def _browse(cls: type[_ModelT], env: Environment, ids: tuple, prefetch_ids: Iterable[int]) -> _ModelT: ... def _browse(
def browse(self: _ModelT, ids: int | NewId | Iterable[int | NewId] | None = ...) -> _ModelT: ... cls: type[_ModelT], env: Environment, ids: tuple, prefetch_ids: Iterable[int]
) -> _ModelT: ...
def browse(
self: _ModelT, ids: int | NewId | Iterable[int | NewId] | None = ...
) -> _ModelT: ...
@property @property
def ids(self) -> list[int]: ... def ids(self) -> list[int]: ...
_cr: Cursor _cr: Cursor
@@ -265,9 +447,13 @@ class BaseModel(metaclass=MetaModel):
def ensure_one(self: _ModelT) -> _ModelT: ... def ensure_one(self: _ModelT) -> _ModelT: ...
def with_env(self: _ModelT, env: Environment) -> _ModelT: ... def with_env(self: _ModelT, env: Environment) -> _ModelT: ...
def sudo(self: _ModelT, flag: bool = ...) -> _ModelT: ... def sudo(self: _ModelT, flag: bool = ...) -> _ModelT: ...
def with_user(self: _ModelT, user: Union['odoo.model.res_partner', int]) -> _ModelT: ... def with_user(
self: _ModelT, user: Union["odoo.model.res_partner", int]
) -> _ModelT: ...
def with_context(self: _ModelT, *args, **kwargs) -> _ModelT: ... def with_context(self: _ModelT, *args, **kwargs) -> _ModelT: ...
def with_prefetch(self: _ModelT, prefetch_ids: Iterable[int] | None = ...) -> _ModelT: ... def with_prefetch(
self: _ModelT, prefetch_ids: Iterable[int] | None = ...
) -> _ModelT: ...
def _update_cache(self, values: dict[str, Any], validate: bool = ...): ... def _update_cache(self, values: dict[str, Any], validate: bool = ...): ...
def _convert_to_record(self, values: dict[str, Any]): ... def _convert_to_record(self, values: dict[str, Any]): ...
def _convert_to_write(self, values: dict[str, Any]) -> dict[str, Any]: ... def _convert_to_write(self, values: dict[str, Any]) -> dict[str, Any]: ...
@@ -276,10 +462,19 @@ class BaseModel(metaclass=MetaModel):
def _mapped_cache(self, name_seq: str): ... def _mapped_cache(self, name_seq: str): ...
def filtered(self: _ModelT, func: Callable | str) -> _ModelT: ... def filtered(self: _ModelT, func: Callable | str) -> _ModelT: ...
def filtered_domain(self: _ModelT, domain: _Domain) -> _ModelT: ... def filtered_domain(self: _ModelT, domain: _Domain) -> _ModelT: ...
def sorted(self: _ModelT, key: Callable | str | None = ..., reverse: bool = ...) -> _ModelT: ... def sorted(
self: _ModelT, key: Callable | str | None = ..., reverse: bool = ...
) -> _ModelT: ...
def update(self, values: dict[str, Any]) -> None: ... def update(self, values: dict[str, Any]) -> None: ...
def flush(self, fnames: Collection[str] | None = ..., records: BaseModel | None = ...) -> None: ... def flush(
def new(self: _ModelT, values: dict[str, Any] = ..., origin: _ModelT | None = ..., ref: Any | None = ...) -> _ModelT: ... self, fnames: Collection[str] | None = ..., records: BaseModel | None = ...
) -> None: ...
def new(
self: _ModelT,
values: dict[str, Any] = ...,
origin: _ModelT | None = ...,
ref: Any | None = ...,
) -> _ModelT: ...
@property @property
def _origin(self: _ModelT) -> _ModelT: ... def _origin(self: _ModelT) -> _ModelT: ...
def __bool__(self) -> bool: ... def __bool__(self) -> bool: ...
@@ -306,15 +501,30 @@ class BaseModel(metaclass=MetaModel):
def _cache(self) -> RecordCache: ... def _cache(self) -> RecordCache: ...
def _in_cache_without(self: _ModelT, field: Field, limit: int = ...) -> _ModelT: ... def _in_cache_without(self: _ModelT, field: Field, limit: int = ...) -> _ModelT: ...
def refresh(self) -> None: ... def refresh(self) -> None: ...
def invalidate_cache(self, fnames: Collection[str] | None = ..., ids: Iterable[int] | None = ...) -> None: ... def invalidate_cache(
def modified(self, fnames: Collection[str], create: bool = ..., before: bool = ...) -> None: ... self, fnames: Collection[str] | None = ..., ids: Iterable[int] | None = ...
def _modified_triggers(self: _ModelT, tree: dict[Field | None, Any], create: bool = ...) -> Iterator[tuple[Field, _ModelT, bool]]: ... ) -> None: ...
def recompute(self, fnames: Collection[str] | None = ..., records: Union[BaseModel, None] = ...) -> None: ... def modified(
self, fnames: Collection[str], create: bool = ..., before: bool = ...
) -> None: ...
def _modified_triggers(
self: _ModelT, tree: dict[Field | None, Any], create: bool = ...
) -> Iterator[tuple[Field, _ModelT, bool]]: ...
def recompute(
self,
fnames: Collection[str] | None = ...,
records: Union[BaseModel, None] = ...,
) -> None: ...
def _dependent_fields(self, field: Field) -> Iterator[Field]: ... def _dependent_fields(self, field: Field) -> Iterator[Field]: ...
def _has_onchange(self, field: Field, other_fields: Container[Field]) -> bool: ... def _has_onchange(self, field: Field, other_fields: Container[Field]) -> bool: ...
def _onchange_spec(self, view_info: dict | None = ...) -> dict: ... def _onchange_spec(self, view_info: dict | None = ...) -> dict: ...
def _onchange_eval(self, field_name: str, onchange: str, result: dict) -> None: ... def _onchange_eval(self, field_name: str, onchange: str, result: dict) -> None: ...
def onchange(self, values: dict[str, Any], field_name: str | list[str] | bool, field_onchange: dict[str, str]) -> dict: ... def onchange(
self,
values: dict[str, Any],
field_name: str | list[str] | bool,
field_onchange: dict[str, str],
) -> dict: ...
class RecordCache(MutableMapping): class RecordCache(MutableMapping):
_record: BaseModel _record: BaseModel
@@ -341,9 +551,15 @@ class TransientModel(Model):
_transient: bool _transient: bool
def itemgetter_tuple(items) -> Callable[..., tuple]: ... def itemgetter_tuple(items) -> Callable[..., tuple]: ...
def convert_pgerror_not_null(model: BaseModel, fields: dict[str, dict[str, Any]], info, e: psycopg2.Error) -> dict[str, str]: ... def convert_pgerror_not_null(
def convert_pgerror_unique(model: BaseModel, fields: dict[str, dict[str, Any]], info, e: psycopg2.Error) -> dict[str, str]: ... model: BaseModel, fields: dict[str, dict[str, Any]], info, e: psycopg2.Error
def convert_pgerror_constraint(model: BaseModel, fields: dict[str, dict[str, Any]], info, e: psycopg2.Error) -> dict[str, str]: ... ) -> dict[str, str]: ...
def convert_pgerror_unique(
model: BaseModel, fields: dict[str, dict[str, Any]], info, e: psycopg2.Error
) -> dict[str, str]: ...
def convert_pgerror_constraint(
model: BaseModel, fields: dict[str, dict[str, Any]], info, e: psycopg2.Error
) -> dict[str, str]: ...
PGERROR_TO_OE: dict[str, Callable] PGERROR_TO_OE: dict[str, Callable]

View File

@@ -1,24 +1,20 @@
from . import ( from . import db as db
db as db, from . import graph as graph
graph as graph, from . import loading as loading
loading as loading, from . import migration as migration
migration as migration, from . import module as module
module as module, from . import registry as registry
registry as registry from .loading import load_modules as load_modules
) from .loading import reset_modules_state as reset_modules_state
from .loading import ( from .module import adapt_version as adapt_version
load_modules as load_modules, from .module import get_module_path as get_module_path
reset_modules_state as reset_modules_state from .module import get_module_resource as get_module_resource
) from .module import get_modules as get_modules
from .module import get_modules_with_version as get_modules_with_version
from .module import get_resource_from_path as get_resource_from_path
from .module import get_resource_path as get_resource_path
from .module import initialize_sys_path as initialize_sys_path
from .module import ( from .module import (
adapt_version as adapt_version,
get_module_path as get_module_path,
get_module_resource as get_module_resource,
get_modules as get_modules,
get_modules_with_version as get_modules_with_version,
get_resource_from_path as get_resource_from_path,
get_resource_path as get_resource_path,
initialize_sys_path as initialize_sys_path,
load_information_from_description_file as load_information_from_description_file, load_information_from_description_file as load_information_from_description_file,
load_openerp_module as load_openerp_module
) )
from .module import load_openerp_module as load_openerp_module

View File

@@ -6,7 +6,9 @@ class Graph(dict[str, Node]):
def add_node(self, name: str, info: dict[str, Any]) -> Node: ... def add_node(self, name: str, info: dict[str, Any]) -> Node: ...
def update_from_db(self, cr: Cursor) -> None: ... def update_from_db(self, cr: Cursor) -> None: ...
def add_module(self, cr: Cursor, module: str, force: list | None = ...) -> None: ... def add_module(self, cr: Cursor, module: str, force: list | None = ...) -> None: ...
def add_modules(self, cr: Cursor, module_list: list[str], force: list | None = ...): ... def add_modules(
self, cr: Cursor, module_list: list[str], force: list | None = ...
): ...
def __iter__(self) -> Iterator[Node]: ... def __iter__(self) -> Iterator[Node]: ...
def __str__(self) -> str: ... def __str__(self) -> str: ...
@@ -21,7 +23,9 @@ class Node:
dbdemo: bool dbdemo: bool
state: str state: str
installed_version: str installed_version: str
def __init__(self, name: str, graph: Graph, info: dict[str, Any] | None) -> None: ... def __init__(
self, name: str, graph: Graph, info: dict[str, Any] | None
) -> None: ...
@property @property
def data(self) -> dict[str, Any]: ... def data(self) -> dict[str, Any]: ...
def add_child(self, name: str, info: dict[str, Any]): ... def add_child(self, name: str, info: dict[str, Any]): ...

View File

@@ -1,17 +1,51 @@
from typing import Any, Iterable from typing import Any, Iterable
from ..sql_db import Connection, Cursor
from ..tools.assertion_report import assertion_report
from .graph import Graph, Node from .graph import Graph, Node
from .registry import Registry from .registry import Registry
from ..sql_db import Cursor, Connection
from ..tools.assertion_report import assertion_report
def load_data(cr: Cursor, idref: dict, mode: str, kind: str, package: Node, report: assertion_report) -> bool: ... def load_data(
def load_demo(cr: Cursor, package: Node, idref: dict, mode: str, report: assertion_report | None = ...) -> bool: ... cr: Cursor,
idref: dict,
mode: str,
kind: str,
package: Node,
report: assertion_report,
) -> bool: ...
def load_demo(
cr: Cursor,
package: Node,
idref: dict,
mode: str,
report: assertion_report | None = ...,
) -> bool: ...
def force_demo(cr: Cursor) -> None: ... def force_demo(cr: Cursor) -> None: ...
def load_module_graph(cr: Cursor, graph: Graph, status: Any | None = ..., perform_checks: Any = ..., skip_modules: list[str] | None = ..., def load_module_graph(
report: assertion_report | None = ..., models_to_check: set[str] | None = ...) -> tuple[list[str], list[str]]: ... cr: Cursor,
graph: Graph,
status: Any | None = ...,
perform_checks: Any = ...,
skip_modules: list[str] | None = ...,
report: assertion_report | None = ...,
models_to_check: set[str] | None = ...,
) -> tuple[list[str], list[str]]: ...
def _check_module_names(cr: Cursor, module_names: Iterable[str]) -> None: ... def _check_module_names(cr: Cursor, module_names: Iterable[str]) -> None: ...
def load_marked_modules(cr: Cursor, graph: Graph, states: list[str], force: list[str], progressdict, report: assertion_report, def load_marked_modules(
loaded_modules: list[str], perform_checks: Any, models_to_check: set[str] | None = ...) -> list[str]: ... cr: Cursor,
def load_modules(db: Connection, force_demo: bool = ..., status: Any | None = ..., update_module: Any = ...) -> Registry | None: ... graph: Graph,
states: list[str],
force: list[str],
progressdict,
report: assertion_report,
loaded_modules: list[str],
perform_checks: Any,
models_to_check: set[str] | None = ...,
) -> list[str]: ...
def load_modules(
db: Connection,
force_demo: bool = ...,
status: Any | None = ...,
update_module: Any = ...,
) -> Registry | None: ...
def reset_modules_state(db_name: str) -> None: ... def reset_modules_state(db_name: str) -> None: ...

View File

@@ -1,7 +1,7 @@
from types import ModuleType from types import ModuleType
from .graph import Graph, Node
from ..sql_db import Cursor from ..sql_db import Cursor
from .graph import Graph, Node
def load_script(path: str, module_name: str) -> ModuleType: ... def load_script(path: str, module_name: str) -> ModuleType: ...

View File

@@ -1,6 +1,6 @@
import unittest import unittest
from types import ModuleType from types import ModuleType
from typing import Any, Literal, MutableSequence, Generator from typing import Any, Generator, Literal, MutableSequence
MANIFEST_NAMES: tuple[str, ...] MANIFEST_NAMES: tuple[str, ...]
README: list[str] README: list[str]
@@ -22,16 +22,21 @@ class UpgradeHook:
def load_module(self, name: str) -> ModuleType | None: ... def load_module(self, name: str) -> ModuleType | None: ...
def initialize_sys_path() -> None: ... def initialize_sys_path() -> None: ...
def get_module_path(module: str, downloaded: bool = ..., display_warning: bool = ...) -> str | Literal[False]: ... def get_module_path(
module: str, downloaded: bool = ..., display_warning: bool = ...
) -> str | Literal[False]: ...
def get_module_filetree(module: str, dir: str = ...) -> dict: ... def get_module_filetree(module: str, dir: str = ...) -> dict: ...
def get_resource_path(module: str, *args) -> str | Literal[False]: ... def get_resource_path(module: str, *args) -> str | Literal[False]: ...
get_module_resource = get_resource_path get_module_resource = get_resource_path
def get_resource_from_path(path: str) -> tuple[str, str, str] | None: ... def get_resource_from_path(path: str) -> tuple[str, str, str] | None: ...
def get_module_icon(module: str) -> str: ... def get_module_icon(module: str) -> str: ...
def module_manifest(path: str) -> str | None: ... def module_manifest(path: str) -> str | None: ...
def get_module_root(path: str) -> str | None: ... def get_module_root(path: str) -> str | None: ...
def load_information_from_description_file(module: str, mod_path: str | None = ...) -> dict: ... def load_information_from_description_file(
module: str, mod_path: str | None = ...
) -> dict: ...
def load_openerp_module(module_name: str) -> None: ... def load_openerp_module(module_name: str) -> None: ...
def get_modules() -> list[str]: ... def get_modules() -> list[str]: ...
def get_modules_with_version() -> dict[str, Any]: ... def get_modules_with_version() -> dict[str, Any]: ...
@@ -41,7 +46,17 @@ def _get_tests_modules(path: str, module: str) -> list: ...
def _get_upgrade_test_modules(module) -> Generator[ModuleType, None, None]: ... def _get_upgrade_test_modules(module) -> Generator[ModuleType, None, None]: ...
class OdooTestResult(unittest.result.TestResult): class OdooTestResult(unittest.result.TestResult):
def log(self, level, msg, *args, test: Any | None = ..., exc_info: Any | None = ..., extra: Any | None = ..., stack_info: bool = ..., caller_infos: Any | None = ...) -> None: ... def log(
self,
level,
msg,
*args,
test: Any | None = ...,
exc_info: Any | None = ...,
extra: Any | None = ...,
stack_info: bool = ...,
caller_infos: Any | None = ...
) -> None: ...
def getDescription(self, test): ... def getDescription(self, test): ...
def startTest(self, test) -> None: ... def startTest(self, test) -> None: ...
def addError(self, test, err) -> None: ... def addError(self, test, err) -> None: ...

View File

@@ -5,11 +5,11 @@ from threading import RLock
from typing import Any, Callable, ClassVar, Iterable, Iterator from typing import Any, Callable, ClassVar, Iterable, Iterator
from weakref import WeakValueDictionary from weakref import WeakValueDictionary
from .graph import Node
from ..models import BaseModel from ..models import BaseModel
from ..sql_db import Connection, Cursor from ..sql_db import Connection, Cursor
from ..tools.assertion_report import assertion_report from ..tools.assertion_report import assertion_report
from ..tools.lru import LRU from ..tools.lru import LRU
from .graph import Node
class Registry(Mapping[str, type[BaseModel]]): class Registry(Mapping[str, type[BaseModel]]):
_lock: RLock _lock: RLock
@@ -18,7 +18,13 @@ class Registry(Mapping[str, type[BaseModel]]):
registries: ClassVar[LRU] registries: ClassVar[LRU]
def __new__(cls, db_name: str) -> Registry: ... def __new__(cls, db_name: str) -> Registry: ...
@classmethod @classmethod
def new(cls, db_name: str, force_demo: bool = ..., status: Any | None = ..., update_module: bool = ...) -> Registry: ... def new(
cls,
db_name: str,
force_demo: bool = ...,
status: Any | None = ...,
update_module: bool = ...,
) -> Registry: ...
models: dict[str, type[BaseModel]] models: dict[str, type[BaseModel]]
_sql_constraints: set _sql_constraints: set
_init: bool _init: bool
@@ -58,7 +64,9 @@ class Registry(Mapping[str, type[BaseModel]]):
def post_constraint(self, func: Callable, *args, **kwargs) -> None: ... def post_constraint(self, func: Callable, *args, **kwargs) -> None: ...
def finalize_constraints(self) -> None: ... def finalize_constraints(self) -> None: ...
_is_install: bool _is_install: bool
def init_models(self, cr: Cursor, model_names: Iterable[str], context: dict, install: bool = ...) -> None: ... def init_models(
self, cr: Cursor, model_names: Iterable[str], context: dict, install: bool = ...
) -> None: ...
def check_tables_exist(self, cr: Cursor) -> None: ... def check_tables_exist(self, cr: Cursor) -> None: ...
@property @property
def cache(self) -> LRU: ... def cache(self) -> LRU: ...

View File

@@ -1,7 +1,9 @@
import logging.handlers import logging.handlers
from logging import Logger, LogRecord from logging import Logger, LogRecord
def log(logger: Logger, level: int, prefix: str, msg, depth: int | None = ...) -> None: ... def log(
logger: Logger, level: int, prefix: str, msg, depth: int | None = ...
) -> None: ...
class PostgreSQLHandler(logging.Handler): class PostgreSQLHandler(logging.Handler):
def emit(self, record: LogRecord) -> None: ... def emit(self, record: LogRecord) -> None: ...
@@ -23,11 +25,15 @@ COLOR_PATTERN: str
LEVEL_COLOR_MAPPING: dict[int, tuple[int, int]] LEVEL_COLOR_MAPPING: dict[int, tuple[int, int]]
class PerfFilter(logging.Filter): class PerfFilter(logging.Filter):
def format_perf(self, query_count: int, query_time: float, remaining_time: float): ... def format_perf(
self, query_count: int, query_time: float, remaining_time: float
): ...
def filter(self, record: LogRecord): ... def filter(self, record: LogRecord): ...
class ColoredPerfFilter(PerfFilter): class ColoredPerfFilter(PerfFilter):
def format_perf(self, query_count: int, query_time: float, remaining_time: float): ... def format_perf(
self, query_count: int, query_time: float, remaining_time: float
): ...
class DBFormatter(logging.Formatter): class DBFormatter(logging.Formatter):
def format(self, record: LogRecord): ... def format(self, record: LogRecord): ...

View File

@@ -1,7 +1,8 @@
from functools import partial as partial from functools import partial as partial
from typing import Any, Callable from typing import Any, Callable
from ..models import BaseModel, MAGIC_COLUMNS as MAGIC_COLUMNS from ..models import MAGIC_COLUMNS as MAGIC_COLUMNS
from ..models import BaseModel
from ..sql_db import Cursor from ..sql_db import Cursor
from ..tools.misc import get_lang as get_lang from ..tools.misc import get_lang as get_lang
@@ -28,13 +29,24 @@ def OR(domains: list[_Domain]) -> _Domain: ...
def distribute_not(domain: _Domain) -> _Domain: ... def distribute_not(domain: _Domain) -> _Domain: ...
def _quote(to_quote: str) -> str: ... def _quote(to_quote: str) -> str: ...
def _shorten_alias(alias: str) -> str: ... def _shorten_alias(alias: str) -> str: ...
def generate_table_alias(src_table_alias: str, joined_tables: list = ...) -> tuple[str, str]: ... def generate_table_alias(
src_table_alias: str, joined_tables: list = ...
) -> tuple[str, str]: ...
def get_alias_from_query(from_query: str) -> tuple[str, str]: ... def get_alias_from_query(from_query: str) -> tuple[str, str]: ...
def normalize_leaf(element): ... def normalize_leaf(element): ...
def is_operator(element) -> bool: ... def is_operator(element) -> bool: ...
def is_leaf(element, internal: bool = ...) -> bool: ... def is_leaf(element, internal: bool = ...) -> bool: ...
def select_from_where(cr: Cursor, select_field: str, from_table: str, where_field: str, where_ids: list[int], where_operator: str) -> list: ... def select_from_where(
def select_distinct_from_where_not_null(cr: Cursor, select_field: str, from_table: str) -> list: ... cr: Cursor,
select_field: str,
from_table: str,
where_field: str,
where_ids: list[int],
where_operator: str,
) -> list: ...
def select_distinct_from_where_not_null(
cr: Cursor, select_field: str, from_table: str
) -> list: ...
def get_unaccent_wrapper(cr: Cursor) -> Callable[[Any], str]: ... def get_unaccent_wrapper(cr: Cursor) -> Callable[[Any], str]: ...
class ExtendedLeaf: class ExtendedLeaf:
@@ -42,7 +54,13 @@ class ExtendedLeaf:
leaf: Any leaf: Any
model: BaseModel model: BaseModel
_models: list[BaseModel] _models: list[BaseModel]
def __init__(self, leaf, model: BaseModel, join_context: list[tuple] | None = ..., internal: bool = ...) -> None: ... def __init__(
self,
leaf,
model: BaseModel,
join_context: list[tuple] | None = ...,
internal: bool = ...,
) -> None: ...
def __str__(self) -> str: ... def __str__(self) -> str: ...
def generate_alias(self) -> str: ... def generate_alias(self) -> str: ...
def add_join_context(self, model, lhs_col, table_col, link) -> None: ... def add_join_context(self, model, lhs_col, table_col, link) -> None: ...
@@ -56,7 +74,12 @@ class ExtendedLeaf:
def is_leaf(self, internal: bool = ...): ... def is_leaf(self, internal: bool = ...): ...
def normalize_leaf(self) -> bool: ... def normalize_leaf(self) -> bool: ...
def create_substitution_leaf(leaf: ExtendedLeaf, new_elements, new_model: BaseModel | None = ..., internal: bool = ...) -> ExtendedLeaf: ... def create_substitution_leaf(
leaf: ExtendedLeaf,
new_elements,
new_model: BaseModel | None = ...,
internal: bool = ...,
) -> ExtendedLeaf: ...
class expression: class expression:
_unaccent: Callable[[Any], str] _unaccent: Callable[[Any], str]

View File

@@ -6,9 +6,23 @@ class Query:
where_clause_params: list = ... where_clause_params: list = ...
joins: dict = ... joins: dict = ...
extras: dict = ... extras: dict = ...
def __init__(self, tables: list[str] | None = ..., where_clause: list | None = ..., where_clause_params: list | None = ..., joins: dict | None = ..., extras: dict | None = ...) -> None: ... def __init__(
self,
tables: list[str] | None = ...,
where_clause: list | None = ...,
where_clause_params: list | None = ...,
joins: dict | None = ...,
extras: dict | None = ...,
) -> None: ...
def _get_table_aliases(self) -> list: ... def _get_table_aliases(self) -> list: ...
def _get_alias_mapping(self) -> dict: ... def _get_alias_mapping(self) -> dict: ...
def add_join(self, connection: tuple, implicit: bool = ..., outer: bool = ..., extra: str | None = ..., extra_params: list = ...): ... def add_join(
self,
connection: tuple,
implicit: bool = ...,
outer: bool = ...,
extra: str | None = ...,
extra_params: list = ...,
): ...
def get_sql(self) -> str: ... def get_sql(self) -> str: ...
def __str__(self) -> str: ... def __str__(self) -> str: ...

View File

@@ -1 +1,5 @@
from . import common as common, db as db, model as model, server as server, wsgi_server as wsgi_server from . import common as common
from . import db as db
from . import model as model
from . import server as server
from . import wsgi_server as wsgi_server

View File

@@ -4,7 +4,9 @@ from typing import Any, Literal
RPC_VERSION_1: dict[str, Any] RPC_VERSION_1: dict[str, Any]
def exp_login(db: str, login: str, password: str) -> int: ... def exp_login(db: str, login: str, password: str) -> int: ...
def exp_authenticate(db: str, login: str, password: str, user_agent_env: dict | None) -> int: ... def exp_authenticate(
db: str, login: str, password: str, user_agent_env: dict | None
) -> int: ...
def exp_version() -> dict[str, Any]: ... def exp_version() -> dict[str, Any]: ...
def exp_about(extended: bool = ...) -> str | tuple[str, str]: ... def exp_about(extended: bool = ...) -> str | tuple[str, str]: ...
def exp_set_loglevel(loglevel, logger: Logger | None = ...) -> Literal[True]: ... def exp_set_loglevel(loglevel, logger: Logger | None = ...) -> Literal[True]: ...

View File

@@ -1,19 +1,34 @@
from functools import wraps as wraps from functools import wraps as wraps
from typing import Any, Callable, IO, Iterable, Literal, TypeVar from typing import IO, Any, Callable, Iterable, Literal, TypeVar
from ..sql_db import Cursor from ..sql_db import Cursor
_CallableT = TypeVar('_CallableT', bound=Callable) _CallableT = TypeVar("_CallableT", bound=Callable)
class DatabaseExists(Warning): ... class DatabaseExists(Warning): ...
def check_db_management_enabled(method: _CallableT) -> _CallableT: ... def check_db_management_enabled(method: _CallableT) -> _CallableT: ...
def check_super(passwd: str) -> Literal[True]: ... def check_super(passwd: str) -> Literal[True]: ...
def _initialize_db(id, db_name: str, demo: bool, lang: str, user_password: str, login: str = ..., def _initialize_db(
country_code: str | None = ..., phone: str | None = ...) -> None: ... id,
db_name: str,
demo: bool,
lang: str,
user_password: str,
login: str = ...,
country_code: str | None = ...,
phone: str | None = ...,
) -> None: ...
def _create_empty_database(name: str) -> None: ... def _create_empty_database(name: str) -> None: ...
def exp_create_database(db_name: str, demo: bool, lang: str, user_password: str = ..., login: str = ..., def exp_create_database(
country_code: str | None = ..., phone: str | None = ...) -> Literal[True]: ... db_name: str,
demo: bool,
lang: str,
user_password: str = ...,
login: str = ...,
country_code: str | None = ...,
phone: str | None = ...,
) -> Literal[True]: ...
def exp_duplicate_database(db_original_name: str, db_name: str) -> Literal[True]: ... def exp_duplicate_database(db_original_name: str, db_name: str) -> Literal[True]: ...
def _drop_conn(cr: Cursor, db_name: str) -> None: ... def _drop_conn(cr: Cursor, db_name: str) -> None: ...
def exp_drop(db_name: str) -> bool: ... def exp_drop(db_name: str) -> bool: ...

View File

@@ -5,10 +5,12 @@ from ..sql_db import Cursor
PG_CONCURRENCY_ERRORS_TO_RETRY: tuple[str, str, str] PG_CONCURRENCY_ERRORS_TO_RETRY: tuple[str, str, str]
MAX_TRIES_ON_CONCURRENCY_FAILURE: int MAX_TRIES_ON_CONCURRENCY_FAILURE: int
_CallableT = TypeVar('_CallableT', bound=Callable) _CallableT = TypeVar("_CallableT", bound=Callable)
def dispatch(method: str, params): ... def dispatch(method: str, params): ...
def check(f: _CallableT) -> _CallableT: ... def check(f: _CallableT) -> _CallableT: ...
def execute_cr(cr: Cursor, uid: int, obj: str, method: str, *args, **kw): ... def execute_cr(cr: Cursor, uid: int, obj: str, method: str, *args, **kw): ...
def execute_kw(db: str, uid: int, obj: str, method: str, args, kw: dict | None = ...): ... def execute_kw(
db: str, uid: int, obj: str, method: str, args, kw: dict | None = ...
): ...
def execute(db: str, uid: int, obj: str, method: str, *args, **kw): ... def execute(db: str, uid: int, obj: str, method: str, *args, **kw): ...

View File

@@ -5,5 +5,7 @@ from ..http import OpenERPSession
def login(db: str, login: str, password: str) -> int | Literal[False]: ... def login(db: str, login: str, password: str) -> int | Literal[False]: ...
def check(db: str, uid: int, passwd: str) -> None: ... def check(db: str, uid: int, passwd: str) -> None: ...
def compute_session_token(session: OpenERPSession, env: Environment) -> str | Literal[False]: ... def compute_session_token(
session: OpenERPSession, env: Environment
) -> str | Literal[False]: ...
def check_session(session: OpenERPSession, env: Environment) -> bool: ... def check_session(session: OpenERPSession, env: Environment) -> bool: ...

View File

@@ -1,11 +1,10 @@
from itertools import chain as chain
from socket import socket as socket_ from socket import socket as socket_
from threading import Semaphore, Thread from threading import Semaphore, Thread
from gevent.pywsgi import WSGIServer
from itertools import chain as chain
from typing import Any, Callable, Iterable, Literal, TypeVar from typing import Any, Callable, Iterable, Literal, TypeVar
import werkzeug.serving import werkzeug.serving
from gevent.pywsgi import WSGIServer
from inotify.adapters import InotifyTrees from inotify.adapters import InotifyTrees
from psutil import Process from psutil import Process
from watchdog.observers import Observer from watchdog.observers import Observer
@@ -14,7 +13,7 @@ from ..modules.registry import Registry
from ..sql_db import Cursor from ..sql_db import Cursor
from ..tests import runner as runner from ..tests import runner as runner
_WorkerT = TypeVar('_WorkerT', bound=Worker) _WorkerT = TypeVar("_WorkerT", bound=Worker)
INOTIFY_LISTEN_EVENTS: Any INOTIFY_LISTEN_EVENTS: Any
SLEEP_INTERVAL: int SLEEP_INTERVAL: int
@@ -33,7 +32,9 @@ class BaseWSGIServerNoBind(LoggingBaseWSGIServerMixIn, werkzeug.serving.BaseWSGI
class RequestHandler(werkzeug.serving.WSGIRequestHandler): class RequestHandler(werkzeug.serving.WSGIRequestHandler):
def setup(self) -> None: ... def setup(self) -> None: ...
class ThreadedWSGIServerReloadable(LoggingBaseWSGIServerMixIn, werkzeug.serving.ThreadedWSGIServer): class ThreadedWSGIServerReloadable(
LoggingBaseWSGIServerMixIn, werkzeug.serving.ThreadedWSGIServer
):
max_http_threads: Any max_http_threads: Any
http_threads_sem: Semaphore http_threads_sem: Semaphore
daemon_threads: bool daemon_threads: bool
@@ -123,7 +124,9 @@ class PreforkServer(CommonServer):
def pipe_new(self) -> tuple[int, int]: ... def pipe_new(self) -> tuple[int, int]: ...
def pipe_ping(self, pipe: tuple[int, int]) -> None: ... def pipe_ping(self, pipe: tuple[int, int]) -> None: ...
def signal_handler(self, sig: int, frame) -> None: ... def signal_handler(self, sig: int, frame) -> None: ...
def worker_spawn(self, klass: Callable[..., _WorkerT], workers_registry: dict[int, _WorkerT]) -> _WorkerT | None: ... def worker_spawn(
self, klass: Callable[..., _WorkerT], workers_registry: dict[int, _WorkerT]
) -> _WorkerT | None: ...
def long_polling_spawn(self) -> None: ... def long_polling_spawn(self) -> None: ...
def worker_pop(self, pid: int) -> None: ... def worker_pop(self, pid: int) -> None: ...
def worker_kill(self, pid: int, sig: int) -> None: ... def worker_kill(self, pid: int, sig: int) -> None: ...

View File

@@ -1,6 +1,7 @@
from werkzeug.middleware.proxy_fix import ProxyFix as ProxyFix_
from typing import Callable from typing import Callable
from werkzeug.middleware.proxy_fix import ProxyFix as ProxyFix_
RPC_FAULT_CODE_CLIENT_ERROR: int RPC_FAULT_CODE_CLIENT_ERROR: int
RPC_FAULT_CODE_APPLICATION_ERROR: int RPC_FAULT_CODE_APPLICATION_ERROR: int
RPC_FAULT_CODE_WARNING: int RPC_FAULT_CODE_WARNING: int

View File

@@ -1,12 +1,22 @@
from re import Pattern from re import Pattern
from threading import Lock, RLock from threading import Lock, RLock
from typing import Any, Callable, Iterable, Iterator, Literal, NoReturn, Sequence, TypeVar, Generator from typing import (
Any,
Callable,
Generator,
Iterable,
Iterator,
Literal,
NoReturn,
Sequence,
TypeVar,
)
import psycopg2.extensions import psycopg2.extensions
_T = TypeVar('_T') _T = TypeVar("_T")
_CallableT = TypeVar('_CallableT', bound=Callable) _CallableT = TypeVar("_CallableT", bound=Callable)
_CursorT = TypeVar('_CursorT', bound=Cursor) _CursorT = TypeVar("_CursorT", bound=Cursor)
def unbuffer(symb, cr) -> str | None: ... def unbuffer(symb, cr) -> str | None: ...
def undecimalize(symb, cr) -> float | None: ... def undecimalize(symb, cr) -> float | None: ...
@@ -36,14 +46,20 @@ class Cursor:
_default_log_exceptions: bool _default_log_exceptions: bool
cache: dict cache: dict
_event_handlers: dict[str, list[Callable]] _event_handlers: dict[str, list[Callable]]
def __init__(self, pool: ConnectionPool, dbname: str, dsn: dict, serialized: bool = ...) -> None: ... def __init__(
self, pool: ConnectionPool, dbname: str, dsn: dict, serialized: bool = ...
) -> None: ...
def __build_dict(self, row: Sequence) -> dict[str, Any]: ... def __build_dict(self, row: Sequence) -> dict[str, Any]: ...
def dictfetchone(self) -> dict[str, Any] | None: ... def dictfetchone(self) -> dict[str, Any] | None: ...
def dictfetchmany(self, size) -> list[dict[str, Any]]: ... def dictfetchmany(self, size) -> list[dict[str, Any]]: ...
def dictfetchall(self) -> list[dict[str, Any]]: ... def dictfetchall(self) -> list[dict[str, Any]]: ...
def __del__(self) -> None: ... def __del__(self) -> None: ...
def execute(self, query, params: Any | None = ..., log_exceptions: Any | None = ...): ... def execute(
def split_for_in_conditions(self, ids: Iterable, size: int | None = ...) -> Iterator[tuple]: ... self, query, params: Any | None = ..., log_exceptions: Any | None = ...
): ...
def split_for_in_conditions(
self, ids: Iterable, size: int | None = ...
) -> Iterator[tuple]: ...
def print_log(self): ... def print_log(self): ...
def close(self): ... def close(self): ...
def _close(self, leak: bool = ...) -> None: ... def _close(self, leak: bool = ...) -> None: ...
@@ -85,7 +101,9 @@ class ConnectionPool:
def __repr__(self) -> str: ... def __repr__(self) -> str: ...
def _debug(self, msg, *args) -> None: ... def _debug(self, msg, *args) -> None: ...
def borrow(self, connection_info: dict) -> PsycoConnection: ... def borrow(self, connection_info: dict) -> PsycoConnection: ...
def give_back(self, connection: PsycoConnection, keep_in_pool: bool = ...) -> None: ... def give_back(
self, connection: PsycoConnection, keep_in_pool: bool = ...
) -> None: ...
def close_all(self, dsn: dict | None = ...) -> None: ... def close_all(self, dsn: dict | None = ...) -> None: ...
class Connection: class Connection:

View File

@@ -1,2 +1,2 @@
from .common import *
from . import common as common from . import common as common
from .common import *

View File

@@ -1,10 +1,19 @@
import collections import collections
import logging import logging
import unittest import unittest
from re import Pattern
from itertools import count from itertools import count
from typing import Any, Callable, Generator, Generic, Iterator, Literal, Mapping, Match, TypeVar from re import Pattern
from typing import (
Any,
Callable,
Generator,
Generic,
Iterator,
Literal,
Mapping,
Match,
TypeVar,
)
from xmlrpc import client as xmlrpclib from xmlrpc import client as xmlrpclib
import requests import requests
@@ -17,10 +26,10 @@ from ..models import BaseModel
from ..modules.registry import Registry from ..modules.registry import Registry
from ..sql_db import Cursor from ..sql_db import Cursor
_T = TypeVar('_T') _T = TypeVar("_T")
_CallableT = TypeVar('_CallableT', bound=Callable) _CallableT = TypeVar("_CallableT", bound=Callable)
_ModelT = TypeVar('_ModelT', bound=BaseModel) _ModelT = TypeVar("_ModelT", bound=BaseModel)
_FormT = TypeVar('_FormT', bound=Form) _FormT = TypeVar("_FormT", bound=Form)
ADDONS_PATH: str ADDONS_PATH: str
HOST: str HOST: str
@@ -29,15 +38,25 @@ ADMIN_USER_ID: int
def get_db_name() -> str: ... def get_db_name() -> str: ...
DB: str DB: str
def at_install(flag): ... def at_install(flag): ...
def post_install(flag): ... def post_install(flag): ...
def new_test_user(
def new_test_user(env: Environment, login: str = ..., groups: str = ..., context: dict | None = ..., **kwargs) -> 'odoo.model.res_users': ... env: Environment,
login: str = ...,
groups: str = ...,
context: dict | None = ...,
**kwargs
) -> "odoo.model.res_users": ...
class OdooSuite(unittest.suite.TestSuite): class OdooSuite(unittest.suite.TestSuite):
def _handleClassSetUp(self, test, result) -> None: ... def _handleClassSetUp(self, test, result) -> None: ...
def _createClassOrModuleLevelException(self, result, exc, method_name, parent, info: Any | None = ...) -> None: ... def _createClassOrModuleLevelException(
def _addClassOrModuleLevelException(self, result, exception, errorName, info: Any | None = ...) -> None: ... self, result, exc, method_name, parent, info: Any | None = ...
) -> None: ...
def _addClassOrModuleLevelException(
self, result, exception, errorName, info: Any | None = ...
) -> None: ...
def _tearDownPreviousClass(self, test, result) -> None: ... def _tearDownPreviousClass(self, test, result) -> None: ...
class TreeCase(unittest.TestCase): class TreeCase(unittest.TestCase):
@@ -72,9 +91,15 @@ class BaseCase(TreeCase):
def ref(self, xid: str) -> int: ... def ref(self, xid: str) -> int: ...
def browse_ref(self, xid: str) -> BaseModel | None: ... def browse_ref(self, xid: str) -> BaseModel | None: ...
def _assertRaises(self, exception) -> Generator[Any, None, None]: ... def _assertRaises(self, exception) -> Generator[Any, None, None]: ...
def assertRaises(self, exception, func: Any | None = ..., *args, **kwargs) -> Generator[Any, None, None] | None: ... def assertRaises(
def assertQueryCount(self, default: int = ..., flush: bool = ..., **counters) -> Generator[None, None, None]: ... self, exception, func: Any | None = ..., *args, **kwargs
def assertRecordValues(self, records: BaseModel, expected_values: list[dict[str, Any]]) -> None: ... ) -> Generator[Any, None, None] | None: ...
def assertQueryCount(
self, default: int = ..., flush: bool = ..., **counters
) -> Generator[None, None, None]: ...
def assertRecordValues(
self, records: BaseModel, expected_values: list[dict[str, Any]]
) -> None: ...
def shortDescription(self) -> None: ... def shortDescription(self) -> None: ...
def assertItemsEqual(self, a, b, msg: str | None = ...) -> None: ... def assertItemsEqual(self, a, b, msg: str | None = ...) -> None: ...
@@ -112,7 +137,9 @@ class ChromeBrowser:
screencast_frames: list screencast_frames: list
window_size: str window_size: str
sigxcpu_handler: Any sigxcpu_handler: Any
def __init__(self, logger: logging.Logger, window_size: str, test_class: str) -> None: ... def __init__(
self, logger: logging.Logger, window_size: str, test_class: str
) -> None: ...
def signal_handler(self, sig, frame) -> None: ... def signal_handler(self, sig, frame) -> None: ...
def stop(self) -> None: ... def stop(self) -> None: ...
@property @property
@@ -120,13 +147,17 @@ class ChromeBrowser:
def _spawn_chrome(self, cmd: list[str]) -> int | None: ... def _spawn_chrome(self, cmd: list[str]) -> int | None: ...
def _chrome_start(self) -> None: ... def _chrome_start(self) -> None: ...
def _find_websocket(self) -> None: ... def _find_websocket(self) -> None: ...
def _json_command(self, command: str, timeout: int = ..., get_key: Any | None = ...): ... def _json_command(
self, command: str, timeout: int = ..., get_key: Any | None = ...
): ...
def _open_websocket(self) -> None: ... def _open_websocket(self) -> None: ...
def _websocket_send(self, method: str, params: Any | None = ...) -> int | None: ... def _websocket_send(self, method: str, params: Any | None = ...) -> int | None: ...
def _get_message(self, raise_log_error: bool = ...) -> dict: ... def _get_message(self, raise_log_error: bool = ...) -> dict: ...
_TO_LEVEL: dict[str, int] _TO_LEVEL: dict[str, int]
def _websocket_wait_id(self, awaited_id: int, timeout: int = ...) -> dict: ... def _websocket_wait_id(self, awaited_id: int, timeout: int = ...) -> dict: ...
def _websocket_wait_event(self, method: str, params: dict | None = ..., timeout: int = ...) -> dict | None: ... def _websocket_wait_event(
self, method: str, params: dict | None = ..., timeout: int = ...
) -> dict | None: ...
def take_screenshot(self, prefix: str = ..., suffix: str | None = ...) -> None: ... def take_screenshot(self, prefix: str = ..., suffix: str | None = ...) -> None: ...
def _save_screencast(self, prefix: str = ...) -> None: ... def _save_screencast(self, prefix: str = ...) -> None: ...
screencasts_frames_dir: str screencasts_frames_dir: str
@@ -160,13 +191,29 @@ class HttpCase(TransactionCase):
session_id: Any session_id: Any
opener: requests.Session opener: requests.Session
def setUp(self) -> None: ... def setUp(self) -> None: ...
def url_open(self, url: str, data: Any | None = ..., files: Mapping | None = ..., timeout: int = ..., def url_open(
headers: Mapping | None = ...) -> requests.Response: ... self,
url: str,
data: Any | None = ...,
files: Mapping | None = ...,
timeout: int = ...,
headers: Mapping | None = ...,
) -> requests.Response: ...
def _wait_remaining_requests(self, timeout: int = ...) -> None: ... def _wait_remaining_requests(self, timeout: int = ...) -> None: ...
def logout(self, keep_db: bool = ...) -> None: ... def logout(self, keep_db: bool = ...) -> None: ...
def authenticate(self, user, password) -> None: ... def authenticate(self, user, password) -> None: ...
def browser_js(self, url_path: str, code: str, ready: str = ..., login: str | None = ..., timeout: int = ..., **kw) -> None: ... def browser_js(
def start_tour(self, url_path: str, tour_name: str, step_delay: float | None = ..., **kwargs) -> None: ... self,
url_path: str,
code: str,
ready: str = ...,
login: str | None = ...,
timeout: int = ...,
**kw
) -> None: ...
def start_tour(
self, url_path: str, tour_name: str, step_delay: float | None = ..., **kwargs
) -> None: ...
phantom_js = browser_js phantom_js = browser_js
def users(*logins: str) -> Callable[[_CallableT], _CallableT]: ... def users(*logins: str) -> Callable[[_CallableT], _CallableT]: ...
@@ -182,14 +229,24 @@ class Form(Generic[_ModelT]):
_values: dict _values: dict
_changed: set _changed: set
def __init__(self, recordp: _ModelT, view: _ModelT | str | None = ...) -> None: ... def __init__(self, recordp: _ModelT, view: _ModelT | str | None = ...) -> None: ...
def _o2m_set_edition_view(self, descr: dict, node: _Element, level: int) -> None: ... def _o2m_set_edition_view(
self, descr: dict, node: _Element, level: int
) -> None: ...
def __str__(self) -> str: ... def __str__(self) -> str: ...
def _process_fvg(self, model: BaseModel, fvg: dict, level: int = ...) -> None: ... def _process_fvg(self, model: BaseModel, fvg: dict, level: int = ...) -> None: ...
def _init_from_defaults(self, model: BaseModel) -> None: ... def _init_from_defaults(self, model: BaseModel) -> None: ...
def _init_from_values(self, values: BaseModel) -> None: ... def _init_from_values(self, values: BaseModel) -> None: ...
def __getattr__(self, field: str): ... def __getattr__(self, field: str): ...
def _get_modifier(self, field: str, modifier: str, *, default: Any = ..., view: Any = ..., modmap: Any | None = ..., def _get_modifier(
vals: Any | None = ...): ... self,
field: str,
modifier: str,
*,
default: Any = ...,
view: Any = ...,
modmap: Any | None = ...,
vals: Any | None = ...
): ...
_OPS: dict[str, Callable[..., bool]] _OPS: dict[str, Callable[..., bool]]
def _get_context(self, field: str): ... def _get_context(self, field: str): ...
def __setattr__(self, field: str, value) -> None: ... def __setattr__(self, field: str, value) -> None: ...
@@ -197,8 +254,16 @@ class Form(Generic[_ModelT]):
def __exit__(self, etype, _evalue, _etb) -> None: ... def __exit__(self, etype, _evalue, _etb) -> None: ...
def save(self) -> _ModelT: ... def save(self) -> _ModelT: ...
def _values_to_save(self, all_fields: bool = ...) -> dict: ... def _values_to_save(self, all_fields: bool = ...) -> dict: ...
def _values_to_save_(self, record_values: dict, fields: dict, view: Any, changed: set, all_fields: bool = ..., def _values_to_save_(
modifiers_values: dict | None = ..., parent_link: Any | None = ...) -> dict: ... self,
record_values: dict,
fields: dict,
view: Any,
changed: set,
all_fields: bool = ...,
modifiers_values: dict | None = ...,
parent_link: Any | None = ...,
) -> dict: ...
def _perform_onchange(self, fields: list[str]) -> None: ... def _perform_onchange(self, fields: list[str]) -> None: ...
def _onchange_values(self) -> dict: ... def _onchange_values(self) -> dict: ...
def _onchange_values_(self, fields, record: dict) -> dict: ... def _onchange_values_(self, fields, record: dict) -> dict: ...
@@ -208,8 +273,16 @@ class O2MForm(Form):
_proxy: O2MProxy _proxy: O2MProxy
_index: int | None _index: int | None
def __init__(self, proxy: O2MProxy, index: int | None = ...) -> None: ... def __init__(self, proxy: O2MProxy, index: int | None = ...) -> None: ...
def _get_modifier(self, field: str, modifier: str, *, default: Any = ..., view: Any = ..., modmap: Any | None = ..., def _get_modifier(
vals: Any | None = ...): ... self,
field: str,
modifier: str,
*,
default: Any = ...,
view: Any = ...,
modmap: Any | None = ...,
vals: Any | None = ...
): ...
def _onchange_values(self) -> dict: ... def _onchange_values(self) -> dict: ...
def save(self) -> None: ... def save(self) -> None: ...
def _values_to_save(self, all_fields: bool = ...) -> UpdateDict: ... def _values_to_save(self, all_fields: bool = ...) -> UpdateDict: ...

View File

@@ -1,15 +1,18 @@
from .misc import * from . import appdirs as appdirs
from .translate import * from . import cloc as cloc
from .image import * from . import pdf as pdf
from .sql import * from . import pycompat as pycompat
from .float_utils import *
from .mail import *
from .func import *
from .debugger import *
from .xml_utils import *
from .date_utils import *
from .convert import *
from .template_inheritance import *
from . import appdirs as appdirs, cloc as cloc, pdf as pdf, pycompat as pycompat
from .config import config as config from .config import config as config
from .convert import *
from .date_utils import *
from .debugger import *
from .float_utils import *
from .func import *
from .graph import graph as graph from .graph import graph as graph
from .image import *
from .mail import *
from .misc import *
from .sql import *
from .template_inheritance import *
from .translate import *
from .xml_utils import *

View File

@@ -3,12 +3,42 @@ from typing import Callable
__version_info__: tuple __version_info__: tuple
__version__: str __version__: str
def user_data_dir(appname: str | None = ..., appauthor: str | None = ..., version: str | None = ..., roaming: bool = ...) -> str: ... def user_data_dir(
def site_data_dir(appname: str | None = ..., appauthor: str | None = ..., version: str | None = ..., multipath: bool = ...) -> str: ... appname: str | None = ...,
def user_config_dir(appname: str | None = ..., appauthor: str | None = ..., version: str | None = ..., roaming: bool = ...) -> str: ... appauthor: str | None = ...,
def site_config_dir(appname: str | None = ..., appauthor: str | None = ..., version: str | None = ..., multipath: bool = ...) -> str: ... version: str | None = ...,
def user_cache_dir(appname: str | None = ..., appauthor: str | None = ..., version: str | None = ..., opinion: bool = ...) -> str: ... roaming: bool = ...,
def user_log_dir(appname: str | None = ..., appauthor: str | None = ..., version: str | None = ..., opinion: bool = ...) -> str: ... ) -> str: ...
def site_data_dir(
appname: str | None = ...,
appauthor: str | None = ...,
version: str | None = ...,
multipath: bool = ...,
) -> str: ...
def user_config_dir(
appname: str | None = ...,
appauthor: str | None = ...,
version: str | None = ...,
roaming: bool = ...,
) -> str: ...
def site_config_dir(
appname: str | None = ...,
appauthor: str | None = ...,
version: str | None = ...,
multipath: bool = ...,
) -> str: ...
def user_cache_dir(
appname: str | None = ...,
appauthor: str | None = ...,
version: str | None = ...,
opinion: bool = ...,
) -> str: ...
def user_log_dir(
appname: str | None = ...,
appauthor: str | None = ...,
version: str | None = ...,
opinion: bool = ...,
) -> str: ...
class AppDirs: class AppDirs:
appname: str appname: str
@@ -16,7 +46,14 @@ class AppDirs:
version: str | None version: str | None
roaming: bool roaming: bool
multipath: bool multipath: bool
def __init__(self, appname: str, appauthor: str | None = ..., version: str | None = ..., roaming: bool = ..., multipath: bool = ...) -> None: ... def __init__(
self,
appname: str,
appauthor: str | None = ...,
version: str | None = ...,
roaming: bool = ...,
multipath: bool = ...,
) -> None: ...
@property @property
def user_data_dir(self) -> str: ... def user_data_dir(self) -> str: ...
@property @property
@@ -33,4 +70,5 @@ class AppDirs:
def _get_win_folder_from_registry(csidl_name: str) -> str: ... def _get_win_folder_from_registry(csidl_name: str) -> str: ...
def _get_win_folder_with_pywin32(csidl_name: str) -> str: ... def _get_win_folder_with_pywin32(csidl_name: str) -> str: ...
def _get_win_folder_with_ctypes(csidl_name: str) -> str: ... def _get_win_folder_with_ctypes(csidl_name: str) -> str: ...
_get_win_folder: Callable[[str], str] _get_win_folder: Callable[[str], str]

View File

@@ -1,11 +1,11 @@
from collections import defaultdict from collections import defaultdict
from typing import Any, Callable, TypeVar from typing import Any, Callable, TypeVar
from .lru import LRU
from ..models import BaseModel from ..models import BaseModel
from .lru import LRU
_T = TypeVar('_T') _T = TypeVar("_T")
_CallableT = TypeVar('_CallableT') _CallableT = TypeVar("_CallableT")
unsafe_eval = eval unsafe_eval = eval
@@ -27,7 +27,9 @@ class ormcache:
def __call__(self, method: _CallableT) -> _CallableT: ... def __call__(self, method: _CallableT) -> _CallableT: ...
key: Any key: Any
def determine_key(self): ... def determine_key(self): ...
def lru(self, model: BaseModel) -> tuple[LRU, tuple[str, Callable], ormcache_counter]: ... def lru(
self, model: BaseModel
) -> tuple[LRU, tuple[str, Callable], ormcache_counter]: ...
def lookup(self, method: Callable, *args, **kwargs): ... def lookup(self, method: Callable, *args, **kwargs): ...
def clear(self, model: BaseModel, *args) -> None: ... def clear(self, model: BaseModel, *args) -> None: ...
@@ -52,4 +54,5 @@ class dummy_cache:
def log_ormcache_stats(sig: Any | None = ..., frame: Any | None = ...): ... def log_ormcache_stats(sig: Any | None = ..., frame: Any | None = ...): ...
def get_cache_key_counter(bound_method, *args, **kwargs): ... def get_cache_key_counter(bound_method, *args, **kwargs): ...
cache = ormcache cache = ormcache

View File

@@ -19,7 +19,13 @@ class Cloc:
def parse_xml(self, s: str) -> tuple[int, int]: ... def parse_xml(self, s: str) -> tuple[int, int]: ...
def parse_py(self, s: str) -> tuple[int, int]: ... def parse_py(self, s: str) -> tuple[int, int]: ...
def parse_js(self, s: str) -> tuple[int, int]: ... def parse_js(self, s: str) -> tuple[int, int]: ...
def book(self, module: str, item: str = ..., count: tuple[Any, Any] = ..., exclude: bool = ...) -> None: ... def book(
self,
module: str,
item: str = ...,
count: tuple[Any, Any] = ...,
exclude: bool = ...,
) -> None: ...
def count_path(self, path: str, exclude: set[str] | None = ...) -> None: ... def count_path(self, path: str, exclude: set[str] | None = ...) -> None: ...
def count_modules(self, env: Environment) -> None: ... def count_modules(self, env: Environment) -> None: ...
def count_customization(self, env: Environment) -> None: ... def count_customization(self, env: Environment) -> None: ...

View File

@@ -27,10 +27,16 @@ class configmanager:
rcfile: str rcfile: str
def _parse_config(self, args: list | None = ...) -> None: ... def _parse_config(self, args: list | None = ...) -> None: ...
def _is_addons_path(self, path: str) -> bool: ... def _is_addons_path(self, path: str) -> bool: ...
def _check_addons_path(self, option: MyOption, opt, value, parser: OptionParser) -> None: ... def _check_addons_path(
def _check_upgrade_path(self, option: MyOption, opt, value, parser: OptionParser) -> None: ... self, option: MyOption, opt, value, parser: OptionParser
) -> None: ...
def _check_upgrade_path(
self, option: MyOption, opt, value, parser: OptionParser
) -> None: ...
def _is_upgrades_path(self, res: str) -> bool: ... def _is_upgrades_path(self, res: str) -> bool: ...
def _test_enable_callback(self, option: MyOption, opt, value, parser: OptionParser) -> None: ... def _test_enable_callback(
self, option: MyOption, opt, value, parser: OptionParser
) -> None: ...
def load(self) -> None: ... def load(self) -> None: ...
def save(self) -> None: ... def save(self) -> None: ...
def get(self, key, default: Any | None = ...): ... def get(self, key, default: Any | None = ...): ...

View File

@@ -3,10 +3,10 @@ from typing import Any, Callable, TextIO
from lxml.etree import _Element from lxml.etree import _Element
from .assertion_report import assertion_report as AssertionReport
from .misc import ustr as ustr
from ..api import Environment from ..api import Environment
from ..sql_db import Cursor from ..sql_db import Cursor
from .assertion_report import assertion_report as AssertionReport
from .misc import ustr as ustr
safe_eval: Callable safe_eval: Callable
@@ -30,7 +30,9 @@ def str2bool(value) -> bool: ...
def nodeattr2bool(node: _Element, attr, default: bool = ...) -> bool: ... def nodeattr2bool(node: _Element, attr, default: bool = ...) -> bool: ...
class xml_import: class xml_import:
def get_env(self, node: _Element, eval_context: dict | None = ...) -> Environment: ... def get_env(
self, node: _Element, eval_context: dict | None = ...
) -> Environment: ...
def make_xml_id(self, xml_id: str) -> str: ... def make_xml_id(self, xml_id: str) -> str: ...
def _test_xml_id(self, xml_id: str) -> None: ... def _test_xml_id(self, xml_id: str) -> None: ...
def _tag_delete(self, rec: _Element) -> None: ... def _tag_delete(self, rec: _Element) -> None: ...
@@ -41,7 +43,9 @@ class xml_import:
def _tag_record(self, rec: _Element) -> tuple[str, int] | None: ... def _tag_record(self, rec: _Element) -> tuple[str, int] | None: ...
def _tag_template(self, el: _Element) -> tuple[str, int] | None: ... def _tag_template(self, el: _Element) -> tuple[str, int] | None: ...
def id_get(self, id_str: str, raise_if_not_found: bool = ...) -> int | None: ... def id_get(self, id_str: str, raise_if_not_found: bool = ...) -> int | None: ...
def model_id_get(self, id_str: str, raise_if_not_found: bool = ...) -> tuple[Any, Any]: ... def model_id_get(
self, id_str: str, raise_if_not_found: bool = ...
) -> tuple[Any, Any]: ...
def _tag_root(self, el: _Element) -> None: ... def _tag_root(self, el: _Element) -> None: ...
@property @property
def env(self) -> Environment: ... def env(self) -> Environment: ...
@@ -55,11 +59,46 @@ class xml_import:
_noupdate: list[bool] _noupdate: list[bool]
xml_filename: str xml_filename: str
_tags: dict[str, Callable] _tags: dict[str, Callable]
def __init__(self, cr: Cursor, module: str, idref: dict, mode: str, report: AssertionReport | None = ..., noupdate: bool = ..., xml_filename: str | None = ...) -> None: ... def __init__(
self,
cr: Cursor,
module: str,
idref: dict,
mode: str,
report: AssertionReport | None = ...,
noupdate: bool = ...,
xml_filename: str | None = ...,
) -> None: ...
def parse(self, de: _Element) -> None: ... def parse(self, de: _Element) -> None: ...
DATA_ROOTS: list[str] DATA_ROOTS: list[str]
def convert_file(cr: Cursor, module: str, filename: str, idref: dict, mode: str = ..., noupdate: bool = ..., kind: str | None = ..., report: Any | None = ..., pathname: str | None = ...) -> None: ... def convert_file(
cr: Cursor,
module: str,
filename: str,
idref: dict,
mode: str = ...,
noupdate: bool = ...,
kind: str | None = ...,
report: Any | None = ...,
pathname: str | None = ...,
) -> None: ...
def convert_sql_import(cr: Cursor, fp: TextIO) -> None: ... def convert_sql_import(cr: Cursor, fp: TextIO) -> None: ...
def convert_csv_import(cr: Cursor, module: str, fname: str, csvcontent: bytes, idref: dict | None = ..., mode: str = ..., noupdate: bool = ...) -> None: ... def convert_csv_import(
def convert_xml_import(cr: Cursor, module: str, xmlfile: str | BufferedReader, idref: dict | None = ..., mode: str = ..., noupdate: bool = ..., report: Any | None = ...) -> None: ... cr: Cursor,
module: str,
fname: str,
csvcontent: bytes,
idref: dict | None = ...,
mode: str = ...,
noupdate: bool = ...,
) -> None: ...
def convert_xml_import(
cr: Cursor,
module: str,
xmlfile: str | BufferedReader,
idref: dict | None = ...,
mode: str = ...,
noupdate: bool = ...,
report: Any | None = ...,
) -> None: ...

View File

@@ -1,18 +1,22 @@
import datetime import datetime
from typing import Tuple, Iterator, TypeVar from typing import Iterator, Tuple, TypeVar
from dateutil.relativedelta import relativedelta from dateutil.relativedelta import relativedelta
_DateTimeT = TypeVar('_DateTimeT', datetime.date, datetime.datetime) _DateTimeT = TypeVar("_DateTimeT", datetime.date, datetime.datetime)
def get_month(date: _DateTimeT) -> Tuple[_DateTimeT, _DateTimeT]: ... def get_month(date: _DateTimeT) -> Tuple[_DateTimeT, _DateTimeT]: ...
def get_quarter_number(date: _DateTimeT) -> int: ... def get_quarter_number(date: _DateTimeT) -> int: ...
def get_quarter(date: _DateTimeT) -> Tuple[_DateTimeT, _DateTimeT]: ... def get_quarter(date: _DateTimeT) -> Tuple[_DateTimeT, _DateTimeT]: ...
def get_fiscal_year(date: _DateTimeT, day: int = ..., month: int = ...) -> Tuple[_DateTimeT, _DateTimeT]: ... def get_fiscal_year(
date: _DateTimeT, day: int = ..., month: int = ...
) -> Tuple[_DateTimeT, _DateTimeT]: ...
def get_timedelta(qty: int, granularity: str) -> relativedelta: ... def get_timedelta(qty: int, granularity: str) -> relativedelta: ...
def start_of(value: _DateTimeT, granularity: str) -> _DateTimeT: ... def start_of(value: _DateTimeT, granularity: str) -> _DateTimeT: ...
def end_of(value: _DateTimeT, granularity: str) -> _DateTimeT: ... def end_of(value: _DateTimeT, granularity: str) -> _DateTimeT: ...
def add(value: _DateTimeT, *args, **kwargs) -> _DateTimeT: ... def add(value: _DateTimeT, *args, **kwargs) -> _DateTimeT: ...
def subtract(value: _DateTimeT, *args, **kwargs) -> _DateTimeT: ... def subtract(value: _DateTimeT, *args, **kwargs) -> _DateTimeT: ...
def json_default(obj) -> str: ... def json_default(obj) -> str: ...
def date_range(start: datetime.datetime, end: datetime.datetime, step: relativedelta = ...) -> Iterator[datetime.datetime]: ... def date_range(
start: datetime.datetime, end: datetime.datetime, step: relativedelta = ...
) -> Iterator[datetime.datetime]: ...

View File

@@ -1,9 +1,27 @@
def round(f: float) -> float: ... def round(f: float) -> float: ...
def _float_check_precision(precision_digits: int | None = ..., precision_rounding: float | None = ...) -> float: ... def _float_check_precision(
def float_round(value: float, precision_digits: int | None = ..., precision_rounding: float | None = ..., rounding_method: str = ...) -> float: ... precision_digits: int | None = ..., precision_rounding: float | None = ...
def float_is_zero(value: float, precision_digits: int | None = ..., precision_rounding: float | None = ...) -> bool: ... ) -> float: ...
def float_compare(value1: float, value2: float, precision_digits: int | None = ..., precision_rounding: float | None = ...) -> int: ... def float_round(
value: float,
precision_digits: int | None = ...,
precision_rounding: float | None = ...,
rounding_method: str = ...,
) -> float: ...
def float_is_zero(
value: float,
precision_digits: int | None = ...,
precision_rounding: float | None = ...,
) -> bool: ...
def float_compare(
value1: float,
value2: float,
precision_digits: int | None = ...,
precision_rounding: float | None = ...,
) -> int: ...
def float_repr(value: float, precision_digits: int) -> str: ... def float_repr(value: float, precision_digits: int) -> str: ...
_float_repr = float_repr _float_repr = float_repr
def float_split_str(value: float, precision_digits: int) -> tuple[str, str]: ... def float_split_str(value: float, precision_digits: int) -> tuple[str, str]: ...
def float_split(value: float, precision_digits: int) -> tuple[int, int]: ... def float_split(value: float, precision_digits: int) -> tuple[int, int]: ...

View File

@@ -1,7 +1,7 @@
from json import JSONEncoder as JSONEncoder from json import JSONEncoder as JSONEncoder
from typing import Callable, Generic, TypeVar from typing import Callable, Generic, TypeVar
_T = TypeVar('_T') _T = TypeVar("_T")
class lazy_property(Generic[_T]): class lazy_property(Generic[_T]):
fget: Callable[..., _T] fget: Callable[..., _T]
@@ -26,7 +26,7 @@ class _ClassProperty(property, Generic[_T]):
def classproperty(func: Callable[..., _T]) -> _ClassProperty[_T]: ... def classproperty(func: Callable[..., _T]) -> _ClassProperty[_T]: ...
class lazy: class lazy:
__slots__ = ['_func', '_args', '_kwargs', '_cached_value'] __slots__ = ["_func", "_args", "_kwargs", "_cached_value"]
def __init__(self, func, *args, **kwargs) -> None: ... def __init__(self, func, *args, **kwargs) -> None: ...
@property @property
def _value(self): ... def _value(self): ...

View File

@@ -6,7 +6,9 @@ class graph:
no_ancester: Any = ... no_ancester: Any = ...
transitions: Any = ... transitions: Any = ...
result: Any = ... result: Any = ...
def __init__(self, nodes: Any, transitions: Any, no_ancester: Optional[Any] = ...) -> None: ... def __init__(
self, nodes: Any, transitions: Any, no_ancester: Optional[Any] = ...
) -> None: ...
edge_wt: Any = ... edge_wt: Any = ...
def init_rank(self) -> None: ... def init_rank(self) -> None: ...
reachable_nodes: Any = ... reachable_nodes: Any = ...
@@ -50,5 +52,12 @@ class graph:
start: Any = ... start: Any = ...
def process(self, starting_node: Any) -> None: ... def process(self, starting_node: Any) -> None: ...
def __str__(self): ... def __str__(self): ...
def scale(self, maxx: Any, maxy: Any, nwidth: int = ..., nheight: int = ..., margin: int = ...) -> None: ... def scale(
self,
maxx: Any,
maxy: Any,
nwidth: int = ...,
nheight: int = ...,
margin: int = ...,
) -> None: ...
def result_get(self): ... def result_get(self): ...

View File

@@ -1,6 +1,7 @@
from PIL import IcoImagePlugin as IcoImagePlugin, ImageOps as ImageOps
from typing import Any, Iterable, Literal from typing import Any, Iterable, Literal
from PIL import IcoImagePlugin as IcoImagePlugin
from PIL import ImageOps as ImageOps
from PIL.Image import Image from PIL.Image import Image
FILETYPE_BASE64_MAGICWORD: dict[bytes, str] FILETYPE_BASE64_MAGICWORD: dict[bytes, str]
@@ -14,13 +15,31 @@ class ImageProcess:
image: Image | Literal[False] image: Image | Literal[False]
original_format: str original_format: str
def __init__(self, base64_source: bytes, verify_resolution: bool = ...) -> None: ... def __init__(self, base64_source: bytes, verify_resolution: bool = ...) -> None: ...
def image_base64(self, quality: int = ..., output_format: str = ...) -> bytes | Literal[False]: ... def image_base64(
self, quality: int = ..., output_format: str = ...
) -> bytes | Literal[False]: ...
def resize(self, max_width: int = ..., max_height: int = ...) -> ImageProcess: ... def resize(self, max_width: int = ..., max_height: int = ...) -> ImageProcess: ...
def crop_resize(self, max_width: int, max_height: int, center_x: float = ..., center_y: float = ...) -> ImageProcess: ... def crop_resize(
self,
max_width: int,
max_height: int,
center_x: float = ...,
center_y: float = ...,
) -> ImageProcess: ...
def colorize(self) -> ImageProcess: ... def colorize(self) -> ImageProcess: ...
def image_process(base64_source: bytes, size: tuple[int, int] = ..., verify_resolution: bool = ..., quality: int = ..., crop: str | None = ..., colorize: bool = ..., output_format: str = ...) -> bytes: ... def image_process(
def average_dominant_color(colors: list[tuple[Any, Any]], mitigate: int = ..., max_margin: int = ...) -> tuple[Any, Any]: ... base64_source: bytes,
size: tuple[int, int] = ...,
verify_resolution: bool = ...,
quality: int = ...,
crop: str | None = ...,
colorize: bool = ...,
output_format: str = ...,
) -> bytes: ...
def average_dominant_color(
colors: list[tuple[Any, Any]], mitigate: int = ..., max_margin: int = ...
) -> tuple[Any, Any]: ...
def image_fix_orientation(image: Image) -> Image: ... def image_fix_orientation(image: Image) -> Image: ...
def base64_to_image(base64_source: bytes) -> Image: ... def base64_to_image(base64_source: bytes) -> Image: ...
def image_to_base64(image: Image, format: str | None, **params) -> bytes: ... def image_to_base64(image: Image, format: str | None, **params) -> bytes: ...

View File

@@ -1,10 +1,10 @@
from threading import RLock from threading import RLock
from typing import Any, Iterator, Generator from typing import Any, Generator, Iterator
__all__ = ['LRU'] __all__ = ["LRU"]
class LRUNode: class LRUNode:
__slots__ = ['prev', 'next', 'me'] __slots__ = ["prev", "next", "me"]
prev: Any prev: Any
me: Any me: Any
next: Any next: Any

View File

@@ -21,12 +21,28 @@ class _Cleaner(clean.Cleaner):
def strip_class(self, el: _Element) -> None: ... def strip_class(self, el: _Element) -> None: ...
def parse_style(self, el: _Element) -> None: ... def parse_style(self, el: _Element) -> None: ...
def html_sanitize(src: str, silent: bool = ..., sanitize_tags: bool = ..., sanitize_attributes: bool = ..., sanitize_style: bool = ..., def html_sanitize(
strip_style: bool = ..., strip_classes: bool = ..., sanitize_form: bool = ...) -> Markup: ... src: str,
silent: bool = ...,
sanitize_tags: bool = ...,
sanitize_attributes: bool = ...,
sanitize_style: bool = ...,
strip_style: bool = ...,
strip_classes: bool = ...,
sanitize_form: bool = ...,
) -> Markup: ...
def html_keep_url(text: str) -> str: ... def html_keep_url(text: str) -> str: ...
def html2plaintext(html: str, body_id: str | None = ..., encoding: str = ...) -> str: ... def html2plaintext(
html: str, body_id: str | None = ..., encoding: str = ...
) -> str: ...
def plaintext2html(text: str, container_tag: str = ...) -> Markup: ... def plaintext2html(text: str, container_tag: str = ...) -> Markup: ...
def append_content_to_html(html: str, content: str, plaintext: bool = ..., preserve: bool = ..., container_tag: str = ...) -> Markup: ... def append_content_to_html(
html: str,
content: str,
plaintext: bool = ...,
preserve: bool = ...,
container_tag: str = ...,
) -> Markup: ...
email_re: Pattern email_re: Pattern
single_email_re: Pattern single_email_re: Pattern
@@ -34,12 +50,29 @@ mail_header_msgid_re: Pattern
email_addr_escapes_re: Pattern email_addr_escapes_re: Pattern
def generate_tracking_message_id(res_id: str) -> str: ... def generate_tracking_message_id(res_id: str) -> str: ...
def email_send(email_from: str, email_to: str, subject: str, body: str, email_cc: str | None = ..., email_bcc: str | None = ..., def email_send(
reply_to: bool = ..., attachments: Any | None = ..., message_id: Any | None = ..., email_from: str,
references: Any | None = ..., openobject_id: bool = ..., debug: bool = ..., subtype: str = ..., email_to: str,
headers: Any | None = ..., smtp_server: Any | None = ..., smtp_port: Any | None = ..., subject: str,
ssl: bool = ..., smtp_user: Any | None = ..., smtp_password: Any | None = ..., body: str,
cr: Any | None = ..., uid: Any | None = ...): ... email_cc: str | None = ...,
email_bcc: str | None = ...,
reply_to: bool = ...,
attachments: Any | None = ...,
message_id: Any | None = ...,
references: Any | None = ...,
openobject_id: bool = ...,
debug: bool = ...,
subtype: str = ...,
headers: Any | None = ...,
smtp_server: Any | None = ...,
smtp_port: Any | None = ...,
ssl: bool = ...,
smtp_user: Any | None = ...,
smtp_password: Any | None = ...,
cr: Any | None = ...,
uid: Any | None = ...,
): ...
def email_split_tuples(text: str) -> list[str]: ... def email_split_tuples(text: str) -> list[str]: ...
def email_split(text: str) -> list[str]: ... def email_split(text: str) -> list[str]: ...
def email_split_and_format(text: str) -> list[str]: ... def email_split_and_format(text: str) -> list[str]: ...
@@ -47,6 +80,8 @@ def email_normalize(text: str) -> str | Literal[False]: ...
def email_escape_char(email_address: str) -> str: ... def email_escape_char(email_address: str) -> str: ...
def email_domain_extract(email: str) -> str | Literal[False]: ... def email_domain_extract(email: str) -> str | Literal[False]: ...
def decode_smtp_header(smtp_header, quoted: bool = ...) -> str: ... def decode_smtp_header(smtp_header, quoted: bool = ...) -> str: ...
def decode_message_header(message: Message, header: str, separator: str = ..., quoted: bool = ...) -> str: ... def decode_message_header(
message: Message, header: str, separator: str = ..., quoted: bool = ...
) -> str: ...
def formataddr(pair: tuple[str, str], charset: str = ...) -> str: ... def formataddr(pair: tuple[str, str], charset: str = ...) -> str: ...
def encapsulate_email(old_email: str, new_email: str) -> str: ... def encapsulate_email(old_email: str, new_email: str) -> str: ...

View File

@@ -2,7 +2,7 @@ import collections
from re import Pattern from re import Pattern
from typing import Any, Literal from typing import Any, Literal
__all__ = ['guess_mimetype'] __all__ = ["guess_mimetype"]
_ooxml_dirs: dict[str, str] _ooxml_dirs: dict[str, str]
def _check_ooxml(data: bytes) -> str | Literal[False]: ... def _check_ooxml(data: bytes) -> str | Literal[False]: ...
@@ -17,7 +17,7 @@ _ppt_pattern: Pattern
def _check_olecf(data: bytes) -> str | Literal[False]: ... def _check_olecf(data: bytes) -> str | Literal[False]: ...
def _check_svg(data: bytes) -> str | None: ... def _check_svg(data: bytes) -> str | None: ...
_Entry = collections.namedtuple('_Entry', ['mimetype', 'signatures', 'discriminants']) _Entry = collections.namedtuple("_Entry", ["mimetype", "signatures", "discriminants"])
_mime_mappings: tuple[_Entry, ...] _mime_mappings: tuple[_Entry, ...]
def guess_mimetype(bin_data: str, default: str | None = ...) -> str: ... def guess_mimetype(bin_data: str, default: str | None = ...) -> str: ...

View File

@@ -3,40 +3,73 @@ import pickle as pickle_
from collections.abc import Mapping, MutableMapping, MutableSet from collections.abc import Mapping, MutableMapping, MutableSet
from logging import Filter, LogRecord from logging import Filter, LogRecord
from types import ModuleType from types import ModuleType
from typing import Any, Generic, IO, AnyStr, ItemsView, Iterable, Iterator, NoReturn, TypeVar, Callable from typing import (
IO,
Any,
AnyStr,
Callable,
Generic,
ItemsView,
Iterable,
Iterator,
NoReturn,
TypeVar,
)
import xlsxwriter import xlsxwriter
import xlwt import xlwt
from babel.core import Locale from babel.core import Locale
from xlwt import Worksheet from xlwt import Worksheet
from ..api import Environment
from ..loglevels import exception_to_unicode as exception_to_unicode
from ..loglevels import get_encodings as get_encodings
from ..sql_db import Cursor
from .cache import * from .cache import *
from .parse_version import parse_version as parse_version 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') _T = TypeVar("_T")
_T1 = TypeVar('_T1') _T1 = TypeVar("_T1")
_KT = TypeVar('_KT') _KT = TypeVar("_KT")
_VT = TypeVar('_VT') _VT = TypeVar("_VT")
_CallableT = TypeVar('_CallableT', bound=Callable) _CallableT = TypeVar("_CallableT", bound=Callable)
SKIPPED_ELEMENT_TYPES: tuple SKIPPED_ELEMENT_TYPES: tuple
NON_BREAKING_SPACE: str NON_BREAKING_SPACE: str
def find_in_path(name: str) -> str: ... def find_in_path(name: str) -> str: ...
def _exec_pipe(prog, args, env: Mapping[str, str] | None = ...) -> tuple[IO[AnyStr] | None, IO[AnyStr] | None]: ... def _exec_pipe(
def exec_command_pipe(name: str, *args) -> tuple[IO[AnyStr] | None, IO[AnyStr] | None]: ... prog, args, env: Mapping[str, str] | None = ...
) -> tuple[IO[AnyStr] | None, IO[AnyStr] | None]: ...
def exec_command_pipe(
name: str, *args
) -> tuple[IO[AnyStr] | None, IO[AnyStr] | None]: ...
def find_pg_tool(name: str) -> str: ... def find_pg_tool(name: str) -> str: ...
def exec_pg_environ() -> dict[str, str]: ... def exec_pg_environ() -> dict[str, str]: ...
def exec_pg_command(name: str, *args) -> None: ... def exec_pg_command(name: str, *args) -> None: ...
def exec_pg_command_pipe(name: str, *args) -> tuple[IO[AnyStr] | None, IO[AnyStr] | None]: ... def exec_pg_command_pipe(
def file_open(name: str, mode: str = ..., subdir: str = ..., pathinfo: bool = ..., filter_ext: Any | None = ...): ... name: str, *args
def _fileopen(path: str, mode: str, basedir: str, pathinfo, basename: str | None = ..., filter_ext: Any | None = ...): ... ) -> tuple[IO[AnyStr] | None, IO[AnyStr] | None]: ...
def file_open(
name: str,
mode: str = ...,
subdir: str = ...,
pathinfo: bool = ...,
filter_ext: Any | None = ...,
): ...
def _fileopen(
path: str,
mode: str,
basedir: str,
pathinfo,
basename: str | None = ...,
filter_ext: Any | None = ...,
): ...
def flatten(list) -> list: ... def flatten(list) -> list: ...
def reverse_enumerate(l): ... def reverse_enumerate(l): ...
def partition(pred: Callable[[_T], bool], elems: Iterable[_T]) -> tuple[list[_T], list[_T]]: ... def partition(
pred: Callable[[_T], bool], elems: Iterable[_T]
) -> tuple[list[_T], list[_T]]: ...
def topological_sort(elems: dict[_T, Any]) -> list[_T]: ... def topological_sort(elems: dict[_T, Any]) -> list[_T]: ...
def merge_sequences(*iterables: Iterable[_T]) -> list[_T]: ... def merge_sequences(*iterables: Iterable[_T]) -> list[_T]: ...
@@ -69,9 +102,15 @@ DATETIME_FORMATS_MAP: dict[str, str]
POSIX_TO_LDML: dict[str, str] POSIX_TO_LDML: dict[str, str]
def posix_to_ldml(fmt: str, locale: Locale) -> 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 split_every(
def get_and_group_by_field(cr: Cursor, uid: int, obj, ids, field: str, context: dict | None = ...) -> dict: ... n: int, iterable: Iterable[_T], piece_maker: Callable[[Iterable[_T]], _T1] = ...
def get_and_group_by_company(cr: Cursor, uid: int, obj, ids, context: dict | None = ...) -> dict: ... ) -> 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): ... def resolve_attr(obj, attr: str): ...
def attrgetter(*items): ... def attrgetter(*items): ...
def remove_accents(input_str: str) -> str: ... def remove_accents(input_str: str) -> str: ...
@@ -88,7 +127,12 @@ class mute_logger(Filter):
def __init__(self, *loggers: str) -> None: ... def __init__(self, *loggers: str) -> None: ...
def filter(self, record: LogRecord) -> int: ... def filter(self, record: LogRecord) -> int: ...
def __enter__(self) -> None: ... def __enter__(self) -> None: ...
def __exit__(self, exc_type: Any | None = ..., exc_val: Any | None = ..., exc_tb: Any | None = ...) -> None: ... def __exit__(
self,
exc_type: Any | None = ...,
exc_val: Any | None = ...,
exc_tb: Any | None = ...,
) -> None: ...
def __call__(self, func: _CallableT) -> _CallableT: ... def __call__(self, func: _CallableT) -> _CallableT: ...
_ph: Any _ph: Any
@@ -105,14 +149,16 @@ class CountingStream(Generic[_T]):
def stripped_sys_argv(*strip_args: str) -> list[str]: ... def stripped_sys_argv(*strip_args: str) -> list[str]: ...
class ConstantMapping(Mapping[_KT, _VT]): class ConstantMapping(Mapping[_KT, _VT]):
__slots__ = ['_value'] __slots__ = ["_value"]
_value: _VT _value: _VT
def __init__(self, val: _VT) -> None: ... def __init__(self, val: _VT) -> None: ...
def __len__(self) -> int: ... def __len__(self) -> int: ...
def __iter__(self) -> Iterator: ... def __iter__(self) -> Iterator: ...
def __getitem__(self, item) -> _VT: ... def __getitem__(self, item) -> _VT: ...
def dumpstacks(sig: Any | None = ..., frame: Any | None = ..., thread_idents: Any | None = ...) -> None: ... def dumpstacks(
sig: Any | None = ..., frame: Any | None = ..., thread_idents: Any | None = ...
) -> None: ...
def freehash(arg) -> int: ... def freehash(arg) -> int: ...
def clean_context(context: dict[str, Any]) -> dict[str, Any]: ... def clean_context(context: dict[str, Any]) -> dict[str, Any]: ...
@@ -127,7 +173,7 @@ class frozendict(dict):
def __hash__(self) -> int: ... def __hash__(self) -> int: ...
class Collector(Mapping[_KT, _VT]): class Collector(Mapping[_KT, _VT]):
__slots__ = ['map'] __slots__ = ["map"]
_map: dict _map: dict
def __init__(self) -> None: ... def __init__(self) -> None: ...
def add(self, key: _KT, val: _T) -> None: ... def add(self, key: _KT, val: _T) -> None: ...
@@ -136,7 +182,7 @@ class Collector(Mapping[_KT, _VT]):
def __len__(self) -> int: ... def __len__(self) -> int: ...
class StackMap(MutableMapping): class StackMap(MutableMapping):
__slots__ = ['_maps'] __slots__ = ["_maps"]
_maps: list[MutableMapping] _maps: list[MutableMapping]
def __init__(self, m: MutableMapping | None = ...) -> None: ... def __init__(self, m: MutableMapping | None = ...) -> None: ...
def __getitem__(self, key): ... def __getitem__(self, key): ...
@@ -149,7 +195,7 @@ class StackMap(MutableMapping):
def popmap(self) -> MutableMapping: ... def popmap(self) -> MutableMapping: ...
class OrderedSet(MutableSet): class OrderedSet(MutableSet):
__slots__ = ['_map'] __slots__ = ["_map"]
_map: dict _map: dict
def __init__(self, elems: Iterable = ...) -> None: ... def __init__(self, elems: Iterable = ...) -> None: ...
def __contains__(self, elem) -> bool: ... def __contains__(self, elem) -> bool: ...
@@ -162,17 +208,19 @@ class LastOrderedSet(OrderedSet):
def add(self, elem) -> None: ... def add(self, elem) -> None: ...
class IterableGenerator(Generic[_T]): class IterableGenerator(Generic[_T]):
__slots__ = ['func', 'args'] __slots__ = ["func", "args"]
func: Callable func: Callable
args: tuple args: tuple
def __init__(self, func: Callable[..., _T], *args) -> None: ... def __init__(self, func: Callable[..., _T], *args) -> None: ...
def __iter__(self) -> _T: ... def __iter__(self) -> _T: ...
def groupby(iterable: Iterable[_T], key: Callable[..., _T1] | None = ...) -> ItemsView[_T1, _T]: ... def groupby(
iterable: Iterable[_T], key: Callable[..., _T1] | None = ...
) -> ItemsView[_T1, _T]: ...
def unique(it: Iterable[_T]) -> Iterator[_T]: ... def unique(it: Iterable[_T]) -> Iterator[_T]: ...
class Reverse: class Reverse:
__slots__ = ['val'] __slots__ = ["val"]
val: Any val: Any
def __init__(self, val) -> None: ... def __init__(self, val) -> None: ...
def __eq__(self, other) -> bool: ... def __eq__(self, other) -> bool: ...
@@ -184,19 +232,46 @@ class Reverse:
def ignore(*exc) -> None: ... def ignore(*exc) -> None: ...
def html_escape(text: str) -> str: ... def html_escape(text: str) -> str: ...
def get_lang(env: Environment, lang_code: str = ...) -> 'odoo.model.res_lang': ... def get_lang(env: Environment, lang_code: str = ...) -> "odoo.model.res_lang": ...
def babel_locale_parse(lang_code: str) -> Locale: ... def babel_locale_parse(lang_code: str) -> Locale: ...
def formatLang(env: Environment, value, digits: int | None = ..., grouping: bool = ..., monetary: bool = ..., def formatLang(
dp: bool = ..., currency_obj: 'odoo.model.res_currency' = ...) -> str: ... env: Environment,
def format_date(env: Environment, value: datetime.date | datetime.datetime | str, lang_code: str = ..., value,
date_format: str = ...) -> str: ... digits: int | None = ...,
grouping: bool = ...,
monetary: bool = ...,
dp: bool = ...,
currency_obj: "odoo.model.res_currency" = ...,
) -> str: ...
def format_date(
env: Environment,
value: datetime.date | datetime.datetime | str,
lang_code: str = ...,
date_format: str = ...,
) -> str: ...
def parse_date(env: Environment, value: str, lang_code: str = ...) -> datetime.date: ... def parse_date(env: Environment, value: str, lang_code: str = ...) -> datetime.date: ...
def format_datetime(env: Environment, value: str | datetime.datetime, tz: str = ..., def format_datetime(
dt_format: str = ..., lang_code: str = ...) -> str: ... env: Environment,
def format_time(env: Environment, value, tz: str = ..., time_format: str = ..., lang_code: str = ...) -> str: ... value: str | datetime.datetime,
def _format_time_ago(env: Environment, time_delta: datetime.timedelta | int, lang_code: str = ..., tz: str = ...,
add_direction: bool = ...) -> str: ... dt_format: str = ...,
def format_amount(env: Environment, amount: float, currency: 'odoo.model.res_currency', lang_code: str = ...) -> str: ... lang_code: str = ...,
) -> str: ...
def format_time(
env: Environment, value, tz: str = ..., time_format: str = ..., lang_code: str = ...
) -> str: ...
def _format_time_ago(
env: Environment,
time_delta: datetime.timedelta | int,
lang_code: str = ...,
add_direction: bool = ...,
) -> str: ...
def format_amount(
env: Environment,
amount: float,
currency: "odoo.model.res_currency",
lang_code: str = ...,
) -> str: ...
def format_duration(value: float) -> str: ... def format_duration(value: float) -> str: ...
def _consteq(str1: str, str2: str) -> bool: ... def _consteq(str1: str, str2: str) -> bool: ...
@@ -206,7 +281,9 @@ class Unpickler(pickle_.Unpickler):
find_global: Any find_global: Any
find_class: Any find_class: Any
def _pickle_load(stream: pickle_._ReadableFileobj, encoding: str = ..., errors: bool = ...): ... def _pickle_load(
stream: pickle_._ReadableFileobj, encoding: str = ..., errors: bool = ...
): ...
pickle: ModuleType pickle: ModuleType

View File

@@ -2,9 +2,16 @@ import ctypes
from typing import Any, BinaryIO, Callable, Generator, Iterable, Iterator from typing import Any, BinaryIO, Callable, Generator, Iterable, Iterator
def listdir(dir: str, recursive: bool = ...) -> Iterable[str]: ... def listdir(dir: str, recursive: bool = ...) -> Iterable[str]: ...
def walksymlinks(top: str, topdown: bool = ..., onerror: Callable[[OSError], Any] | None = ...) -> Iterator[tuple[str, list[str], list[str]]]: ... def walksymlinks(
top: str, topdown: bool = ..., onerror: Callable[[OSError], Any] | None = ...
) -> Iterator[tuple[str, list[str], list[str]]]: ...
def tempdir() -> Generator[str, None, None]: ... def tempdir() -> Generator[str, None, None]: ...
def zip_dir(path: str, stream: str | BinaryIO, include_dir: bool = ..., fnct_sort: Callable | None = ...) -> None: ... def zip_dir(
path: str,
stream: str | BinaryIO,
include_dir: bool = ...,
fnct_sort: Callable | None = ...,
) -> None: ...
getppid: Callable[[], int] getppid: Callable[[], int]
is_running_as_nt_service: Callable[[], bool] is_running_as_nt_service: Callable[[], bool]

View File

@@ -1,7 +1,8 @@
from typing import Any, Iterable from typing import Any, Iterable
from PyPDF2 import PdfFileReader, PdfFileWriter from PyPDF2 import PdfFileReader, PdfFileWriter
from PyPDF2.generic import ArrayObject as ArrayObject, IndirectObject from PyPDF2.generic import ArrayObject as ArrayObject
from PyPDF2.generic import IndirectObject
from PyPDF2.utils import b_ as b_ from PyPDF2.utils import b_ as b_
DEFAULT_PDF_DATETIME_FORMAT: str DEFAULT_PDF_DATETIME_FORMAT: str
@@ -12,9 +13,12 @@ class OdooPdfFileWriter(PdfFileWriter):
_reader: PdfFileReader | None _reader: PdfFileReader | None
_header: bytes _header: bytes
_ID: Any _ID: Any
def __init__(self, *args, **kwargs): None def __init__(self, *args, **kwargs):
None
def addAttachment(self, fname: str, fdata, subtype: str = ...) -> None: ... def addAttachment(self, fname: str, fdata, subtype: str = ...) -> None: ...
def cloneReaderDocumentRoot(self, reader: PdfFileReader) -> None: ... def cloneReaderDocumentRoot(self, reader: PdfFileReader) -> None: ...
def convert_to_pdfa(self) -> None: ... def convert_to_pdfa(self) -> None: ...
def add_file_metadata(self, metadata_content: bytes) -> None: ... def add_file_metadata(self, metadata_content: bytes) -> None: ...
def _create_attachment_object(self, attachment: dict[str, Any]) -> IndirectObject: ... def _create_attachment_object(
self, attachment: dict[str, Any]
) -> IndirectObject: ...

View File

@@ -7,7 +7,20 @@ class _LogTracer:
files: Any files: Any
deep: Any deep: Any
first_frame: Any first_frame: Any
def __init__(self, whitelist: Any | None = ..., blacklist: Any | None = ..., files: Any | None = ..., deep: bool = ...) -> None: ... def __init__(
self,
whitelist: Any | None = ...,
blacklist: Any | None = ...,
files: Any | None = ...,
deep: bool = ...,
) -> None: ...
def tracer(self, frame, event, arg): ... def tracer(self, frame, event, arg): ...
def profile(method: Any | None = ..., whitelist: Any | None = ..., blacklist=..., files: Any | None = ..., minimum_time: int = ..., minimum_queries: int = ...): ... def profile(
method: Any | None = ...,
whitelist: Any | None = ...,
blacklist=...,
files: Any | None = ...,
minimum_time: int = ...,
minimum_queries: int = ...,
): ...

View File

@@ -1,6 +1,6 @@
from codecs import StreamReader, StreamWriter from codecs import StreamReader, StreamWriter
from csv import Dialect from csv import Dialect
from typing import BinaryIO, Iterable, Iterator, Protocol, Any from typing import Any, BinaryIO, Iterable, Iterator, Protocol
class _StreamReader(Protocol): class _StreamReader(Protocol):
def __call__(self, stream: BinaryIO, errors: str = ...) -> StreamReader: ... def __call__(self, stream: BinaryIO, errors: str = ...) -> StreamReader: ...

View File

@@ -1,7 +1,8 @@
from opcode import HAVE_ARGUMENT as HAVE_ARGUMENT
from types import CodeType from types import CodeType
from typing import Any, Iterator, Literal from typing import Any, Iterator, Literal
from opcode import HAVE_ARGUMENT as HAVE_ARGUMENT
unsafe_eval = eval unsafe_eval = eval
_ALLOWED_MODULES: list[str] _ALLOWED_MODULES: list[str]
_UNSAFE_ATTRIBUTES: list[str] _UNSAFE_ATTRIBUTES: list[str]
@@ -12,14 +13,28 @@ _SAFE_OPCODES: set[int]
def _get_opcodes(codeobj) -> Iterator[int]: ... def _get_opcodes(codeobj) -> Iterator[int]: ...
def assert_no_dunder_name(code_obj: CodeType, expr: str) -> None: ... def assert_no_dunder_name(code_obj: CodeType, expr: str) -> None: ...
def assert_valid_codeobj(allowed_codes: set[int], code_obj: CodeType, expr: str) -> None: ... def assert_valid_codeobj(
allowed_codes: set[int], code_obj: CodeType, expr: str
) -> None: ...
def test_expr(expr: str, allowed_codes: set[int], mode: str = ...): ... def test_expr(expr: str, allowed_codes: set[int], mode: str = ...): ...
def const_eval(expr: str): ... def const_eval(expr: str): ...
def expr_eval(expr: str): ... def expr_eval(expr: str): ...
def _import(name: str, globals: dict | None = ..., locals: dict | None = ..., fromlist: list | None = ..., level: int = ...): ... def _import(
name: str,
globals: dict | None = ...,
locals: dict | None = ...,
fromlist: list | None = ...,
level: int = ...,
): ...
_BUILTINS: dict[str, Any] _BUILTINS: dict[str, Any]
def safe_eval(expr: str, globals_dict: dict | None = ..., locals_dict: dict | None = ..., mode: str = ..., def safe_eval(
nocopy: bool = ..., locals_builtins: bool = ...): ... expr: str,
globals_dict: dict | None = ...,
locals_dict: dict | None = ...,
mode: str = ...,
nocopy: bool = ...,
locals_builtins: bool = ...,
): ...
def test_python_expr(expr: str, mode: str = ...) -> str | Literal[False]: ... def test_python_expr(expr: str, mode: str = ...) -> str | Literal[False]: ...

View File

@@ -7,22 +7,56 @@ _CONFDELTYPES: dict[str, str]
def existing_tables(cr: Cursor, tablenames: Iterable[str]) -> list[str]: ... def existing_tables(cr: Cursor, tablenames: Iterable[str]) -> list[str]: ...
def table_exists(cr: Cursor, tablename: str) -> bool: ... def table_exists(cr: Cursor, tablename: str) -> bool: ...
def table_kind(cr: Cursor, tablename: str) -> str | None: ... def table_kind(cr: Cursor, tablename: str) -> str | None: ...
def create_model_table(cr: Cursor, tablename: str, comment: str | None = ...) -> None: ... def create_model_table(
cr: Cursor, tablename: str, comment: str | None = ...
) -> None: ...
def table_columns(cr: Cursor, tablename: str) -> dict: ... def table_columns(cr: Cursor, tablename: str) -> dict: ...
def column_exists(cr: Cursor, tablename: str, columnname: str) -> int: ... def column_exists(cr: Cursor, tablename: str, columnname: str) -> int: ...
def create_column(cr: Cursor, tablename: str, columnname: str, columntype: str, comment: str | None = ...) -> None: ... def create_column(
def rename_column(cr: Cursor, tablename: str, columnname1: str, columnname2: str) -> None: ... cr: Cursor,
def convert_column(cr: Cursor, tablename: str, columnname: str, columntype: str) -> None: ... tablename: str,
columnname: str,
columntype: str,
comment: str | None = ...,
) -> None: ...
def rename_column(
cr: Cursor, tablename: str, columnname1: str, columnname2: str
) -> None: ...
def convert_column(
cr: Cursor, tablename: str, columnname: str, columntype: str
) -> None: ...
def set_not_null(cr: Cursor, tablename: str, columnname: str) -> None: ... def set_not_null(cr: Cursor, tablename: str, columnname: str) -> None: ...
def drop_not_null(cr: Cursor, tablename: str, columnname: str) -> None: ... def drop_not_null(cr: Cursor, tablename: str, columnname: str) -> None: ...
def constraint_definition(cr: Cursor, tablename: str, constraintname: str) -> str | None: ... def constraint_definition(
def add_constraint(cr: Cursor, tablename: str, constraintname: str, definition: str) -> None: ... cr: Cursor, tablename: str, constraintname: str
) -> str | None: ...
def add_constraint(
cr: Cursor, tablename: str, constraintname: str, definition: str
) -> None: ...
def drop_constraint(cr: Cursor, tablename: str, constraintname: str) -> None: ... def drop_constraint(cr: Cursor, tablename: str, constraintname: str) -> None: ...
def add_foreign_key(cr: Cursor, tablename1: str, columnname1: str, tablename2: str, columnname2: str, ondelete) -> Literal[True]: ... def add_foreign_key(
def fix_foreign_key(cr: Cursor, tablename1: str, columnname1: str, tablename2: str, columnname2: str, ondelete) -> list[str]: ... cr: Cursor,
tablename1: str,
columnname1: str,
tablename2: str,
columnname2: str,
ondelete,
) -> Literal[True]: ...
def fix_foreign_key(
cr: Cursor,
tablename1: str,
columnname1: str,
tablename2: str,
columnname2: str,
ondelete,
) -> list[str]: ...
def index_exists(cr: Cursor, indexname: str) -> int: ... def index_exists(cr: Cursor, indexname: str) -> int: ...
def create_index(cr: Cursor, indexname: str, tablename: str, expressions: Iterable[str]) -> None: ... def create_index(
def create_unique_index(cr: Cursor, indexname: str, tablename: str, expressions: Iterable[str]) -> None: ... cr: Cursor, indexname: str, tablename: str, expressions: Iterable[str]
) -> None: ...
def create_unique_index(
cr: Cursor, indexname: str, tablename: str, expressions: Iterable[str]
) -> None: ...
def drop_index(cr: Cursor, indexname: str, tablename: str) -> None: ... def drop_index(cr: Cursor, indexname: str, tablename: str) -> None: ...
def drop_view_if_exists(cr: Cursor, viewname: str) -> None: ... def drop_view_if_exists(cr: Cursor, viewname: str) -> None: ...
def escape_psql(to_escape: str) -> str: ... def escape_psql(to_escape: str) -> str: ...

View File

@@ -6,5 +6,9 @@ def add_text_before(node: _Element, text: str | None) -> None: ...
def add_text_inside(node: _Element, text: str | None) -> None: ... def add_text_inside(node: _Element, text: str | None) -> None: ...
def remove_element(node: _Element) -> None: ... def remove_element(node: _Element) -> None: ...
def locate_node(arch: _Element, spec: _Element) -> _Element: ... def locate_node(arch: _Element, spec: _Element) -> _Element: ...
def apply_inheritance_specs(source: _Element, specs_tree: _Element, inherit_branding: bool = ..., def apply_inheritance_specs(
pre_locate: Callable[[_Element], Any] = ...) -> _Element: ... source: _Element,
specs_tree: _Element,
inherit_branding: bool = ...,
pre_locate: Callable[[_Element], Any] = ...,
) -> _Element: ...

View File

@@ -1,10 +1,26 @@
from typing import Any, Literal from typing import Any, Literal
from . import config as config
from ..sql_db import Cursor from ..sql_db import Cursor
from . import config as config
def try_report(cr: Cursor, uid: int, rname: str, ids, data: Any | None = ..., context: dict | None = ..., def try_report(
our_module: Any | None = ..., report_type: Any | None = ...) -> bool: ... cr: Cursor,
def try_report_action(cr: Cursor, uid: int, action_id: int, active_model: str | None = ..., active_ids: list[int] | None = ..., uid: int,
wiz_data: dict | None = ..., wiz_buttons: list[str] | None = ..., context: dict | None = ..., rname: str,
our_module: str | None = ...) -> Literal[True]: ... ids,
data: Any | None = ...,
context: dict | None = ...,
our_module: Any | None = ...,
report_type: Any | None = ...,
) -> bool: ...
def try_report_action(
cr: Cursor,
uid: int,
action_id: int,
active_model: str | None = ...,
active_ids: list[int] | None = ...,
wiz_data: dict | None = ...,
wiz_buttons: list[str] | None = ...,
context: dict | None = ...,
our_module: str | None = ...,
) -> Literal[True]: ...

View File

@@ -2,13 +2,13 @@ import csv
from re import Match, Pattern from re import Match, Pattern
from tarfile import TarFile from tarfile import TarFile
from types import FrameType from types import FrameType
from typing import Any, BinaryIO, Callable, Container, IO, Iterable, Iterator, NoReturn from typing import IO, Any, BinaryIO, Callable, Container, Iterable, Iterator, NoReturn
from lxml.etree import HTMLParser, _Element from lxml.etree import HTMLParser, _Element
from polib import POFile from polib import POFile
from .pycompat import _CsvWriter
from ..sql_db import Connection, Cursor from ..sql_db import Connection, Cursor
from .pycompat import _CsvWriter
WEB_TRANSLATION_COMMENT: str WEB_TRANSLATION_COMMENT: str
SKIPPED_ELEMENTS: tuple[str, ...] SKIPPED_ELEMENTS: tuple[str, ...]
@@ -25,8 +25,12 @@ TRANSLATED_ATTRS: set[str]
avoid_pattern: Pattern avoid_pattern: Pattern
node_pattern: Pattern node_pattern: Pattern
def translate_xml_node(node: _Element, callback: Callable[[str], str | None], parse: Callable[[str], _Element], def translate_xml_node(
serialize: Callable[[_Element], str]) -> _Element: ... node: _Element,
callback: Callable[[str], str | None],
parse: Callable[[str], _Element],
serialize: Callable[[_Element], str],
) -> _Element: ...
def parse_xml(text: str) -> _Element: ... def parse_xml(text: str) -> _Element: ...
def serialize_xml(node: _Element) -> str: ... def serialize_xml(node: _Element) -> str: ...
@@ -36,19 +40,23 @@ def parse_html(text: str) -> _Element: ...
def serialize_html(node: _Element) -> str: ... def serialize_html(node: _Element) -> str: ...
def xml_translate(callback: Callable[[str], str | None], value: str) -> str: ... def xml_translate(callback: Callable[[str], str | None], value: str) -> str: ...
def html_translate(callback: Callable[[str], str | None], value: str) -> str: ... def html_translate(callback: Callable[[str], str | None], value: str) -> str: ...
def translate(cr: Cursor, name: str, source_type: str, lang: str, source: str | None = ...) -> str: ... def translate(
cr: Cursor, name: str, source_type: str, lang: str, source: str | None = ...
) -> str: ...
def translate_sql_constraint(cr: Cursor, key: str, lang: str) -> str: ... def translate_sql_constraint(cr: Cursor, key: str, lang: str) -> str: ...
class GettextAlias: class GettextAlias:
def _get_db(self) -> Connection | None: ... def _get_db(self) -> Connection | None: ...
def _get_cr(self, frame: FrameType, allow_create: bool = ...) -> tuple[Cursor, bool]: ... def _get_cr(
self, frame: FrameType, allow_create: bool = ...
) -> tuple[Cursor, bool]: ...
def _get_uid(self, frame: FrameType) -> int: ... def _get_uid(self, frame: FrameType) -> int: ...
def _get_lang(self, frame: FrameType) -> str: ... def _get_lang(self, frame: FrameType) -> str: ...
def __call__(self, source: str) -> str: ... def __call__(self, source: str) -> str: ...
def _get_translation(self, source: str) -> str: ... def _get_translation(self, source: str) -> str: ...
class _lt: class _lt:
__slots__ = ['_source'] __slots__ = ["_source"]
_source: str _source: str
def __init__(self, source: str) -> None: ... def __init__(self, source: str) -> None: ...
def __str__(self) -> str: ... def __str__(self) -> str: ...
@@ -66,7 +74,9 @@ re_escaped_replacements: dict[str, str]
def _sub_replacement(match_obj: Match) -> str: ... def _sub_replacement(match_obj: Match) -> str: ...
def unquote(str: str) -> str: ... def unquote(str: str) -> str: ...
def TranslationFileReader(source: IO, fileformat: str = ...) -> CSVFileReader | PoFileReader: ... def TranslationFileReader(
source: IO, fileformat: str = ...
) -> CSVFileReader | PoFileReader: ...
class CSVFileReader: class CSVFileReader:
source: csv.DictReader source: csv.DictReader
@@ -79,7 +89,12 @@ class PoFileReader:
def __init__(self, source: str | IO): ... def __init__(self, source: str | IO): ...
def __iter__(self) -> Iterator[dict[str, Any]]: ... def __iter__(self) -> Iterator[dict[str, Any]]: ...
def TranslationFileWriter(target, fileformat: str = ..., lang: str | None = ..., modules: Iterable[str] | None = ...) -> CSVFileWriter | PoFileWriter | TarFileWriter: ... def TranslationFileWriter(
target,
fileformat: str = ...,
lang: str | None = ...,
modules: Iterable[str] | None = ...,
) -> CSVFileWriter | PoFileWriter | TarFileWriter: ...
class CSVFileWriter: class CSVFileWriter:
writer: _CsvWriter writer: _CsvWriter
@@ -92,7 +107,9 @@ class PoFileWriter:
po: POFile po: POFile
def __init__(self, target: IO, modules: Iterable[str], lang: str) -> None: ... def __init__(self, target: IO, modules: Iterable[str], lang: str) -> None: ...
def write_rows(self, rows: Iterable) -> None: ... def write_rows(self, rows: Iterable) -> None: ...
def add_entry(self, modules, tnrs, source, trad, comments: Iterable[str] | None = ...) -> None: ... def add_entry(
self, modules, tnrs, source, trad, comments: Iterable[str] | None = ...
) -> None: ...
class TarFileWriter: class TarFileWriter:
tar: TarFile tar: TarFile
@@ -100,15 +117,34 @@ class TarFileWriter:
def __init__(self, target: IO, lang: str) -> None: ... def __init__(self, target: IO, lang: str) -> None: ...
def write_rows(self, rows: Iterable) -> None: ... def write_rows(self, rows: Iterable) -> None: ...
def trans_export(lang: str, modules: list[str], buffer, format: str, cr: Cursor) -> None: ... def trans_export(
lang: str, modules: list[str], buffer, format: str, cr: Cursor
) -> None: ...
def trans_parse_rml(de: Iterable) -> list[bytes]: ... def trans_parse_rml(de: Iterable) -> list[bytes]: ...
def _push(callback: Callable[[str, int], Any], term: str, source_line: int) -> None: ... def _push(callback: Callable[[str, int], Any], term: str, source_line: int) -> None: ...
def in_modules(object_name: str, modules: Container[str]) -> bool: ... def in_modules(object_name: str, modules: Container[str]) -> bool: ...
def _extract_translatable_qweb_terms(element: _Element, callback: Callable[[str, int], Any]) -> None: ... def _extract_translatable_qweb_terms(
element: _Element, callback: Callable[[str, int], Any]
) -> None: ...
def babel_extract_qweb(fileobj: IO, keywords, comment_tags, options) -> list[tuple]: ... def babel_extract_qweb(fileobj: IO, keywords, comment_tags, options) -> list[tuple]: ...
def trans_generate(lang: str, modules, cr: Cursor) -> list: ... def trans_generate(lang: str, modules, cr: Cursor) -> list: ...
def trans_load(cr: Cursor, filename: str, lang: str, verbose: bool = ..., module_name: str | None = ..., context: dict | None = ...) -> None: ... def trans_load(
def trans_load_data(cr: Cursor, fileobj: IO, fileformat: str, lang_name: str | None = ..., verbose: bool = ..., module_name: str | None = ..., context: dict | None = ...) -> None: ... cr: Cursor,
filename: str,
lang: str,
verbose: bool = ...,
module_name: str | None = ...,
context: dict | None = ...,
) -> None: ...
def trans_load_data(
cr: Cursor,
fileobj: IO,
fileformat: str,
lang_name: str | None = ...,
verbose: bool = ...,
module_name: str | None = ...,
context: dict | None = ...,
) -> None: ...
def get_locales(lang: str | None = ...) -> None: ... def get_locales(lang: str | None = ...) -> None: ...
def resetlocale() -> str: ... def resetlocale() -> str: ...
def load_language(cr: Cursor, lang: str) -> None: ... def load_language(cr: Cursor, lang: str) -> None: ...

View File

@@ -8,7 +8,7 @@ from lxml.etree import RelaxNG, _Element
from ..api import Environment from ..api import Environment
from ..fields import Field from ..fields import Field
_CallableT = TypeVar('_CallableT', bound=Callable) _CallableT = TypeVar("_CallableT", bound=Callable)
_validators: defaultdict[str, list[Callable]] _validators: defaultdict[str, list[Callable]]
_relaxng_cache: dict[str, RelaxNG | None] _relaxng_cache: dict[str, RelaxNG | None]
@@ -18,7 +18,9 @@ READONLY: Pattern
def _get_attrs_symbols() -> set[str]: ... def _get_attrs_symbols() -> set[str]: ...
def _view_is_editable(node: _Element) -> bool: ... def _view_is_editable(node: _Element) -> bool: ...
def field_is_editable(field: Field, node: _Element) -> bool: ... def field_is_editable(field: Field, node: _Element) -> bool: ...
def get_attrs_field_names(env: Environment, arch: _Element, model, editable) -> list: ... def get_attrs_field_names(
env: Environment, arch: _Element, model, editable
) -> list: ...
def valid_view(arch: _Element, **kwargs) -> bool: ... def valid_view(arch: _Element, **kwargs) -> bool: ...
def validate(*view_types: str) -> Callable[[_CallableT], _CallableT]: ... def validate(*view_types: str) -> Callable[[_CallableT], _CallableT]: ...
def relaxng(view_type: str) -> RelaxNG: ... def relaxng(view_type: str) -> RelaxNG: ...

View File

@@ -1,4 +1,5 @@
from os import R_OK as R_OK, W_OK as W_OK from os import R_OK as R_OK
from os import W_OK as W_OK
from os.path import dirname as dirname from os.path import dirname as dirname
from typing import Iterator from typing import Iterator
@@ -8,5 +9,9 @@ windows: bool
seen: set seen: set
defpathext: list[str] defpathext: list[str]
def which_files(file: str, mode: int = ..., path: str | None = ..., pathext: str | None = ...) -> Iterator[str]: ... def which_files(
def which(file: str, mode: int = ..., path: str | None = ..., pathext: str | None = ...) -> str: ... file: str, mode: int = ..., path: str | None = ..., pathext: str | None = ...
) -> Iterator[str]: ...
def which(
file: str, mode: int = ..., path: str | None = ..., pathext: str | None = ...
) -> str: ...

View File

@@ -1,6 +1,7 @@
from typing import IO, Iterable
from lxml import etree from lxml import etree
from lxml.etree import _Element from lxml.etree import _Element
from typing import IO, Iterable
from ..api import Environment from ..api import Environment
@@ -9,8 +10,21 @@ class odoo_resolver(etree.Resolver):
def __init__(self, env: Environment) -> None: ... def __init__(self, env: Environment) -> None: ...
def resolve(self, url: str, id: str, context) -> str: ... def resolve(self, url: str, id: str, context) -> str: ...
def _check_with_xsd(tree_or_str: str | _Element, stream: str | IO, env: Environment | None = ...) -> None: ... def _check_with_xsd(
def create_xml_node_chain(first_parent_node: _Element, nodes_list: Iterable[str], last_node_value: str | None = ...) -> list[_Element]: ... tree_or_str: str | _Element, stream: str | IO, env: Environment | None = ...
def create_xml_node(parent_node: _Element, node_name: str, node_value: str | None = ...) -> _Element: ... ) -> None: ...
def cleanup_xml_node(xml_node_or_string: _Element | str, remove_blank_text: bool = ..., remove_blank_nodes: bool = ..., def create_xml_node_chain(
indent_level: int = ..., indent_space: str = ...) -> _Element: ... first_parent_node: _Element,
nodes_list: Iterable[str],
last_node_value: str | None = ...,
) -> list[_Element]: ...
def create_xml_node(
parent_node: _Element, node_name: str, node_value: str | None = ...
) -> _Element: ...
def cleanup_xml_node(
xml_node_or_string: _Element | str,
remove_blank_text: bool = ...,
remove_blank_nodes: bool = ...,
indent_level: int = ...,
indent_space: str = ...,
) -> _Element: ...