isort + black

This commit is contained in:
Trinh Anh Ngoc
2023-05-18 21:35:14 +07:00
parent abc6a1faa3
commit a546490a77
60 changed files with 1790 additions and 559 deletions

View File

@@ -1,23 +1,22 @@
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 .fields import Command as Command from .fields import Command as Command
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,16 +1,30 @@
from collections import defaultdict from collections import defaultdict
from typing import Any, Callable, Collection, Generator, Iterable, Iterator, KeysView, Literal, Mapping, Optional, Sequence, TypeVar, Union from typing import (
Any,
Callable,
Collection,
Generator,
Iterable,
Iterator,
KeysView,
Literal,
Mapping,
Optional,
Sequence,
TypeVar,
Union,
)
from weakref import WeakSet from weakref import WeakSet
from .fields import Field from .fields import Field
from .models import BaseModel from .models import BaseModel
from .modules.registry import Registry from .modules.registry import Registry
from .sql_db import Cursor from .sql_db import Cursor
from .tools import OrderedSet, frozendict, StackMap from .tools import OrderedSet, StackMap, frozendict
_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, ...]
@@ -25,23 +39,32 @@ class Meta(type):
def attrsetter(attr, value) -> Callable[[_T], _T]: ... def attrsetter(attr, value) -> Callable[[_T], _T]: ...
def propagate(method1: Callable, method2: _CallableT) -> _CallableT: ... def propagate(method1: Callable, method2: _CallableT) -> _CallableT: ...
def constrains(*args: str | Callable[[_ModelT], Sequence[str]]) -> Callable[[_T], _T]: ... def constrains(
*args: str | Callable[[_ModelT], Sequence[str]]
) -> Callable[[_T], _T]: ...
def ondelete(*, at_uninstall: bool) -> Callable[[_T], _T]: ... def ondelete(*, at_uninstall: bool) -> Callable[[_T], _T]: ...
def onchange(*args: str) -> Callable[[_T], _T]: ... def onchange(*args: str) -> Callable[[_T], _T]: ...
def depends(*args: str | Callable[[_ModelT], Sequence[str]]) -> Callable[[_T], _T]: ... def depends(*args: str | Callable[[_ModelT], Sequence[str]]) -> 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 autovacuum(method: _CallableT) -> _CallableT: ... def autovacuum(method: _CallableT) -> _CallableT: ...
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): ...
@@ -61,7 +84,9 @@ class Environment(Mapping[str, BaseModel]):
cache: Cache cache: Cache
_cache_key: dict[Field, Any] _cache_key: dict[Field, Any]
_protected: StackMap[Field, set[int]] _protected: StackMap[Field, set[int]]
def __new__(cls, cr: Cursor, uid: int | None, context: dict, su: bool = ...) -> Environment: ... def __new__(
cls, cr: Cursor, uid: int | None, 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]: ...
@@ -69,17 +94,25 @@ 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: ...
@@ -89,7 +122,9 @@ class Environment(Mapping[str, BaseModel]):
def flush_all(self) -> None: ... def flush_all(self) -> 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: ...
@@ -123,27 +158,54 @@ class Cache:
def contains(self, record: BaseModel, field: Field) -> bool: ... def contains(self, record: BaseModel, field: Field) -> bool: ...
def contains_field(self, field: Field) -> bool: ... def contains_field(self, field: Field) -> bool: ...
def get(self, record: BaseModel, field: Field, default=...): ... def get(self, record: BaseModel, field: Field, default=...): ...
def set(self, record: BaseModel, field: Field, value, dirty: bool = ..., check_dirty: bool = ...) -> None: ... def set(
def update(self, records: BaseModel, field: Field, values, dirty: bool = ..., check_dirty: bool = ...) -> None: ... self,
def update_raw(self, records: BaseModel, field: Field, values, dirty: bool = ..., check_dirty: bool = ...) -> None: ... record: BaseModel,
field: Field,
value,
dirty: bool = ...,
check_dirty: bool = ...,
) -> None: ...
def update(
self,
records: BaseModel,
field: Field,
values,
dirty: bool = ...,
check_dirty: bool = ...,
) -> None: ...
def update_raw(
self,
records: BaseModel,
field: Field,
values,
dirty: bool = ...,
check_dirty: bool = ...,
) -> None: ...
def insert_missing(self, records: BaseModel, field: Field, values) -> None: ... def insert_missing(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_until_miss(self, records: BaseModel, field: Field) -> list: ... def get_until_miss(self, records: BaseModel, field: Field) -> list: ...
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 get_dirty_fields(self) -> 'set[Field]': ... def get_dirty_fields(self) -> "set[Field]": ...
def get_dirty_records(self, model: _ModelT, field: Field) -> _ModelT: ... def get_dirty_records(self, model: _ModelT, field: Field) -> _ModelT: ...
def has_dirty_fields(self, records: BaseModel, fields: Iterable[Field] | None = ...) -> bool: ... def has_dirty_fields(
self, records: BaseModel, fields: Iterable[Field] | None = ...
) -> bool: ...
def clear_dirty_field(self, field: Field) -> Collection[int]: ... def clear_dirty_field(self, field: Field) -> Collection[int]: ...
def invalidate(self, spec: list[tuple[Field, Iterable | None]] | None = ...) -> None: ... def invalidate(
self, spec: list[tuple[Field, Iterable | None]] | None = ...
) -> None: ...
def clear(self) -> None: ... def clear(self) -> None: ...
def check(self, env: Environment) -> None: ... def check(self, env: Environment) -> None: ...
class Starred: class Starred:
__slots__ = ['value'] __slots__ = ["value"]
value: Any value: Any
def __init__(self, value) -> None: ... def __init__(self, value) -> None: ...
def __repr__(self) -> str: ... def __repr__(self) -> str: ...

View File

@@ -9,7 +9,13 @@ class UserError(Exception):
def name(self): ... def name(self): ...
class RedirectWarning(Exception): class RedirectWarning(Exception):
def __init__(self, message: str, action: int, button_text: str, additional_context: dict | None = ...) -> None: ... def __init__(
self,
message: str,
action: int,
button_text: str,
additional_context: dict | None = ...,
) -> None: ...
@property @property
def name(self): ... def name(self): ...

View File

@@ -1,6 +1,18 @@
import datetime import datetime
import enum import enum
from typing import Any, Callable, Container, Collection, Generic, Iterator, Sequence, Type, TypeVar, Union, overload from typing import (
Any,
Callable,
Collection,
Container,
Generic,
Iterator,
Sequence,
Type,
TypeVar,
Union,
overload,
)
import psycopg2 import psycopg2
from markupsafe import Markup from markupsafe import Markup
@@ -9,15 +21,15 @@ from .api import Environment, Registry
from .models import BaseModel from .models import BaseModel
from .tools import date_utils, float_utils from .tools import date_utils, float_utils
_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
@@ -116,7 +128,9 @@ class Field(Generic[_FieldValueT], metaclass=MetaField):
def _inverse_company_dependent(self, records: BaseModel) -> None: ... def _inverse_company_dependent(self, records: BaseModel) -> None: ...
def _search_company_dependent(self, records: BaseModel, operator: str, value): ... def _search_company_dependent(self, records: BaseModel, operator: str, value): ...
def resolve_depends(self, registry: Registry) -> Iterator[tuple]: ... def resolve_depends(self, registry: Registry) -> Iterator[tuple]: ...
def get_description(self, env: Environment, attributes: Container[str] | None = ...) -> dict[str, Any]: ... def get_description(
self, env: Environment, attributes: Container[str] | None = ...
) -> dict[str, Any]: ...
_description_name: str _description_name: str
_description_type: str _description_type: str
_description_store: bool | None _description_store: bool | None
@@ -140,7 +154,9 @@ class Field(Generic[_FieldValueT], metaclass=MetaField):
def _description_help(self, env: Environment) -> str | None: ... def _description_help(self, env: Environment) -> str | None: ...
def is_editable(self) -> bool: ... def is_editable(self) -> bool: ...
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_record_multi(self, values, records: BaseModel): ... def convert_to_record_multi(self, values, records: BaseModel): ...
@@ -173,16 +189,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]
group_operator: str group_operator: str
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: ...
@@ -192,14 +216,20 @@ class Float(Field[float]):
type: str type: str
_digits: tuple[int, int] | str | None _digits: tuple[int, int] | str | None
group_operator: str group_operator: str
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): ...
round = float_utils.float_round round = float_utils.float_round
@@ -212,13 +242,19 @@ class Monetary(Field[float]):
column_type: tuple[str, str] column_type: tuple[str, str]
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: ...
def _description_currency_field(self, env: Environment) -> str: ... def _description_currency_field(self, env: Environment) -> str: ...
def get_currency_field(self, model: BaseModel) -> str: ... def get_currency_field(self, model: BaseModel) -> str: ...
def setup_nonrelated(self, model: BaseModel) -> None: ... def setup_nonrelated(self, model: BaseModel) -> None: ...
def setup_related(self, model: BaseModel) -> None: ... def setup_related(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): ...
@@ -232,12 +268,16 @@ class _String(Field[str]):
def _convert_db_column(self, model: BaseModel, column: dict) -> None: ... def _convert_db_column(self, model: BaseModel, column: dict) -> None: ...
def get_trans_terms(self, value) -> list: ... def get_trans_terms(self, value) -> list: ...
def get_text_content(self, term): ... def get_text_content(self, term): ...
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_from_cache_to_column(self, value): ... def _convert_from_cache_to_column(self, value): ...
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_write(self, value, record: BaseModel): ... def convert_to_write(self, value, record: BaseModel): ...
def get_translation_dictionary(self, from_lang_value: str, to_lang_values: dict) -> dict: ... def get_translation_dictionary(
self, from_lang_value: str, to_lang_values: dict
) -> dict: ...
def _get_stored_translations(self, record: BaseModel) -> dict[str, str]: ... def _get_stored_translations(self, record: BaseModel) -> dict[str, str]: ...
def write(self, records: _ModelT, value) -> _ModelT: ... def write(self, records: _ModelT, value) -> _ModelT: ...
@@ -253,8 +293,12 @@ class Char(_String):
_related_trim: bool _related_trim: bool
_description_size: int | None _description_size: int | None
_description_trim: bool _description_trim: bool
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
@@ -287,11 +331,17 @@ 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: ...
def _convert(self, value, record: BaseModel, validate: bool) -> Markup | None: ... def _convert(self, value, record: BaseModel, validate: bool) -> Markup | None: ...
def convert_to_record(self, value, record: BaseModel) -> Markup | None: ... def convert_to_record(self, value, record: BaseModel) -> Markup | None: ...
def convert_to_read(self, value, record: BaseModel, use_name_get: bool = ...) -> Markup | None: ... def convert_to_read(
self, value, record: BaseModel, use_name_get: bool = ...
) -> Markup | None: ...
def get_trans_terms(self, value) -> list: ... def get_trans_terms(self, value) -> list: ...
class Date(Field[datetime.date]): class Date(Field[datetime.date]):
@@ -304,13 +354,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]):
@@ -325,13 +379,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: ...
@@ -346,8 +404,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_class: Type[BaseModel], name: str) -> dict[str, Any]: ... def _get_attrs(self, model_class: Type[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: ...
@@ -369,16 +431,22 @@ class Selection(Field[str]):
selection: _SelectionRaw selection: _SelectionRaw
validate: bool validate: bool
ondelete: dict[str, Any] | None ondelete: dict[str, Any] | None
def __init__(self, selection: _SelectionRaw = ..., string: str = ..., **kwargs) -> None: ... def __init__(
self, selection: _SelectionRaw = ..., string: str = ..., **kwargs
) -> None: ...
def setup_nonrelated(self, model: BaseModel) -> None: ... def setup_nonrelated(self, model: BaseModel) -> None: ...
def setup_related(self, model: BaseModel): ... def setup_related(self, model: BaseModel): ...
def _get_attrs(self, model_class: Type[BaseModel], name: str) -> dict[str, Any]: ... def _get_attrs(self, model_class: Type[BaseModel], name: str) -> dict[str, Any]: ...
def _setup_attrs(self, model_class: Type[BaseModel], name: str) -> None: ... def _setup_attrs(self, model_class: Type[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 _default_group_expand(self, records: BaseModel, groups, domain, order) -> list[str]: ... def _default_group_expand(
self, records: BaseModel, groups, domain, order
) -> list[str]: ...
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): ...
@@ -386,10 +454,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: ...
@@ -415,14 +489,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_class: Type[BaseModel], name: str) -> None: ... def _setup_attrs(self, model_class: Type[BaseModel], name: str) -> None: ...
def setup_nonrelated(self, model: BaseModel) -> None: ... def setup_nonrelated(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_record_multi(self, values, records: BaseModel): ... def convert_to_record_multi(self, values, records: BaseModel): ...
@@ -449,7 +527,9 @@ class Json(Field):
column_type: tuple[str, str] column_type: tuple[str, str]
def convert_to_record(self, value, record: BaseModel): ... def convert_to_record(self, value, record: BaseModel): ...
def convert_to_cache(self, value, record: BaseModel, validate: bool = ...): ... def convert_to_cache(self, value, record: BaseModel, validate: 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_export(self, value, record: BaseModel): ... def convert_to_export(self, value, record: BaseModel): ...
class Properties(Field): class Properties(Field):
@@ -470,7 +550,9 @@ class Properties(Field):
_depends: tuple[str, ...] _depends: tuple[str, ...]
compute: Callable compute: Callable
def _setup_attrs(self, model_class: Type[BaseModel], name: str) -> None: ... def _setup_attrs(self, model_class: Type[BaseModel], name: str) -> 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 = ...): ...
@@ -482,9 +564,13 @@ class Properties(Field):
def _add_default_values(self, env: Environment, values: dict[str, Any]): ... def _add_default_values(self, env: Environment, values: dict[str, Any]): ...
def _get_properties_definition(self, record: BaseModel): ... def _get_properties_definition(self, record: BaseModel): ...
@classmethod @classmethod
def _add_display_name(cls, values_list: list[dict], env: Environment, value_keys: tuple[str] = ...) -> None: ... def _add_display_name(
cls, values_list: list[dict], env: Environment, value_keys: tuple[str] = ...
) -> None: ...
@classmethod @classmethod
def _remove_display_name(cls, values_list: list[dict], value_key: str = ...) -> None: ... def _remove_display_name(
cls, values_list: list[dict], value_key: str = ...
) -> None: ...
@classmethod @classmethod
def _add_missing_names(cls, values_list: list[dict]) -> None: ... def _add_missing_names(cls, values_list: list[dict]) -> None: ...
@classmethod @classmethod
@@ -492,7 +578,9 @@ class Properties(Field):
@classmethod @classmethod
def _list_to_dict(cls, values_list: list[dict]) -> dict: ... def _list_to_dict(cls, values_list: list[dict]) -> dict: ...
@classmethod @classmethod
def _dict_to_list(cls, values_dict: dict, properties_definition: Sequence[dict]) -> Sequence[dict]: ... def _dict_to_list(
cls, values_dict: dict, properties_definition: Sequence[dict]
) -> Sequence[dict]: ...
class PropertiesDefinition(Field): class PropertiesDefinition(Field):
type: str type: str
@@ -502,12 +590,16 @@ class PropertiesDefinition(Field):
prefetch: bool prefetch: bool
REQUIRED_KEYS: tuple[str, ...] REQUIRED_KEYS: tuple[str, ...]
ALLOWED_KEYS: tuple[str, ...] ALLOWED_KEYS: tuple[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_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 = ...): ...
@classmethod @classmethod
def _validate_properties_definition(cls, properties_definition: Sequence[dict], env): ... def _validate_properties_definition(
cls, properties_definition: Sequence[dict], env
): ...
class Command(enum.IntEnum): class Command(enum.IntEnum):
CREATE: int CREATE: int
@@ -552,7 +644,13 @@ class One2many(_RelationalMulti):
inverse_name: str | None inverse_name: str | None
auto_join: bool auto_join: bool
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_nonrelated(self, model: BaseModel) -> None: ... def setup_nonrelated(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: ...
@@ -569,7 +667,15 @@ class Many2many(_RelationalMulti):
column2: str | None column2: str | None
auto_join: bool auto_join: bool
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_nonrelated(self, model: BaseModel) -> None: ... def setup_nonrelated(self, model: BaseModel) -> None: ...
def update_db(self, model: BaseModel, columns) -> None: ... def update_db(self, model: BaseModel, columns) -> None: ...
def update_db_foreign_keys(self, model: BaseModel) -> None: ... def update_db_foreign_keys(self, model: BaseModel) -> None: ...
@@ -590,7 +696,7 @@ class Id(Field[int]):
def __set__(self, record: BaseModel, value) -> None: ... def __set__(self, record: BaseModel, value) -> None: ...
class PrefetchMany2one: class PrefetchMany2one:
__slots__ = 'record', 'field' __slots__ = "record", "field"
record: BaseModel record: BaseModel
field: Field field: Field
def __init__(self, record: BaseModel, field: Field) -> None: ... def __init__(self, record: BaseModel, field: Field) -> None: ...
@@ -598,7 +704,7 @@ class PrefetchMany2one:
def __reversed__(self) -> Iterator[int]: ... def __reversed__(self) -> Iterator[int]: ...
class PrefetchX2many: class PrefetchX2many:
__slots__ = 'record', 'field' __slots__ = "record", "field"
record: BaseModel record: BaseModel
field: Field field: Field
def __init__(self, record: BaseModel, field: Field) -> None: ... def __init__(self, record: BaseModel, field: Field) -> None: ...

View File

@@ -2,7 +2,16 @@ from abc import ABC, abstractmethod
from collections import defaultdict from collections import defaultdict
from collections.abc import MutableMapping from collections.abc import MutableMapping
from contextlib import nullcontext from contextlib import nullcontext
from typing import Any, Callable, Collection, Generator, Iterable, Literal, Mapping, TypeVar from typing import (
Any,
Callable,
Collection,
Generator,
Iterable,
Literal,
Mapping,
TypeVar,
)
import werkzeug import werkzeug
from werkzeug.datastructures import Headers from werkzeug.datastructures import Headers
@@ -20,7 +29,7 @@ from .tools._vendor import sessions
from .tools.geoipresolver import GeoIPResolver from .tools.geoipresolver import GeoIPResolver
from .tools.profiler import Profiler from .tools.profiler import Profiler
_T = TypeVar('_T') _T = TypeVar("_T")
ProxyFix: Callable[..., ProxyFix_] ProxyFix: Callable[..., ProxyFix_]
CORS_MAX_AGE: int CORS_MAX_AGE: int
@@ -45,8 +54,16 @@ def db_filter(dbs: Iterable[str], host: str | None = ...) -> list[str]: ...
def dispatch_rpc(service_name: str, method: str, params: Mapping): ... def dispatch_rpc(service_name: str, method: str, params: Mapping): ...
def is_cors_preflight(request: Request, endpoint) -> bool: ... def is_cors_preflight(request: Request, endpoint) -> bool: ...
def serialize_exception(exception: Exception): ... def serialize_exception(exception: Exception): ...
def send_file(filepath_or_fp, mimetype: str | None = ..., as_attachment: bool = ..., filename: str | None = ..., def send_file(
mtime: str | None = ..., add_etags: bool = ..., cache_timeout: int = ..., conditional: bool = ...) -> werkzeug.Response: ... filepath_or_fp,
mimetype: str | None = ...,
as_attachment: bool = ...,
filename: str | None = ...,
mtime: str | None = ...,
add_etags: bool = ...,
cache_timeout: int = ...,
conditional: bool = ...,
) -> werkzeug.Response: ...
class Stream: class Stream:
type: str type: str
@@ -66,25 +83,34 @@ class Stream:
@classmethod @classmethod
def from_path(cls, path: str, filter_ext: tuple[str, ...] = ...) -> Stream: ... def from_path(cls, path: str, filter_ext: tuple[str, ...] = ...) -> Stream: ...
@classmethod @classmethod
def from_attachment(cls, attachment: 'odoo.model.ir_attachment') -> Stream: ... def from_attachment(cls, attachment: "odoo.model.ir_attachment") -> Stream: ...
@classmethod @classmethod
def from_binary_field(cls, record: BaseModel, field_name: str) -> Stream: ... def from_binary_field(cls, record: BaseModel, field_name: str) -> Stream: ...
def read(self) -> bytes: ... def read(self) -> bytes: ...
def get_response(self, as_attachment: bool | None = ..., immutable: bool | None = ..., **send_file_kwargs) -> werkzeug.Response: ... def get_response(
self,
as_attachment: bool | None = ...,
immutable: bool | None = ...,
**send_file_kwargs
) -> werkzeug.Response: ...
class Controller: class Controller:
children_classes: defaultdict[Any, list] children_classes: defaultdict[Any, list]
@classmethod @classmethod
def __init_subclass__(cls) -> None: ... def __init_subclass__(cls) -> None: ...
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
def _generate_routing_rules(modules: Collection[str], nodb_only: bool, converters: Any | None = ...) -> Generator[tuple[str, Any], None, None]: ... ): ...
def _generate_routing_rules(
modules: Collection[str], nodb_only: bool, converters: Any | None = ...
) -> Generator[tuple[str, Any], None, None]: ...
class FilesystemSessionStore(sessions.FilesystemSessionStore): class FilesystemSessionStore(sessions.FilesystemSessionStore):
def get_session_filename(self, sid: str) -> str: ... def get_session_filename(self, sid: str) -> str: ...
@@ -94,7 +120,15 @@ class FilesystemSessionStore(sessions.FilesystemSessionStore):
def vacuum(self) -> None: ... def vacuum(self) -> None: ...
class Session(MutableMapping): class Session(MutableMapping):
__slots__ = ('can_save', '_Session__data', 'is_dirty', 'is_explicit', 'is_new', 'should_rotate', 'sid') __slots__ = (
"can_save",
"_Session__data",
"is_dirty",
"is_explicit",
"is_new",
"should_rotate",
"sid",
)
can_save: bool can_save: bool
__data: dict __data: dict
is_dirty: bool is_dirty: bool
@@ -114,7 +148,9 @@ class Session(MutableMapping):
uid: int | None uid: int | None
pre_login: str | None pre_login: str | None
pre_uid: int pre_uid: int
def authenticate(self, dbname: str, login: str | None = ..., password: str | None = ...) -> int: ... def authenticate(
self, dbname: str, login: str | None = ..., password: str | None = ...
) -> int: ...
def finalize(self, env: Environment) -> None: ... def finalize(self, env: Environment) -> None: ...
def logout(self, keep_db: bool = ...) -> None: ... def logout(self, keep_db: bool = ...) -> None: ...
def touch(self) -> None: ... def touch(self) -> None: ...
@@ -132,23 +168,48 @@ class Response(werkzeug.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): ...
def flatten(self) -> None: ... def flatten(self) -> None: ...
def set_cookie(self, key: str, value: str = ..., max_age: Any | None = ..., expires: Any | None = ..., def set_cookie(
path: str = ..., domain: str | None = ..., secure: bool = ..., httponly: bool = ..., self,
samesite: str | None = ..., cookie_type: str = ...) -> None: ... key: str,
value: str = ...,
max_age: Any | None = ...,
expires: Any | None = ...,
path: str = ...,
domain: str | None = ...,
secure: bool = ...,
httponly: bool = ...,
samesite: str | None = ...,
cookie_type: str = ...,
) -> None: ...
class FutureResponse: class FutureResponse:
charset: str charset: str
max_cookie_size: int max_cookie_size: int
headers: Headers headers: Headers
def __init__(self) -> None: ... def __init__(self) -> None: ...
def set_cookie(self, key: str, value: str = ..., max_age: Any | None = ..., expires: Any | None = ..., def set_cookie(
path: str = ..., domain: str | None = ..., secure: bool = ..., httponly: bool = ..., self,
samesite: str | None = ..., cookie_type: str = ...) -> None: ... key: str,
value: str = ...,
max_age: Any | None = ...,
expires: Any | None = ...,
path: str = ...,
domain: str | None = ...,
secure: bool = ...,
httponly: bool = ...,
samesite: str | None = ...,
cookie_type: str = ...,
) -> None: ...
class Request: class Request:
httprequest: werkzeug.Request httprequest: werkzeug.Request
@@ -158,16 +219,20 @@ class Request:
session: Session session: Session
db: str | None db: str | None
env: Environment | None env: Environment | 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"
def __init__(self, httprequest: werkzeug.Request) -> None: ... def __init__(self, httprequest: werkzeug.Request) -> None: ...
def _post_init(self) -> None: ... def _post_init(self) -> None: ...
def _get_session_and_dbname(self) -> tuple[Session, str]: ... def _get_session_and_dbname(self) -> tuple[Session, str]: ...
def update_env(self, user: 'odoo.model.res_users | int | None' = ..., context: dict[str, Any] | None = ..., def update_env(
su: bool | None = ...) -> None: ... self,
user: "odoo.model.res_users | int | None" = ...,
context: dict[str, Any] | None = ...,
su: bool | None = ...,
) -> None: ...
def update_context(self, **overrides) -> None: ... def update_context(self, **overrides) -> None: ...
@property @property
def context(self) -> dict[str, Any]: ... def context(self) -> dict[str, Any]: ...
@@ -195,15 +260,34 @@ class Request:
def get_json_data(self): ... def get_json_data(self): ...
def _get_profiler_context_manager(self) -> Profiler | nullcontext: ... def _get_profiler_context_manager(self) -> Profiler | nullcontext: ...
def _inject_future_response(self, response: werkzeug.Response): ... def _inject_future_response(self, response: werkzeug.Response): ...
def make_response(self, data: str, headers: list[tuple[str, Any]] | None = ..., cookies: Mapping | None = ..., def make_response(
status: int = ...) -> Response: ... self,
def make_json_response(self, data, headers: list[tuple[str, Any]] | None = ..., cookies: Mapping | None = ..., data: str,
status: int = ...) -> Response: ... headers: list[tuple[str, Any]] | None = ...,
cookies: Mapping | None = ...,
status: int = ...,
) -> Response: ...
def make_json_response(
self,
data,
headers: list[tuple[str, Any]] | None = ...,
cookies: Mapping | None = ...,
status: int = ...,
) -> Response: ...
def not_found(self, description: str | None = ...) -> NotFound: ... def not_found(self, description: str | None = ...) -> NotFound: ...
def redirect(self, location: URL | str, code: int = ..., local: bool = ...) -> werkzeug.Response: ... def redirect(
def redirect_query(self, location: str, query: Mapping[str, str] | Iterable[tuple[str, str]] | None = ..., self, location: URL | str, code: int = ..., local: bool = ...
code: int = ..., local: bool = ...) -> werkzeug.Response: ... ) -> werkzeug.Response: ...
def render(self, template: str, qcontext: dict | None = ..., lazy: bool = ..., **kw): ... def redirect_query(
self,
location: str,
query: Mapping[str, str] | Iterable[tuple[str, str]] | None = ...,
code: int = ...,
local: bool = ...,
) -> werkzeug.Response: ...
def render(
self, template: str, qcontext: dict | None = ..., lazy: bool = ..., **kw
): ...
def _save_session(self) -> None: ... def _save_session(self) -> None: ...
def _set_request_dispatcher(self, rule: Rule) -> None: ... def _set_request_dispatcher(self, rule: Rule) -> None: ...
def _serve_static(self) -> werkzeug.Response: ... def _serve_static(self) -> werkzeug.Response: ...
@@ -245,7 +329,9 @@ class JsonRPCDispatcher(Dispatcher):
def is_compatible_with(cls, request: Request) -> bool: ... def is_compatible_with(cls, request: Request) -> bool: ...
def dispatch(self, endpoint, args): ... def dispatch(self, endpoint, args): ...
def handle_error(self, exc: Exception) -> Callable: ... def handle_error(self, exc: Exception) -> Callable: ...
def _response(self, result: Any | None = ..., error: Any | None = ...) -> Response: ... def _response(
self, result: Any | None = ..., error: Any | None = ...
) -> Response: ...
class Application: class Application:
@property @property

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
@@ -11,8 +24,8 @@ from .modules.registry import Registry
from .sql_db import Cursor from .sql_db import Cursor
from .tools.query import Query from .tools.query import Query
_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 fix_import_export_id_paths(fieldname: str) -> list[str]: ...
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 __new__(meta, name: str, bases: tuple, attrs: dict): ... def __new__(meta, name: str, bases: tuple, attrs: dict): ...
def __init__(self: type[BaseModel], name: str, bases: tuple, attrs: dict) -> None: ... def __init__(
self: type[BaseModel], name: str, bases: tuple, attrs: dict
) -> None: ...
class NewId: class NewId:
__slots__: list[str] __slots__: list[str]
@@ -51,7 +66,7 @@ class NewId:
def origin_ids(ids: Iterable) -> Iterator[int]: ... def origin_ids(ids: Iterable) -> Iterator[int]: ...
class OriginIds: class OriginIds:
__slots__ = ['ids'] __slots__ = ["ids"]
ids: Sequence[int] ids: Sequence[int]
def __init__(self, ids: Sequence[int]) -> None: ... def __init__(self, ids: Sequence[int]) -> None: ...
def __iter__(self) -> Iterator[int]: ... def __iter__(self) -> Iterator[int]: ...
@@ -108,11 +123,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 _valid_field_parameter(self, field: Field, name: str) -> bool: ... def _valid_field_parameter(self, field: Field, name: str) -> bool: ...
def _add_field(self, name: str, field: Field) -> None: ... def _add_field(self, name: str, field: Field) -> None: ...
@@ -123,7 +138,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
@@ -135,43 +152,147 @@ class BaseModel(metaclass=MetaModel):
@property @property
def _onchange_methods(self) -> dict[str, list]: ... def _onchange_methods(self) -> dict[str, list]: ...
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]: ...
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: ...
def user_has_groups(self, groups: str) -> bool: ... def user_has_groups(self, groups: str) -> bool: ...
def search_count(self, domain: _Domain, limit: int | None = ...) -> int: ... def search_count(self, domain: _Domain, limit: int | None = ...) -> int: ...
@overload @overload
def search(self: _ModelT, domain: _Domain, offset: int = ..., limit: int | None = ..., order: str | None = ..., count: Literal[False] = ...) -> _ModelT: ... def search(
self: _ModelT,
domain: _Domain,
offset: int = ...,
limit: int | None = ...,
order: str | None = ...,
count: Literal[False] = ...,
) -> _ModelT: ...
@overload @overload
def search(self: _ModelT, domain: _Domain, offset: int = ..., limit: int | None = ..., order: str | None = ..., count: Literal[True] = ...) -> int: ... def search(
self: _ModelT,
domain: _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_expand_full(self, groups: _ModelT, domain: _Domain | None, order: str | None) -> _ModelT: ... def _read_group_expand_full(
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: ... self, groups: _ModelT, domain: _Domain | None, order: str | None
def _read_group_fill_temporal(self, data: list, groupby: list[str], aggregated_fields: list[str], annotated_groupbys: list[dict], fill_from: str | None = ..., fill_to: str | None = ..., min_groups: int | None = ...) -> list: ... ) -> _ModelT: ...
def _read_group_prepare(self, orderby: str, aggregated_fields: list[str], annotated_groupbys: list[dict], query: Query) -> tuple[list, list]: ... 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_temporal(
self,
data: list,
groupby: list[str],
aggregated_fields: list[str],
annotated_groupbys: list[dict],
fill_from: str | None = ...,
fill_to: str | None = ...,
min_groups: int | None = ...,
) -> 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(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_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]]: ... self, data: dict, annotated_groupbys: list[dict], groupby: list, domain: _Domain
def _read_group_resolve_many2x_fields(self, data: list[dict[str, Any]], fields: list[dict[str, Any]]) -> None: ... ) -> dict: ...
def _inherits_join_add(self, current_model: BaseModel, parent_model_name: str, query: Query) -> 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(
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_many2x_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) -> str: ... def _inherits_join_calc(self, alias: str, fname: str, query: Query) -> 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: ...
@@ -187,27 +308,48 @@ 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 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(
def update_field_translations(self, field_name: str, translations: dict[str, Any]) -> bool: ... self, fields: Collection[str] | None = ..., load: str = ...
def _update_field_translations(self, field_name: str, translations: dict[str, Any], digest: Callable | None = ...) ->bool: ... ) -> list[dict[str, Any]]: ...
def get_field_translations(self, field_name: str, langs: list[str] | None = ...) -> tuple[list[dict[str, Any]], dict[str, Any]]: ... def update_field_translations(
def _read_format(self, fnames: Collection[str], load: str = ...) -> list[dict[str, Any]]: ... self, field_name: str, translations: dict[str, Any]
) -> bool: ...
def _update_field_translations(
self,
field_name: str,
translations: dict[str, Any],
digest: Callable | None = ...,
) -> bool: ...
def get_field_translations(
self, field_name: str, langs: list[str] | None = ...
) -> tuple[list[dict[str, Any]], dict[str, Any]]: ...
def _read_format(
self, fnames: Collection[str], load: str = ...
) -> list[dict[str, Any]]: ...
def _fetch_field(self, field: Field) -> None: ... def _fetch_field(self, field: Field) -> None: ...
def _read(self, field_names: Collection[str]): ... def _read(self, field_names: 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_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]) -> None: ... def _write(self, vals: dict[str, Any]) -> None: ...
def create(self: _ModelT, vals_list: list[dict[str, Any]] | dict[str, Any]) -> _ModelT: ... def create(
def _prepare_create_values(self, vals_list: list[dict[str, Any]]) -> list[dict[str, Any]]: ... self: _ModelT, vals_list: list[dict[str, Any]] | dict[str, Any]
) -> _ModelT: ...
def _prepare_create_values(
self, vals_list: list[dict[str, Any]]
) -> list[dict[str, Any]]: ...
def _add_precomputed_values(self, vals_list: list[dict[str, Any]]) -> None: ... def _add_precomputed_values(self, vals_list: list[dict[str, Any]]) -> None: ...
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: ...
@@ -220,13 +362,45 @@ 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_m2o_order_by(self, alias: str, order_field: str, query: Query, reverse_direction: bool, seen: set | None) -> list[str]: ... def _generate_m2o_order_by(
def _generate_order_by_inner(self, alias: str, order_spec: str, query: Query, reverse_direction: bool = ..., seen: set | None = ...) -> list[str]: ... 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, domain: _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(self: _ModelT, new: _ModelT, excluded: Container[str] = ...) -> None: ... fields: Sequence[str] | None = ...,
order: str | None = ...,
seen: set | None = ...,
) -> None: ...
def _search(
self: _ModelT,
domain: _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(
self: _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: ...
@@ -236,7 +410,15 @@ class BaseModel(metaclass=MetaModel):
def get_xml_id(self) -> dict[int, str]: ... def get_xml_id(self) -> dict[int, str]: ...
@classmethod @classmethod
def is_transient(cls) -> bool: ... def is_transient(cls) -> bool: ...
def search_read(self, domain: _Domain | None = ..., fields: list[str] | None = ..., offset: int = ..., limit: int | None = ..., order: str | None = ..., **read_kwargs: str) -> list[dict[str, Any]]: ... def search_read(
self,
domain: _Domain | None = ...,
fields: list[str] | None = ...,
offset: int = ...,
limit: int | None = ...,
order: str | None = ...,
**read_kwargs: str
) -> 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): ...
@@ -246,8 +428,12 @@ class BaseModel(metaclass=MetaModel):
def _patch_method(cls, name: str, method) -> None: ... def _patch_method(cls, name: str, method) -> None: ...
@classmethod @classmethod
def _revert_method(cls, name: str) -> None: ... def _revert_method(cls, name: str) -> None: ...
def __init__(self, env: Environment, ids: tuple, prefetch_ids: Iterable[int]) -> None: ... def __init__(
def browse(self: _ModelT, ids: int | NewId | Iterable[int | NewId] | None = ...) -> _ModelT: ... self, env: Environment, ids: tuple, prefetch_ids: Iterable[int]
) -> None: ...
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
@@ -256,10 +442,16 @@ 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(
def with_company(self: _ModelT, company: Union['odoo.model.res_company', int]) -> _ModelT: ... self: _ModelT, user: Union["odoo.model.res_partner", int]
) -> _ModelT: ...
def with_company(
self: _ModelT, company: Union["odoo.model.res_company", 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]: ...
@@ -267,13 +459,22 @@ class BaseModel(metaclass=MetaModel):
def mapped(self, func: Callable | str): ... def mapped(self, func: Callable | 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(
self, fnames: Collection[str] | None = ..., records: BaseModel | None = ...
) -> None: ...
def flush_model(self, fnames: Iterable[str] | None = ...) -> None: ... def flush_model(self, fnames: Iterable[str] | None = ...) -> None: ...
def flush_recordset(self, fnames: Iterable[str] | None = ...) -> None: ... def flush_recordset(self, fnames: Iterable[str] | None = ...) -> None: ...
def _flush(self, fnames: Iterable[str] | None = ...) -> None: ... def _flush(self, fnames: Iterable[str] | None = ...) -> None: ...
def new(self: _ModelT, values: dict[str, Any] | None = ..., origin: _ModelT | None = ..., ref: Any | None = ...) -> _ModelT: ... def new(
self: _ModelT,
values: dict[str, Any] | None = ...,
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: ...
@@ -301,19 +502,42 @@ 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 invalidate_model(self, fnames: Iterable[str] | None = ..., flush: bool = ...) -> None: ... self, fnames: Collection[str] | None = ..., ids: Iterable[int] | None = ...
def invalidate_recordset(self, fnames: Iterable[str] | None = ..., flush: bool = ...) -> None: ... ) -> None: ...
def _invalidate_cache(self, fnames: Iterable[str] | None = ..., ids: Iterable[int] | None = ...) -> None: ... def invalidate_model(
def modified(self, fnames: Collection[str], create: bool = ..., before: bool = ...) -> None: ... self, fnames: Iterable[str] | None = ..., flush: bool = ...
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 invalidate_recordset(
self, fnames: Iterable[str] | None = ..., flush: bool = ...
) -> None: ...
def _invalidate_cache(
self, fnames: Iterable[str] | None = ..., ids: Iterable[int] | 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 _recompute_model(self, fnames: Iterable[str] | None = ...) -> None: ... def _recompute_model(self, fnames: Iterable[str] | None = ...) -> None: ...
def _recompute_recordset(self, fnames: Iterable[str] | None = ...) -> None: ... def _recompute_recordset(self, fnames: Iterable[str] | None = ...) -> None: ...
def _recompute_field(self, field: Field, ids: Iterable[int] | None = ...) -> None: ... def _recompute_field(
self, field: Field, ids: Iterable[int] | None = ...
) -> None: ...
def _has_onchange(self, field: Field, other_fields: Container[Field]) -> bool: ... def _has_onchange(self, field: Field, other_fields: Container[Field]) -> bool: ...
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: ...
def _get_placeholder_filename(self, field: str) -> str | bool: ... def _get_placeholder_filename(self, field: str) -> str | bool: ...
def _populate_factories(self) -> list[tuple[str, Callable[..., Iterator]]]: ... def _populate_factories(self) -> list[tuple[str, Callable[..., Iterator]]]: ...
@property @property
@@ -350,9 +574,15 @@ class TransientModel(Model):
def _transient_clean_rows_older_than(self, seconds) -> None: ... def _transient_clean_rows_older_than(self, seconds) -> None: ...
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,26 +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 neutralize as neutralize
neutralize as neutralize, 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 check_resource_path as check_resource_path
reset_modules_state as reset_modules_state from .module import get_manifest as get_manifest
) from .module import get_module_path as get_module_path
from .module import ( from .module import get_module_resource as get_module_resource
adapt_version as adapt_version, from .module import get_modules as get_modules
check_resource_path as check_resource_path, from .module import get_modules_with_version as get_modules_with_version
get_manifest as get_manifest, from .module import get_resource_from_path as get_resource_from_path
get_module_path as get_module_path, from .module import get_resource_path as get_resource_path
get_module_resource as get_module_resource, from .module import initialize_sys_path as initialize_sys_path
get_modules as get_modules, from .module import load_openerp_module as load_openerp_module
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_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,38 @@
from typing import Any, Iterable from typing import Any, Iterable
from .graph import Graph, Node
from .registry import Registry
from ..sql_db import Cursor from ..sql_db import Cursor
from ..tests.result import OdooTestResult from ..tests.result import OdooTestResult
from .graph import Graph, Node
from .registry import Registry
def load_data(cr: Cursor, idref: dict, mode: str, kind: str, package: Node) -> bool: ... def load_data(cr: Cursor, idref: dict, mode: str, kind: str, package: Node) -> bool: ...
def load_demo(cr: Cursor, package: Node, idref: dict, mode: str) -> bool: ... def load_demo(cr: Cursor, package: Node, idref: dict, mode: str) -> 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: OdooTestResult | 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: OdooTestResult | 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: OdooTestResult, def load_marked_modules(
loaded_modules: list[str], perform_checks: Any, models_to_check: set[str] | None = ...) -> list[str]: ... cr: Cursor,
def load_modules(registry: Registry, force_demo: bool = ..., status: Any | None = ..., update_module: Any = ...) -> Registry | None: ... graph: Graph,
states: list[str],
force: list[str],
progressdict,
report: OdooTestResult,
loaded_modules: list[str],
perform_checks: Any,
models_to_check: set[str] | None = ...,
) -> list[str]: ...
def load_modules(
registry: Registry,
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

@@ -24,10 +24,13 @@ 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]: ...
def check_resource_path(mod_path: str, *args) -> str | Literal[False]: ... def check_resource_path(mod_path: 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: ...
@@ -36,7 +39,9 @@ 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_manifest(module: str, mod_path: str | None = ...) -> dict[str, Any]: ... def load_manifest(module: str, mod_path: str | None = ...) -> dict[str, Any]: ...
def get_manifest(module: str, mod_path: str | None = ...) -> dict[str, Any]: ... def get_manifest(module: str, mod_path: str | None = ...) -> dict[str, Any]: ...
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]: ...

View File

@@ -4,13 +4,13 @@ from collections.abc import Mapping
from threading import RLock from threading import RLock
from typing import Any, Callable, ClassVar, Collection, Iterable, Iterator from typing import Any, Callable, ClassVar, Collection, Iterable, Iterator
from .graph import Node
from ..models import BaseModel
from ..fields import Field from ..fields import Field
from ..models import BaseModel
from ..sql_db import Connection, Cursor from ..sql_db import Connection, Cursor
from ..tests.result import OdooTestResult from ..tests.result import OdooTestResult
from ..tools import Collector from ..tools import Collector
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
@@ -78,9 +84,21 @@ class Registry(Mapping[str, type[BaseModel]]):
_post_init_queue: deque _post_init_queue: deque
_foreign_keys: Any _foreign_keys: Any
_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_indexes(self, cr: Cursor, model_names: Iterable[str]) -> None: ... def check_indexes(self, cr: Cursor, model_names: Iterable[str]) -> None: ...
def add_foreign_key(self, table1, column1, table2, column2, ondelete, model, module, force: bool = ...) -> None: ... def add_foreign_key(
self,
table1,
column1,
table2,
column2,
ondelete,
model,
module,
force: bool = ...,
) -> None: ...
def check_foreign_keys(self, cr: Cursor) -> None: ... def check_foreign_keys(self, cr: Cursor) -> None: ...
def check_tables_exist(self, cr: Cursor) -> None: ... def check_tables_exist(self, cr: Cursor) -> None: ...
def _clear_cache(self) -> None: ... def _clear_cache(self) -> None: ...
@@ -111,7 +129,7 @@ class DummyRLock:
def __exit__(self, type, value, traceback) -> None: ... def __exit__(self, type, value, traceback) -> None: ...
class TriggerTree(dict): class TriggerTree(dict):
__slots__ = ['root'] __slots__ = ["root"]
root: Any root: Any
def __init__(self, root: Any = ..., *args, **kwargs) -> None: ... def __init__(self, root: Any = ..., *args, **kwargs) -> None: ...
def __bool__(self) -> bool: ... def __bool__(self) -> bool: ...

View File

@@ -3,7 +3,9 @@ import warnings
from logging import Logger, LogRecord from logging import Logger, LogRecord
from typing import IO, TextIO from typing import IO, TextIO
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 WatchedFileHandler(logging.handlers.WatchedFileHandler): class WatchedFileHandler(logging.handlers.WatchedFileHandler):
errors: None errors: None
@@ -31,11 +33,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): ...
@@ -52,5 +58,12 @@ PSEUDOCONFIG_MAPPER: dict[str, list[str]]
showwarning = warnings.showwarning showwarning = warnings.showwarning
IGNORE: set[str] IGNORE: set[str]
def showwarning_with_traceback(message: Warning | str, category: type[Warning], filename: str, lineno: int, file: TextIO | None = ..., line: str | None = ...): ... def showwarning_with_traceback(
message: Warning | str,
category: type[Warning],
filename: str,
lineno: int,
file: TextIO | None = ...,
line: str | None = ...,
): ...
def runbot(self, message, *args, **kws) -> None: ... def runbot(self, message, *args, **kws) -> None: ...

View File

@@ -1,7 +1,8 @@
from typing import Any, Callable from typing import Any, Callable
from ..fields import Field from ..fields import Field
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.query import Query from ..tools.query import Query
@@ -43,7 +44,13 @@ class expression:
expression: _Domain expression: _Domain
query: Query | None query: Query | None
result: tuple[str, list] result: tuple[str, list]
def __init__(self, domain: _Domain, model: BaseModel, alias: str | None = ..., query: Query | None = ...) -> None: ... def __init__(
self,
domain: _Domain,
model: BaseModel,
alias: str | None = ...,
query: Query | None = ...,
) -> None: ...
def _unaccent(self, field: Field) -> Callable[[Any], str]: ... def _unaccent(self, field: Field) -> Callable[[Any], str]: ...
def get_tables(self) -> tuple[str, ...]: ... def get_tables(self) -> tuple[str, ...]: ...
def parse(self): ... def parse(self): ...

View File

@@ -1,7 +1,5 @@
from . import ( from . import common as common
common as common, from . import db as db
db as db, from . import model as model
model as model, from . import server as server
server as server, from . import wsgi_server as wsgi_server
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

@@ -9,11 +9,13 @@ 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 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): ...
def _as_validation_error(env: Environment, exc: IntegrityError) -> ValidationError: ... def _as_validation_error(env: Environment, exc: IntegrityError) -> ValidationError: ...
def retrying(func: Callable[[], Any], env: Environment): ... def retrying(func: Callable[[], Any], env: Environment): ...

View File

@@ -4,5 +4,7 @@ from ..api import Environment
from ..http import Session from ..http import Session
def check(db: str, uid: int, passwd: str) -> None: ... def check(db: str, uid: int, passwd: str) -> None: ...
def compute_session_token(session: Session, env: Environment) -> str | Literal[False]: ... def compute_session_token(
session: Session, env: Environment
) -> str | Literal[False]: ...
def check_session(session: Session, env: Environment) -> bool: ... def check_session(session: Session, 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
@@ -13,7 +12,7 @@ from watchdog.observers import Observer
from ..modules.registry import Registry from ..modules.registry import Registry
from ..sql_db import Cursor from ..sql_db import Cursor
_WorkerT = TypeVar('_WorkerT', bound=Worker) _WorkerT = TypeVar("_WorkerT", bound=Worker)
INOTIFY_LISTEN_EVENTS: Any INOTIFY_LISTEN_EVENTS: Any
SLEEP_INTERVAL: int SLEEP_INTERVAL: int
@@ -36,7 +35,9 @@ class RequestHandler(werkzeug.serving.WSGIRequestHandler):
close_connection: bool close_connection: bool
def send_header(self, keyword, value) -> None: ... def send_header(self, keyword, value) -> 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
@@ -128,7 +129,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,7 +1,17 @@
from datetime import datetime from datetime import datetime
from re import Pattern from re import Pattern
from threading import Lock, RLock from threading import Lock, RLock
from typing import Any, Callable, Generator, Iterable, Iterator, Literal, NoReturn, Sequence, TypeVar from typing import (
Any,
Callable,
Generator,
Iterable,
Iterator,
Literal,
NoReturn,
Sequence,
TypeVar,
)
import psycopg2.extensions import psycopg2.extensions
from psycopg2.sql import Identifier from psycopg2.sql import Identifier
@@ -9,9 +19,9 @@ from psycopg2.sql import Identifier
from .api import Transaction from .api import Transaction
from .tools import Callbacks from .tools import Callbacks
_T = TypeVar('_T') _T = TypeVar("_T")
_CursorT = TypeVar('_CursorT', bound=Cursor) _CursorT = TypeVar("_CursorT", bound=Cursor)
_SavepointT = TypeVar('_SavepointT', bound=Savepoint) _SavepointT = TypeVar("_SavepointT", bound=Savepoint)
def undecimalize(symb, cr: Cursor) -> float | None: ... def undecimalize(symb, cr: Cursor) -> float | None: ...
@@ -68,7 +78,9 @@ class Cursor(BaseCursor):
__caller: tuple[str, int | str] | Literal[False] __caller: tuple[str, int | str] | Literal[False]
cache: dict cache: dict
_now: datetime | None _now: datetime | None
def __init__(self, pool: ConnectionPool, dbname: str, dsn: dict, **kwargs) -> None: ... def __init__(
self, pool: ConnectionPool, dbname: str, dsn: dict, **kwargs
) -> 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]]: ...
@@ -76,7 +88,9 @@ class Cursor(BaseCursor):
def __del__(self) -> None: ... def __del__(self) -> None: ...
def _format(self, query, params: Any | None = ...): ... def _format(self, query, params: Any | None = ...): ...
def execute(self, query, params: Any | None = ..., log_exceptions: bool = ...): ... def execute(self, query, params: Any | None = ..., log_exceptions: bool = ...): ...
def split_for_in_conditions(self, ids: Iterable, size: int | None = ...) -> Iterator[tuple]: ... def split_for_in_conditions(
self, ids: Iterable, size: int | None = ...
) -> Iterator[tuple]: ...
def print_log(self): ... def print_log(self): ...
def _enable_logging(self) -> Generator[None, None, None]: ... def _enable_logging(self) -> Generator[None, None, None]: ...
def close(self): ... def close(self): ...
@@ -115,7 +129,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: ...
def _dsn_equals(self, dsn1, dsn2) -> bool: ... def _dsn_equals(self, dsn1, dsn2) -> bool: ...
def _dsn_to_dict(self, dsn) -> dict: ... def _dsn_to_dict(self, dsn) -> dict: ...

View File

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

View File

@@ -10,7 +10,9 @@ class _Outcome:
success: bool success: bool
test: Any test: Any
def __init__(self, test, result) -> None: ... def __init__(self, test, result) -> None: ...
def testPartExecutor(self, test_case, isTest: bool = ...) -> Generator[None, None, None]: ... def testPartExecutor(
self, test_case, isTest: bool = ...
) -> Generator[None, None, None]: ...
def _complete_traceback(self, initial_tb): ... def _complete_traceback(self, initial_tb): ...
class TestCase(_TestCase): class TestCase(_TestCase):

View File

@@ -11,8 +11,6 @@ import requests
from lxml.etree import _Element from lxml.etree import _Element
from websocket import WebSocket from websocket import WebSocket
from . import case
from .result import OdooTestResult
from ..api import Environment from ..api import Environment
from ..http import Session from ..http import Session
from ..models import BaseModel from ..models import BaseModel
@@ -21,11 +19,13 @@ from ..sql_db import BaseCursor, Cursor
from ..tools import profiler from ..tools import profiler
from ..tools._vendor.sessions import Session from ..tools._vendor.sessions import Session
from ..tools.profiler import Profiler from ..tools.profiler import Profiler
from . import case
from .result import OdooTestResult
_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)
InvalidStateError = Any InvalidStateError = Any
ADDONS_PATH: str ADDONS_PATH: str
@@ -43,7 +43,13 @@ def standalone(*tags: str) -> Callable[[_CallableT], _CallableT]: ...
DB: str DB: str
def new_test_user(env: Environment, login: str = ..., groups: str = ..., context: dict | None = ..., **kwargs) -> 'odoo.model.res_users': ... def new_test_user(
env: Environment,
login: str = ...,
groups: str = ...,
context: dict | None = ...,
**kwargs
) -> "odoo.model.res_users": ...
class RecordCapturer: class RecordCapturer:
_model: BaseModel _model: BaseModel
@@ -85,14 +91,26 @@ class BaseCase(case.TestCase, metaclass=MetaCase):
def startClassPatcher(cls, patcher): ... def startClassPatcher(cls, patcher): ...
def with_user(self, login: str) -> None: ... def with_user(self, login: str) -> None: ...
def debug_mode(self) -> Generator[None, None, None]: ... def debug_mode(self) -> Generator[None, None, None]: ...
def _assertRaises(self, exception, *, msg: Any | None = ...) -> Generator[Any, None, None]: ... def _assertRaises(
def assertRaises(self, exception, func: Any | None = ..., *args, **kwargs) -> Generator[Any, None, None] | None: ... self, exception, *, msg: Any | None = ...
def assertQueries(self, expected, flush: bool = ...) -> Generator[list, None, None]: ... ) -> Generator[Any, None, None]: ...
def assertQueryCount(self, default: int = ..., flush: bool = ..., **counters) -> Generator[None, None, None]: ... def assertRaises(
def assertRecordValues(self, records: BaseModel, expected_values: list[dict[str, Any]]) -> None: ... self, exception, func: Any | None = ..., *args, **kwargs
) -> Generator[Any, None, None] | None: ...
def assertQueries(
self, expected, flush: bool = ...
) -> Generator[list, 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 assertItemsEqual(self, a, b, msg: str | None = ...) -> None: ... def assertItemsEqual(self, a, b, msg: str | None = ...) -> None: ...
def assertTreesEqual(self, n1, n2, msg: str | None = ...) -> None: ... def assertTreesEqual(self, n1, n2, msg: str | None = ...) -> None: ...
def _assertXMLEqual(self, original: str, expected: str, parser: str = ...) -> None: ... def _assertXMLEqual(
self, original: str, expected: str, parser: str = ...
) -> None: ...
def assertXMLEqual(self, original: str, expected: str) -> None: ... def assertXMLEqual(self, original: str, expected: str) -> None: ...
def assertHTMLEqual(self, original: str, expected: str) -> None: ... def assertHTMLEqual(self, original: str, expected: str) -> None: ...
profile_session: str profile_session: str
@@ -161,23 +179,35 @@ class ChromeBrowser:
def _chrome_start(self) -> None: ... def _chrome_start(self) -> None: ...
dev_tools_frontend_url: str dev_tools_frontend_url: str
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 _receive(self, dbname: str) -> None: ... def _receive(self, dbname: str) -> None: ...
def _websocket_request(self, method: str, *, params: Any | None = ..., timeout: float = ...): ... def _websocket_request(
def _websocket_send(self, method: str, *, params: Any | None = ..., with_future: bool = ...) -> Future | None: ... self, method: str, *, params: Any | None = ..., timeout: float = ...
def _handle_console(self, type, args: Any | None = ..., stackTrace: Any | None = ..., **kw) -> None: ... ): ...
def _websocket_send(
self, method: str, *, params: Any | None = ..., with_future: bool = ...
) -> Future | None: ...
def _handle_console(
self, type, args: Any | None = ..., stackTrace: Any | None = ..., **kw
) -> None: ...
def _handle_exception(self, exceptionDetails: dict, timestamp) -> None: ... def _handle_exception(self, exceptionDetails: dict, timestamp) -> None: ...
def _handle_frame_stopped_loading(self, frameId) -> None: ... def _handle_frame_stopped_loading(self, frameId) -> None: ...
def _handle_screencast_frame(self, sessionId, data, metadata) -> None: ... def _handle_screencast_frame(self, sessionId, data, metadata) -> None: ...
_TO_LEVEL: dict[str, int] _TO_LEVEL: dict[str, int]
def take_screenshot(self, prefix: str = ..., suffix: str | None = ...) -> Future: ... def take_screenshot(
self, prefix: str = ..., suffix: str | None = ...
) -> Future: ...
def _save_screencast(self, prefix: str = ...) -> None: ... def _save_screencast(self, prefix: str = ...) -> None: ...
def start_screencast(self) -> None: ... def start_screencast(self) -> None: ...
def set_cookie(self, name: str, value, path, domain) -> None: ... def set_cookie(self, name: str, value, path, domain) -> None: ...
def delete_cookie(self, name: str, **kwargs) -> None: ... def delete_cookie(self, name: str, **kwargs) -> None: ...
def _wait_ready(self, ready_code, timeout: int = ...) -> bool: ... def _wait_ready(self, ready_code, timeout: int = ...) -> bool: ...
def _wait_code_ok(self, code, timeout: float, error_checker: Any | None = ...) -> None: ... def _wait_code_ok(
self, code, timeout: float, error_checker: Any | None = ...
) -> None: ...
def navigate_to(self, url: str, wait_stop: bool = ...) -> None: ... def navigate_to(self, url: str, wait_stop: bool = ...) -> None: ...
def clear(self) -> None: ... def clear(self) -> None: ...
def _from_remoteobject(self, arg: Mapping): ... def _from_remoteobject(self, arg: Mapping): ...
@@ -213,17 +243,37 @@ class HttpCase(TransactionCase):
def start_browser(cls) -> None: ... def start_browser(cls) -> None: ...
@classmethod @classmethod
def terminate_browser(cls) -> None: ... def terminate_browser(cls) -> None: ...
def url_open(self, url: str, data: Any | None = ..., files: Mapping | None = ..., timeout: int = ..., def url_open(
headers: Mapping | None = ..., allow_redirects: bool = ..., head: bool = ...) -> requests.Response: ... self,
url: str,
data: Any | None = ...,
files: Mapping | None = ...,
timeout: int = ...,
headers: Mapping | None = ...,
allow_redirects: bool = ...,
head: bool = ...,
) -> 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: ...
session: Session session: Session
def authenticate(self, user, password) -> Session: ... def authenticate(self, user, password) -> Session: ...
def browser_js(self, url_path: str, code: str, ready: str = ..., login: str | None = ..., timeout: int = ..., def browser_js(
cookies: Any | None = ..., error_checker: Any | None = ..., watch: bool = ..., **kw) -> None: ... self,
url_path: str,
code: str,
ready: str = ...,
login: str | None = ...,
timeout: int = ...,
cookies: Any | None = ...,
error_checker: Any | None = ...,
watch: bool = ...,
**kw
) -> None: ...
@classmethod @classmethod
def base_url(cls) -> str: ... def base_url(cls) -> str: ...
def start_tour(self, url_path: str, tour_name: str, step_delay: float | None = ..., **kwargs) -> None: ... def start_tour(
self, url_path: str, tour_name: str, step_delay: float | None = ..., **kwargs
) -> None: ...
def profile(self, **kwargs) -> profiler.Nested: ... def profile(self, **kwargs) -> profiler.Nested: ...
class HttpSavepointCase(HttpCase): class HttpSavepointCase(HttpCase):
@@ -243,14 +293,24 @@ class Form(Generic[_ModelT]):
_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 _get_view_fields(self, node: _Element, model: BaseModel) -> dict: ... def _get_view_fields(self, node: _Element, model: BaseModel) -> dict: ...
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: ...
@@ -258,9 +318,19 @@ 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,
def _perform_onchange(self, fields: list[str], context: dict | None = ...) -> dict: ... 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], context: dict | None = ...
) -> dict: ...
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: ...
def _cleanup_onchange(self, descr: dict, value, current): ... def _cleanup_onchange(self, descr: dict, value, current): ...
@@ -269,8 +339,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

@@ -28,7 +28,12 @@ class OdooTestResult:
_soft_fail: bool _soft_fail: bool
had_failure: bool had_failure: bool
stats: dict[str, Stat] stats: dict[str, Stat]
def __init__(self, stream: Any | None = ..., descriptions: Any | None = ..., verbosity: Any | None = ...) -> None: ... def __init__(
self,
stream: Any | None = ...,
descriptions: Any | None = ...,
verbosity: Any | None = ...,
) -> None: ...
def printErrors(self) -> None: ... def printErrors(self) -> None: ...
def startTest(self, test) -> None: ... def startTest(self, test) -> None: ...
def stopTest(self, test) -> None: ... def stopTest(self, test) -> None: ...
@@ -45,7 +50,17 @@ class OdooTestResult:
def __str__(self) -> str: ... def __str__(self) -> str: ...
def soft_fail(self) -> Generator[None, None, None]: ... def soft_fail(self) -> Generator[None, None, None]: ...
def update(self, other) -> None: ... def update(self, other) -> 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 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_stats(self) -> None: ... def log_stats(self) -> None: ...
def getDescription(self, test) -> str: ... def getDescription(self, test) -> str: ...
def collectStats(self, test_id) -> Generator[None, None, None]: ... def collectStats(self, test_id) -> Generator[None, None, None]: ...

View File

@@ -6,7 +6,9 @@ __unittest: bool
class TestSuite(BaseTestSuite): class TestSuite(BaseTestSuite):
def run(self, result, debug: bool = ...): ... def run(self, result, debug: bool = ...): ...
def _handleClassSetUp(self, test, result) -> None: ... def _handleClassSetUp(self, test, result) -> None: ...
def _createClassOrModuleLevelException(self, result, exception, method_name, parent, info: Any | None = ...) -> None: ... def _createClassOrModuleLevelException(
self, result, exception, method_name, parent, info: Any | None = ...
) -> None: ...
def _tearDownPreviousClass(self, test, result) -> None: ... def _tearDownPreviousClass(self, test, result) -> None: ...
class _ErrorHolder: class _ErrorHolder:

View File

@@ -1,30 +1,27 @@
from . import appdirs as appdirs
from . import cloc as cloc
from . import osutil as osutil
from . import pdf as pdf
from . import pycompat as pycompat
from .barcode import * from .barcode import *
from .config import config as config
from .convert import *
from .date_utils import * from .date_utils import *
from .float_utils import * from .float_utils import *
from .func import * from .func import *
from .image import * from .image import *
from .js_transpiler import ODOO_MODULE_RE as ODOO_MODULE_RE
from .js_transpiler import URL_RE as URL_RE
from .js_transpiler import is_odoo_module as is_odoo_module
from .js_transpiler import transpile_javascript as transpile_javascript
from .mail import * from .mail import *
from .misc import * from .misc import *
from .query import Query as Query
from .query import _generate_table_alias as _generate_table_alias
from .sourcemap_generator import SourceMapGenerator as SourceMapGenerator
from .sql import * from .sql import *
from .template_inheritance import * from .template_inheritance import *
from .translate import * from .translate import *
from .xml_utils import * from .xml_utils import *
from .convert import *
from . import (
appdirs as appdirs,
cloc as cloc,
osutil as osutil,
pdf as pdf,
pycompat as pycompat
)
from .config import config as config
from .js_transpiler import (
ODOO_MODULE_RE as ODOO_MODULE_RE,
URL_RE as URL_RE,
is_odoo_module as is_odoo_module,
transpile_javascript as transpile_javascript
)
from .query import Query as Query, _generate_table_alias as _generate_table_alias
from .sourcemap_generator import SourceMapGenerator as SourceMapGenerator
SUPPORTED_DEBUGGER: set[str] SUPPORTED_DEBUGGER: set[str]

View File

@@ -1,6 +1,6 @@
from datetime import datetime from datetime import datetime
from os import PathLike from os import PathLike
from typing import Callable, IO from typing import IO, Callable
from werkzeug import Response from werkzeug import Response

View File

@@ -3,22 +3,24 @@ from typing import Any, Generic, TypeVar
from werkzeug.datastructures import CallbackDict from werkzeug.datastructures import CallbackDict
_ModificationTrackingDictT = TypeVar('_ModificationTrackingDictT', bound=ModificationTrackingDict) _ModificationTrackingDictT = TypeVar(
_SessionT = TypeVar('_SessionT', bound=Session) "_ModificationTrackingDictT", bound=ModificationTrackingDict
)
_SessionT = TypeVar("_SessionT", bound=Session)
_sha1_re: Pattern _sha1_re: Pattern
def generate_key(salt: Any = ...) -> str: ... def generate_key(salt: Any = ...) -> str: ...
class ModificationTrackingDict(CallbackDict): class ModificationTrackingDict(CallbackDict):
__slots__ = ('modified',) __slots__ = ("modified",)
modified: bool modified: bool
def __init__(self, *args, **kwargs): ... def __init__(self, *args, **kwargs): ...
def copy(self: _ModificationTrackingDictT) -> _ModificationTrackingDictT: ... def copy(self: _ModificationTrackingDictT) -> _ModificationTrackingDictT: ...
def __copy__(self: _ModificationTrackingDictT) -> _ModificationTrackingDictT: ... def __copy__(self: _ModificationTrackingDictT) -> _ModificationTrackingDictT: ...
class Session(ModificationTrackingDict): class Session(ModificationTrackingDict):
__slots__ = ('modified', 'sid', 'new') __slots__ = ("modified", "sid", "new")
sid: str sid: str
new: bool new: bool
def __init__(self, data, sid, new: bool = ...): ... def __init__(self, data, sid, new: bool = ...): ...
@@ -44,8 +46,14 @@ class FilesystemSessionStore(SessionStore[_SessionT]):
filename_template: str filename_template: str
renew_missing: bool renew_missing: bool
mode: int mode: int
def __init__(self, path: str | None = ..., filename_template: str = ..., session_class: type[_SessionT] | None = ..., def __init__(
renew_missing: bool = ..., mode: int = ...) -> None: ... self,
path: str | None = ...,
filename_template: str = ...,
session_class: type[_SessionT] | None = ...,
renew_missing: bool = ...,
mode: int = ...,
) -> None: ...
def get_session_filename(self, sid: str) -> str: ... def get_session_filename(self, sid: str) -> str: ...
def save(self, session: _SessionT) -> None: ... def save(self, session: _SessionT) -> None: ...
def delete(self, session: _SessionT) -> None: ... def delete(self, session: _SessionT) -> None: ...

View File

@@ -6,7 +6,9 @@ class UserAgentParser(object):
_browser_version_re: str _browser_version_re: str
_language_re: Pattern _language_re: Pattern
def __init__(self) -> None: ... def __init__(self) -> None: ...
def __call__(self, user_agent: str) -> tuple[str | None, str | None, str | None, str | None]: ... def __call__(
self, user_agent: str
) -> tuple[str | None, str | None, str | None, str | None]: ...
class UserAgent(object): class UserAgent(object):
_parser: UserAgentParser _parser: UserAgentParser

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

@@ -24,7 +24,13 @@ class Cloc:
def parse_scss(self, s: str) -> tuple[int, int]: ... def parse_scss(self, s: str) -> tuple[int, int]: ...
def parse_css(self, s: str) -> tuple[int, int]: ... def parse_css(self, s: str) -> tuple[int, int]: ...
def parse(self, s: str, ext: str) -> tuple[int, int]: ... def parse(self, s: str, ext: 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

@@ -28,10 +28,16 @@ class configmanager:
def _parse_config(self, args: list | None = ...): ... def _parse_config(self, args: list | None = ...): ...
def _warn_deprecated_options(self) -> None: ... def _warn_deprecated_options(self) -> 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, keys: Any | None = ...) -> None: ... def save(self, keys: Any | None = ...) -> None: ...
def get(self, key, default: Any | None = ...): ... def get(self, key, default: Any | None = ...): ...

View File

@@ -3,13 +3,15 @@ from typing import Any, Callable, TextIO
from lxml.etree import _Element from lxml.etree import _Element
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 .misc import ustr as ustr
__all__ = [ __all__ = [
'convert_file', 'convert_sql_import', "convert_file",
'convert_csv_import', 'convert_xml_import' "convert_sql_import",
"convert_csv_import",
"convert_xml_import",
] ]
safe_eval: Callable safe_eval: Callable
@@ -28,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: ...
@@ -36,10 +40,14 @@ class xml_import:
def _tag_function(self, rec: _Element) -> None: ... def _tag_function(self, rec: _Element) -> None: ...
def _tag_act_window(self, rec: _Element) -> None: ... def _tag_act_window(self, rec: _Element) -> None: ...
def _tag_menuitem(self, rec: _Element, parent: Any | None = ...) -> None: ... def _tag_menuitem(self, rec: _Element, parent: Any | None = ...) -> None: ...
def _tag_record(self, rec: _Element, extra_vals: dict | None = ...) -> tuple[str, int] | None: ... def _tag_record(
self, rec: _Element, extra_vals: dict | None = ...
) -> 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: ...
@@ -52,11 +60,44 @@ 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, noupdate: bool = ..., xml_filename: str | None = ...) -> None: ... def __init__(
self,
cr: Cursor,
module: str,
idref: dict,
mode: str,
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 = ..., pathname: str | None = ...) -> None: ... def convert_file(
cr: Cursor,
module: str,
filename: str,
idref: dict,
mode: str = ...,
noupdate: bool = ...,
kind: str | 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,10 +1,30 @@
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]: ...
def json_float_round(value: float, precision_digits: int, rounding_method: str = ...) -> float: ... def json_float_round(
value: float, precision_digits: int, rounding_method: str = ...
) -> float: ...

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]
@@ -30,7 +30,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

@@ -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, source: bytes, verify_resolution: bool = ...) -> None: ... def __init__(self, source: bytes, verify_resolution: bool = ...) -> None: ...
def image_quality(self, quality: int = ..., output_format: str = ...) -> bytes | Literal[False]: ... def image_quality(
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(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]: ... 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 binary_to_image(source: bytes) -> Image: ... def binary_to_image(source: bytes) -> Image: ...
def base64_to_image(base64_source: bytes) -> Image: ... def base64_to_image(base64_source: bytes) -> Image: ...

View File

@@ -17,7 +17,8 @@ def convert_export_class(content: str) -> str: ...
EXPORT_FCT_DEFAULT_RE: Pattern EXPORT_FCT_DEFAULT_RE: Pattern
def convert_export_function_default(content: str): str: ... def convert_export_function_default(content: str):
str: ...
EXPORT_CLASS_DEFAULT_RE: Pattern EXPORT_CLASS_DEFAULT_RE: Pattern

View File

@@ -2,7 +2,7 @@ from collections import OrderedDict
from threading import RLock from threading import RLock
from typing import Any from typing import Any
__all__ = ['LRU'] __all__ = ["LRU"]
class LRU: class LRU:
_lock: RLock _lock: RLock

View File

@@ -19,9 +19,19 @@ class _Cleaner(clean.Cleaner):
def parse_style(self, el: _Element) -> None: ... def parse_style(self, el: _Element) -> None: ...
def tag_quote(el: _Element) -> None: ... def tag_quote(el: _Element) -> None: ...
def html_normalize(src: str, filter_callback: Callable[[_Element], _Element] | None = ...) -> str: ... def html_normalize(
def html_sanitize(src: str, silent: bool = ..., sanitize_tags: bool = ..., sanitize_attributes: bool = ..., sanitize_style: bool = ..., src: str, filter_callback: Callable[[_Element], _Element] | None = ...
sanitize_form: bool = ..., strip_style: bool = ..., strip_classes: bool = ...) -> Markup: ... ) -> str: ...
def html_sanitize(
src: str,
silent: bool = ...,
sanitize_tags: bool = ...,
sanitize_attributes: bool = ...,
sanitize_style: bool = ...,
sanitize_form: bool = ...,
strip_style: bool = ...,
strip_classes: bool = ...,
) -> Markup: ...
URL_REGEX: str URL_REGEX: str
TEXT_URL_REGEX: str TEXT_URL_REGEX: str
@@ -33,9 +43,17 @@ def validate_url(url: str) -> str: ...
def is_html_empty(html_content: str) -> bool: ... def is_html_empty(html_content: str) -> bool: ...
def html_keep_url(text: str) -> str: ... def html_keep_url(text: str) -> str: ...
def html_to_inner_content(html: str) -> str: ... def html_to_inner_content(html: 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: ...
def prepend_html_content(html_body: str, html_content: str) -> str: ... def prepend_html_content(html_body: str, html_content: str) -> str: ...
email_re: Pattern email_re: Pattern
@@ -52,6 +70,8 @@ def email_domain_extract(email: str) -> str | Literal[False]: ...
def email_domain_normalize(domain: str) -> str | Literal[False]: ... def email_domain_normalize(domain: str) -> str | Literal[False]: ...
def url_domain_extract(url: str) -> str | Literal[False]: ... def url_domain_extract(url: str) -> str | Literal[False]: ...
def email_escape_char(email_address: str) -> str: ... def email_escape_char(email_address: str) -> str: ...
def decode_message_header(message: Message, header: str, separator: str = ...) -> str: ... def decode_message_header(
message: Message, header: str, separator: str = ...
) -> 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 _odoo_guess_mimetype(bin_data: str, default: str = ...) -> str: ... def _odoo_guess_mimetype(bin_data: str, default: str = ...) -> str: ...
@@ -26,7 +26,5 @@ _guesser: Any
ms: Any ms: Any
def guess_mimetype(bin_data: str, default: str | None = ...) -> str: ... def guess_mimetype(bin_data: str, default: str | None = ...) -> str: ...
def neuter_mimetype(mimetype: str, user: "odoo.model.res_users") -> str: ...
def neuter_mimetype(mimetype: str, user: 'odoo.model.res_users') -> str: ...
def get_extension(filename: str) -> str: ... def get_extension(filename: str) -> str: ...

View File

@@ -6,7 +6,19 @@ from contextlib import ContextDecorator, suppress
from logging import Handler, LogRecord from logging import Handler, LogRecord
from re import Pattern from re import Pattern
from types import ModuleType from types import ModuleType
from typing import Any, Collection, Generic, IO, AnyStr, ItemsView, Iterable, Iterator, NoReturn, TypeVar, Callable from typing import (
IO,
Any,
AnyStr,
Callable,
Collection,
Generic,
ItemsView,
Iterable,
Iterator,
NoReturn,
TypeVar,
)
import markupsafe import markupsafe
import xlsxwriter import xlsxwriter
@@ -14,34 +26,45 @@ 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 .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
_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)
_LowerLoggingT = TypeVar('_LowerLoggingT', bound=lower_logging) _LowerLoggingT = TypeVar("_LowerLoggingT", bound=lower_logging)
_ReplaceExceptionsT = TypeVar('_ReplaceExceptionsT', bound=replace_exceptions) _ReplaceExceptionsT = TypeVar("_ReplaceExceptionsT", bound=replace_exceptions)
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(
name: str, *args
) -> tuple[IO[AnyStr] | None, IO[AnyStr] | None]: ...
def file_path(file_path: str, filter_ext: tuple[str, ...] = ...) -> str: ... def file_path(file_path: str, filter_ext: tuple[str, ...] = ...) -> str: ...
def file_open(name: str, mode: str = ..., filter_ext: tuple[str, ...] | None = ...) -> IO: ... def file_open(
name: str, mode: str = ..., filter_ext: tuple[str, ...] | None = ...
) -> IO: ...
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]: ...
@@ -74,7 +97,9 @@ 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(
n: int, iterable: Iterable[_T], piece_maker: Callable[[Iterable[_T]], _T1] = ...
) -> Iterator[_T1]: ...
raise_error: object raise_error: object
@@ -91,7 +116,12 @@ class mute_logger(Handler):
old_params: dict[str, tuple[list[Handler], bool]] old_params: dict[str, tuple[list[Handler], bool]]
def __init__(self, *loggers: str) -> None: ... def __init__(self, *loggers: str) -> None: ...
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: ...
def emit(self, record: LogRecord) -> None: ... def emit(self, record: LogRecord) -> None: ...
@@ -103,7 +133,12 @@ class lower_logging(Handler):
to_level: int | None to_level: int | None
def __init__(self, max_level: int, to_level: int | None = ...) -> None: ... def __init__(self, max_level: int, to_level: int | None = ...) -> None: ...
def __enter__(self: _LowerLoggingT) -> _LowerLoggingT: ... def __enter__(self: _LowerLoggingT) -> _LowerLoggingT: ...
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 emit(self, record: LogRecord) -> None: ... def emit(self, record: LogRecord) -> None: ...
_ph: Any _ph: Any
@@ -120,14 +155,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]: ...
@@ -150,7 +187,7 @@ class Collector(dict[_KT, tuple[_T]]):
def discard_keys_and_values(self, excludes: Collection): ... def discard_keys_and_values(self, excludes: Collection): ...
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): ...
@@ -163,7 +200,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: ...
@@ -179,7 +216,7 @@ class LastOrderedSet(OrderedSet):
def add(self, elem) -> None: ... def add(self, elem) -> None: ...
class Callbacks: class Callbacks:
__slots__ = ['_funcs', 'data'] __slots__ = ["_funcs", "data"]
_funcs: deque _funcs: deque
data: dict data: dict
def __init__(self) -> None: ... def __init__(self) -> None: ...
@@ -188,18 +225,20 @@ class Callbacks:
def clear(self) -> None: ... def clear(self) -> None: ...
class ReversedIterable(Generic[_T]): class ReversedIterable(Generic[_T]):
__slots__ = ['iterable'] __slots__ = ["iterable"]
iterable: Iterable[_T] iterable: Iterable[_T]
def __init__(self, iterable: Iterable[_T]) -> None: ... def __init__(self, iterable: Iterable[_T]) -> None: ...
def __iter__(self) -> Iterator[_T]: ... def __iter__(self) -> Iterator[_T]: ...
def __reversed__(self) -> Iterator[_T]: ... def __reversed__(self) -> Iterator[_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]: ...
def submap(mapping: Mapping[_KT, _VT], keys: Iterable[_KT]) -> dict[_KT, _VT]: ... def submap(mapping: Mapping[_KT, _VT], keys: Iterable[_KT]) -> dict[_KT, _VT]: ...
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: ...
@@ -220,21 +259,50 @@ class replace_exceptions(ContextDecorator):
html_escape = markupsafe.escape html_escape = markupsafe.escape
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 = ...,
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_decimalized_number(number: float, decimal: int = ...) -> str: ... def format_decimalized_number(number: float, decimal: int = ...) -> str: ...
def format_decimalized_amount(amount: float, currency: 'odoo.model.res_currency | None' = ...) -> str: ... def format_decimalized_amount(
def format_amount(env: Environment, amount: float, currency: 'odoo.model.res_currency', lang_code: str = ...) -> str: ... amount: float, currency: "odoo.model.res_currency | None" = ...
) -> str: ...
def format_amount(
env: Environment,
amount: float,
currency: "odoo.model.res_currency",
lang_code: str = ...,
) -> str: ...
def format_duration(value: float) -> str: ... def format_duration(value: float) -> str: ...
consteq: Callable[[str, str], bool] consteq: Callable[[str, str], bool]
@@ -243,18 +311,24 @@ _PICKLE_SAFE_NAMES: dict
class Unpickler(pickle_.Unpickler): class Unpickler(pickle_.Unpickler):
def find_class(self, module_name: str, name: str): ... def find_class(self, module_name: str, name: str): ...
def _pickle_load(stream: pickle_._ReadableFileobj, encoding: str = ..., errors: bool = ...): ... def _pickle_load(
stream: pickle_._ReadableFileobj, encoding: str = ..., errors: bool = ...
): ...
pickle: ModuleType pickle: ModuleType
class DotDict(dict): class DotDict(dict):
def __getattr__(self, attrib): ... def __getattr__(self, attrib): ...
def get_diff(data_from: tuple[str, str], data_to: tuple[str, str], custom_style: bool = ...) -> str: ... def get_diff(
def hmac(env: Environment, scope, message, hash_function = ...) -> str: ... data_from: tuple[str, str], data_to: tuple[str, str], custom_style: bool = ...
) -> str: ...
def hmac(env: Environment, scope, message, hash_function=...) -> str: ...
ADDRESS_REGEX: Pattern ADDRESS_REGEX: Pattern
def street_split(street: str) -> dict[str, str]: ... def street_split(street: str) -> dict[str, str]: ...
def is_list_of(values: list | tuple, type_: type | tuple[type, ...]) -> bool: ... def is_list_of(values: list | tuple, type_: type | tuple[type, ...]) -> bool: ...
def has_list_types(values: list | tuple, types: Collection[type | tuple[type, ...]]) -> bool: ... def has_list_types(
values: list | tuple, types: Collection[type | tuple[type, ...]]
) -> bool: ...

View File

@@ -5,6 +5,11 @@ WINDOWS_RESERVED: Pattern
def clean_filename(name: str, replacement: str = ...) -> str: ... def clean_filename(name: str, replacement: str = ...) -> str: ...
def listdir(dir: str, recursive: bool = ...) -> Iterable[str]: ... def listdir(dir: str, recursive: bool = ...) -> Iterable[str]: ...
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: ...
is_running_as_nt_service: Callable[[], bool] is_running_as_nt_service: Callable[[], bool]

View File

@@ -3,7 +3,8 @@ from re import Pattern
from typing import Any, BinaryIO, Iterable from typing import Any, BinaryIO, 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
@@ -14,12 +15,18 @@ def _unwrapping_get(self, key, default: Any | None = ...): ...
class BrandedFileWriter(PdfFileWriter): class BrandedFileWriter(PdfFileWriter):
def __init__(self) -> None: ... def __init__(self) -> None: ...
PdfFileWriter = BrandedFileWriter PdfFileWriter = BrandedFileWriter
def merge_pdf(pdf_data: Iterable[bytes]) -> bytes: ... def merge_pdf(pdf_data: Iterable[bytes]) -> bytes: ...
def rotate_pdf(pdf: bytes) -> bytes: ... def rotate_pdf(pdf: bytes) -> bytes: ...
def to_pdf_stream(attachment: 'odoo.model.ir_attachment') -> BytesIO: ... def to_pdf_stream(attachment: "odoo.model.ir_attachment") -> BytesIO: ...
def add_banner(pdf_stream: str | BinaryIO, text: str | None = ..., logo: bool = ..., thickness: float = ...) -> BytesIO: ... def add_banner(
pdf_stream: str | BinaryIO,
text: str | None = ...,
logo: bool = ...,
thickness: float = ...,
) -> BytesIO: ...
class OdooPdfFileReader(PdfFileReader): class OdooPdfFileReader(PdfFileReader):
def getAttachments(self) -> Iterable[tuple[Any, Any]]: ... def getAttachments(self) -> Iterable[tuple[Any, Any]]: ...
@@ -29,10 +36,15 @@ class OdooPdfFileWriter(PdfFileWriter):
is_pdfa: bool is_pdfa: bool
_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 = ...) -> None: ... def addAttachment(self, fname: str, fdata, subtype: str | None = ...) -> None: ...
def embed_odoo_attachment(self, attachment: 'odoo.model.ir_attachment', subtype: str | None = ...) -> None: ... def embed_odoo_attachment(
self, attachment: "odoo.model.ir_attachment", subtype: str | None = ...
) -> 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

@@ -6,21 +6,51 @@ from dateutil.relativedelta import relativedelta
from ..tools import pycompat as pycompat from ..tools import pycompat as pycompat
_T = TypeVar('_T') _T = TypeVar("_T")
def Random(seed) -> random.Random: ... def Random(seed) -> random.Random: ...
def format_str(val: _T, counter, values) -> _T: ... def format_str(val: _T, counter, values) -> _T: ...
def chain_factories(field_factories: Iterable[tuple[str, Callable[..., Iterator]]], model_name: str) -> Iterator: ... def chain_factories(
field_factories: Iterable[tuple[str, Callable[..., Iterator]]], model_name: str
) -> Iterator: ...
def root_factory() -> Iterator[dict]: ... def root_factory() -> Iterator[dict]: ...
def randomize(vals: Sequence, weights: Sequence | None = ..., seed: Any = ..., formatter: Callable[[Any, Any, Any], Any] = ..., def randomize(
counter_offset: int = ...) -> Callable[[Iterable, str, str], dict]: ... vals: Sequence,
def cartesian(vals: Sequence, weights: Sequence | None = ..., seed: Any = ..., formatter: Callable[[Any, Any, Any], Any] = ..., weights: Sequence | None = ...,
then: Callable[[Iterable, str, str], dict] | None = ...) -> Callable[[Iterable, str, str], Iterator[dict]]: ... seed: Any = ...,
def iterate(vals: Sequence, weights: Sequence | None = ..., seed: Any = ..., formatter: Callable[[Any, Any, Any], Any] = ..., formatter: Callable[[Any, Any, Any], Any] = ...,
then: Callable[[Iterable, str, str], dict] | None = ...) -> Callable[[Iterable, str, str], Iterator[dict]]: ... counter_offset: int = ...,
def constant(val: Sequence, formatter: Callable[[Any, Any, Any], Any] = ...) -> Callable[[Iterable, str, str], Iterator[dict]]: ... ) -> Callable[[Iterable, str, str], dict]: ...
def compute(function: Callable[[Any, Any, Any], Any], seed: Any | None = ...) -> Callable[[Iterable, str, str], Iterator[dict]]: ... def cartesian(
def randint(a: int, b: int, seed: Any | None = ...) -> Callable[[Iterable, str, str], Iterator[dict]]: ... vals: Sequence,
def randfloat(a: float, b: float, seed: Any | None = ...) -> Callable[[Iterable, str, str], Iterator[dict]]: ... weights: Sequence | None = ...,
def randdatetime(*, base_date: datetime.datetime | None = ..., relative_before: datetime.timedelta | relativedelta | None = ..., seed: Any = ...,
relative_after: datetime.timedelta | relativedelta | None = ..., seed: Any | None = ...) -> Callable[[Iterable, str, str], Iterator[dict]]: ... formatter: Callable[[Any, Any, Any], Any] = ...,
then: Callable[[Iterable, str, str], dict] | None = ...,
) -> Callable[[Iterable, str, str], Iterator[dict]]: ...
def iterate(
vals: Sequence,
weights: Sequence | None = ...,
seed: Any = ...,
formatter: Callable[[Any, Any, Any], Any] = ...,
then: Callable[[Iterable, str, str], dict] | None = ...,
) -> Callable[[Iterable, str, str], Iterator[dict]]: ...
def constant(
val: Sequence, formatter: Callable[[Any, Any, Any], Any] = ...
) -> Callable[[Iterable, str, str], Iterator[dict]]: ...
def compute(
function: Callable[[Any, Any, Any], Any], seed: Any | None = ...
) -> Callable[[Iterable, str, str], Iterator[dict]]: ...
def randint(
a: int, b: int, seed: Any | None = ...
) -> Callable[[Iterable, str, str], Iterator[dict]]: ...
def randfloat(
a: float, b: float, seed: Any | None = ...
) -> Callable[[Iterable, str, str], Iterator[dict]]: ...
def randdatetime(
*,
base_date: datetime.datetime | None = ...,
relative_before: datetime.timedelta | relativedelta | None = ...,
relative_after: datetime.timedelta | relativedelta | None = ...,
seed: Any | None = ...
) -> Callable[[Iterable, str, str], Iterator[dict]]: ...

View File

@@ -5,7 +5,7 @@ from typing import Any, Callable, ContextManager, Generic, Iterable, TypeVar
from ..sql_db import Cursor from ..sql_db import Cursor
_T = TypeVar('_T') _T = TypeVar("_T")
real_datetime_now: Callable[..., datetime] real_datetime_now: Callable[..., datetime]
real_time: Callable[[], float] real_time: Callable[[], float]
@@ -13,7 +13,9 @@ real_time: Callable[[], float]
def _format_frame(frame: FrameType) -> tuple[str, int, str, str]: ... def _format_frame(frame: FrameType) -> tuple[str, int, str, str]: ...
def _format_stack(stack: Iterable) -> list[list]: ... def _format_stack(stack: Iterable) -> list[list]: ...
def get_current_frame(thread: Thread | None = ...) -> FrameType: ... def get_current_frame(thread: Thread | None = ...) -> FrameType: ...
def _get_stack_trace(frame: FrameType, limit_frame: FrameType | None = ...) -> list[tuple[str, int, str, str]]: ... def _get_stack_trace(
frame: FrameType, limit_frame: FrameType | None = ...
) -> list[tuple[str, int, str, str]]: ...
def stack_size() -> int: ... def stack_size() -> int: ...
def make_session(name: str = ...) -> str: ... def make_session(name: str = ...) -> str: ...
def force_hook() -> None: ... def force_hook() -> None: ...
@@ -32,7 +34,9 @@ class Collector:
def start(self) -> None: ... def start(self) -> None: ...
def stop(self) -> None: ... def stop(self) -> None: ...
def add(self, entry: dict | None = ..., frame: FrameType | None = ...) -> None: ... def add(self, entry: dict | None = ..., frame: FrameType | None = ...) -> None: ...
def _get_stack_trace(self, frame: FrameType | None = ...) -> list[tuple[str, int, str, str]]: ... def _get_stack_trace(
self, frame: FrameType | None = ...
) -> list[tuple[str, int, str, str]]: ...
def post_process(self) -> None: ... def post_process(self) -> None: ...
@property @property
def entries(self) -> list[dict]: ... def entries(self) -> list[dict]: ...
@@ -110,9 +114,15 @@ class Profiler:
profile_id: Any profile_id: Any
db: str | None db: str | None
collectors: list[Collector] collectors: list[Collector]
def __init__(self, collectors: list[str | Collector] | None = ..., db: str | None = ..., def __init__(
profile_session: Any | None = ..., description: str | None = ..., disable_gc: bool = ..., self,
params: Any | None = ...) -> None: ... collectors: list[str | Collector] | None = ...,
db: str | None = ...,
profile_session: Any | None = ...,
description: str | None = ...,
disable_gc: bool = ...,
params: Any | None = ...,
) -> None: ...
def __enter__(self: _T) -> _T: ... def __enter__(self: _T) -> _T: ...
def __exit__(self, *args) -> None: ... def __exit__(self, *args) -> None: ...
def _add_file_lines(self, stack: list[tuple[str, int, str, str]]) -> None: ... def _add_file_lines(self, stack: list[tuple[str, int, str, str]]) -> None: ...
@@ -123,6 +133,8 @@ class Profiler:
class Nested(Generic[_T]): class Nested(Generic[_T]):
profiler: Profiler profiler: Profiler
context_manager: ContextManager[_T] context_manager: ContextManager[_T]
def __init__(self, profiler: Profiler, context_manager: ContextManager[_T]) -> None: ... def __init__(
self, profiler: Profiler, context_manager: ContextManager[_T]
) -> None: ...
def __enter__(self) -> _T: ... def __enter__(self) -> _T: ...
def __exit__(self, exc_type, exc_value, traceback): ... def __exit__(self, exc_type, exc_value, traceback): ...

View File

@@ -20,9 +20,37 @@ class Query:
def __init__(self, cr: Cursor, alias: str, table: str | None = ...) -> None: ... def __init__(self, cr: Cursor, alias: str, table: str | None = ...) -> None: ...
def add_table(self, alias: str, table: str | None = ...) -> None: ... def add_table(self, alias: str, table: str | None = ...) -> None: ...
def add_where(self, where_clause: str, where_params: Iterable = ...) -> None: ... def add_where(self, where_clause: str, where_params: Iterable = ...) -> None: ...
def join(self, lhs_alias: str, lhs_column: str, rhs_table: str, rhs_column: str, link: str, extra: str | None = ..., extra_params: tuple = ...) -> str: ... def join(
def left_join(self, lhs_alias: str, lhs_column: str, rhs_table: str, rhs_column: str, link: str, extra: str | None = ..., extra_params: tuple = ...) -> str: ... self,
def _join(self, kind: str, lhs_alias: str, lhs_column: str, rhs_table: str, rhs_column: str, link: str, extra: str | None = ..., extra_params: tuple = ...) -> str: ... lhs_alias: str,
lhs_column: str,
rhs_table: str,
rhs_column: str,
link: str,
extra: str | None = ...,
extra_params: tuple = ...,
) -> str: ...
def left_join(
self,
lhs_alias: str,
lhs_column: str,
rhs_table: str,
rhs_column: str,
link: str,
extra: str | None = ...,
extra_params: tuple = ...,
) -> str: ...
def _join(
self,
kind: str,
lhs_alias: str,
lhs_column: str,
rhs_table: str,
rhs_column: str,
link: str,
extra: str | None = ...,
extra_params: tuple = ...,
) -> str: ...
def select(self, *args) -> tuple[str, list]: ... def select(self, *args) -> tuple[str, list]: ...
def subselect(self, *args) -> tuple[str, list]: ... def subselect(self, *args) -> tuple[str, list]: ...
def get_sql(self) -> tuple[str, str, list]: ... def get_sql(self) -> tuple[str, str, list]: ...
@@ -38,4 +66,11 @@ class Query:
def where_clause(self) -> tuple[str, ...]: ... def where_clause(self) -> tuple[str, ...]: ...
@property @property
def where_clause_params(self) -> tuple: ... def where_clause_params(self) -> tuple: ...
def add_join(self, connection, implicit: bool = ..., outer: bool = ..., extra: str | None = ..., extra_params: tuple = ...) -> tuple[str, str]: ... def add_join(
self,
connection,
implicit: bool = ...,
outer: bool = ...,
extra: str | None = ...,
extra_params: tuple = ...,
) -> tuple[str, str]: ...

View File

@@ -11,4 +11,6 @@ template_env_globals: dict[str, Any]
def parse_inline_template(text: str) -> list[tuple[str, str]]: ... def parse_inline_template(text: str) -> list[tuple[str, str]]: ...
def convert_inline_template_to_qweb(template: str) -> Markup: ... def convert_inline_template_to_qweb(template: str) -> Markup: ...
def render_inline_template(template_instructions: Iterable[tuple[str, str]], variables: dict) -> str: ... def render_inline_template(
template_instructions: Iterable[tuple[str, str]], variables: dict
) -> str: ...

View File

@@ -1,12 +1,15 @@
from opcode import HAVE_ARGUMENT as HAVE_ARGUMENT
from types import CodeType from types import CodeType
from typing import Any, Iterable, Iterator, Literal from typing import Any, Iterable, 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]
def to_opcodes(opnames: Iterable[str], _opmap: dict[str, int] =...) -> Iterator[int]: ... def to_opcodes(
opnames: Iterable[str], _opmap: dict[str, int] = ...
) -> Iterator[int]: ...
_BLACKLIST: set[int] _BLACKLIST: set[int]
_CONST_OPCODES: set[int] _CONST_OPCODES: set[int]
@@ -15,16 +18,33 @@ _EXPR_OPCODES: set[int]
_SAFE_OPCODES: set[int] _SAFE_OPCODES: set[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(
def test_expr(expr: str, allowed_codes: set[int], mode: str = ..., filename: str | None = ...): ... allowed_codes: set[int], code_obj: CodeType, expr: str
) -> None: ...
def test_expr(
expr: str, allowed_codes: set[int], mode: str = ..., filename: str | None = ...
): ...
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 = ..., filename: str | None = ...): ... expr: str,
globals_dict: dict | None = ...,
locals_dict: dict | None = ...,
mode: str = ...,
nocopy: bool = ...,
locals_builtins: bool = ...,
filename: str | None = ...,
): ...
def test_python_expr(expr: str, mode: str = ...) -> str | Literal[False]: ... def test_python_expr(expr: str, mode: str = ...) -> str | Literal[False]: ...
def check_values(d: dict): ... def check_values(d: dict): ...

View File

@@ -12,7 +12,13 @@ class SourceMapGenerator:
def _serialize_mappings(self) -> str: ... def _serialize_mappings(self) -> str: ...
def to_json(self) -> dict: ... def to_json(self) -> dict: ...
def get_content(self) -> bytes: ... def get_content(self) -> bytes: ...
def add_source(self, source_name: str, source_content: str, last_index: int, start_offset: int = ...) -> None: ... def add_source(
self,
source_name: str,
source_content: str,
last_index: int,
start_offset: int = ...,
) -> None: ...
B64CHARS: bytes B64CHARS: bytes
SHIFTSIZE: int SHIFTSIZE: int

View File

@@ -1,7 +1,7 @@
from reprlib import Repr from reprlib import Repr
from typing import Any, Callable, Iterable, Sequence, TypeVar from typing import Any, Callable, Iterable, Sequence, TypeVar
_SpeedscopeT = TypeVar('_SpeedscopeT', bound=Speedscope) _SpeedscopeT = TypeVar("_SpeedscopeT", bound=Speedscope)
shortener: Repr shortener: Repr
shorten: Callable[[Any], str] shorten: Callable[[Any], str]
@@ -16,14 +16,30 @@ class Speedscope:
frames_indexes: dict[Any, int] frames_indexes: dict[Any, int]
frame_count: int frame_count: int
profiles: list profiles: list
def __init__(self, name: str = ..., init_stack_trace: list | None = ...) -> None: ... def __init__(
self, name: str = ..., init_stack_trace: list | None = ...
) -> None: ...
def add(self, key, profile) -> None: ... def add(self, key, profile) -> None: ...
def convert_stack(self, stack: list[Sequence]) -> None: ... def convert_stack(self, stack: list[Sequence]) -> None: ...
def add_output(self: _SpeedscopeT, names: Iterable[str], complete: bool = ..., display_name: str | None = ..., def add_output(
use_context: bool = ..., **params) -> _SpeedscopeT: ... self: _SpeedscopeT,
names: Iterable[str],
complete: bool = ...,
display_name: str | None = ...,
use_context: bool = ...,
**params
) -> _SpeedscopeT: ...
def add_default(self: _SpeedscopeT) -> _SpeedscopeT: ... def add_default(self: _SpeedscopeT) -> _SpeedscopeT: ...
def make(self) -> dict: ... def make(self) -> dict: ...
def get_frame_id(self, frame) -> int: ... def get_frame_id(self, frame) -> int: ...
def stack_to_ids(self, stack: list, context: Iterable[tuple[int, dict]], stack_offset: int = ...) -> list[int]: ... def stack_to_ids(
def process(self, entries: list[dict], continuous: bool = ..., hide_gaps: bool = ..., use_context: bool = ..., self, stack: list, context: Iterable[tuple[int, dict]], stack_offset: int = ...
constant_time: bool = ...) -> list[dict]: ... ) -> list[int]: ...
def process(
self,
entries: list[dict],
continuous: bool = ...,
hide_gaps: bool = ...,
use_context: bool = ...,
constant_time: bool = ...,
) -> list[dict]: ...

View File

@@ -12,28 +12,78 @@ def table_kind(cr: Cursor, tablename: str) -> str | None: ...
SQL_ORDER_BY_TYPE: defaultdict SQL_ORDER_BY_TYPE: defaultdict
def create_model_table(cr: Cursor, tablename: str, comment: str | None = ..., columns: Iterable = ...) -> None: ... def create_model_table(
cr: Cursor, tablename: str, comment: str | None = ..., columns: Iterable = ...
) -> 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,
def convert_column_translatable(cr: Cursor, tablename: str, columnname: str, columntype: str) -> None: ... columnname: str,
def _convert_column(cr: Cursor, tablename: str, columnname: str, columntype: str, using: str) -> None: ... 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 convert_column_translatable(
cr: Cursor, tablename: str, columnname: str, columntype: str
) -> None: ...
def _convert_column(
cr: Cursor, tablename: str, columnname: str, columntype: str, using: str
) -> None: ...
def drop_depending_views(cr: Cursor, table: str, column: str) -> None: ... def drop_depending_views(cr: Cursor, table: str, column: str) -> None: ...
def get_depending_views(cr: Cursor, table: str, column: str): ... def get_depending_views(cr: Cursor, table: str, column: str): ...
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 get_foreign_keys(cr: Cursor, tablename1: str, columnname1: str, tablename2: str, columnname2: str, ondelete) -> list[str]: ... cr: Cursor,
def fix_foreign_key(cr: Cursor, tablename1: str, columnname1: str, tablename2: str, columnname2: str, ondelete) -> list[str]: ... tablename1: str,
columnname1: str,
tablename2: str,
columnname2: str,
ondelete,
) -> Literal[True]: ...
def get_foreign_keys(
cr: Cursor,
tablename1: str,
columnname1: str,
tablename2: str,
columnname2: str,
ondelete,
) -> list[str]: ...
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 check_index_exist(cr: Cursor, indexname: str) -> None: ... def check_index_exist(cr: Cursor, indexname: str) -> None: ...
def create_index(cr: Cursor, indexname: str, tablename: str, expressions: Iterable[str], method: str = ..., where: 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],
method: str = ...,
where: 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

@@ -5,9 +5,15 @@ from lxml.etree import _Element
RSTRIP_REGEXP: Pattern RSTRIP_REGEXP: Pattern
def add_stripped_items_before(node: _Element, spec: _Element, extract: Callable[[_Element], _Element]) -> None: ... def add_stripped_items_before(
node: _Element, spec: _Element, extract: Callable[[_Element], _Element]
) -> None: ...
def add_text_before(node: _Element, text: str | None) -> None: ... def add_text_before(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

@@ -3,16 +3,16 @@ from collections import defaultdict, namedtuple
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, IO, Iterable, Iterator, NoReturn from typing import IO, Any, BinaryIO, Callable, 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 ..api import Environment from ..api import Environment
from ..fields import Field from ..fields import Field
from ..models import BaseModel from ..models import BaseModel
from ..sql_db import Connection, Cursor from ..sql_db import Connection, Cursor
from .pycompat import _CsvWriter
PYTHON_TRANSLATION_COMMENT: str PYTHON_TRANSLATION_COMMENT: str
JAVASCRIPT_TRANSLATION_COMMENT: str JAVASCRIPT_TRANSLATION_COMMENT: str
@@ -32,8 +32,12 @@ def translate_attrib_value(node: _Element) -> bool: ...
avoid_pattern: Pattern avoid_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: ...
@@ -50,14 +54,16 @@ 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, *args, **kwargs) -> str: ... def __call__(self, source: str, *args, **kwargs) -> str: ...
def _get_translation(self, source: str, module: str | None = ...) -> str: ... def _get_translation(self, source: str, module: str | None = ...) -> str: ...
class _lt: class _lt:
__slots__ = ['_source', '_args', '_module'] __slots__ = ["_source", "_args", "_module"]
_source: str _source: str
_args: tuple _args: tuple
_module: str _module: str
@@ -77,7 +83,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
@@ -90,7 +98,9 @@ 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 = ...) -> CSVFileWriter | PoFileWriter | TarFileWriter: ... def TranslationFileWriter(
target, fileformat: str = ..., lang: str | None = ...
) -> CSVFileWriter | PoFileWriter | TarFileWriter: ...
class CSVFileWriter: class CSVFileWriter:
writer: _CsvWriter writer: _CsvWriter
@@ -103,7 +113,9 @@ class PoFileWriter:
po: POFile po: POFile
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 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
@@ -111,14 +123,20 @@ 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 _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 _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 extract_formula_terms(formula: str) -> Iterator[str]: ... def extract_formula_terms(formula: str) -> Iterator[str]: ...
def extract_spreadsheet_terms(fileobj, keywords, comment_tags, options) -> Iterator[tuple[int, str, str, list]]: ... def extract_spreadsheet_terms(
fileobj, keywords, comment_tags, options
) -> Iterator[tuple[int, str, str, list]]: ...
ImdInfo = namedtuple('ExternalId', ['name', 'model', 'res_id', 'module']) ImdInfo = namedtuple("ExternalId", ["name", "model", "res_id", "module"])
class TranslationModuleReader: class TranslationModuleReader:
_cr: Cursor _cr: Cursor
@@ -128,16 +146,39 @@ class TranslationModuleReader:
_to_translate: list[tuple] _to_translate: list[tuple]
_path_list: list[tuple[str, Any]] _path_list: list[tuple[str, Any]]
_installed_modules: list[str] _installed_modules: list[str]
def __init__(self, cr: Cursor, modules: list[str] | None = ..., lang: str | None = ...) -> None: ... def __init__(
self, cr: Cursor, modules: list[str] | None = ..., lang: str | None = ...
) -> None: ...
def __iter__(self) -> Iterable[tuple]: ... def __iter__(self) -> Iterable[tuple]: ...
def _push_translation(self, module: str, ttype: str, name: str, res_id: str, source: str, def _push_translation(
comments: Iterable[str] | None = ..., record_id: int | None = ..., value: Any | None = ...) -> None: ... self,
def _get_translatable_records(self, imd_records: Iterable[ImdInfo]) -> BaseModel: ... module: str,
ttype: str,
name: str,
res_id: str,
source: str,
comments: Iterable[str] | None = ...,
record_id: int | None = ...,
value: Any | None = ...,
) -> None: ...
def _get_translatable_records(
self, imd_records: Iterable[ImdInfo]
) -> BaseModel: ...
def _export_translatable_records(self) -> None: ... def _export_translatable_records(self) -> None: ...
def _get_module_from_path(self, path: str) -> str: ... def _get_module_from_path(self, path: str) -> str: ...
def _verified_module_filepaths(self, fname: str, path: str, root: str) -> tuple[str | None, str | None, str | None, str | None]: ... def _verified_module_filepaths(
def _babel_extract_terms(self, fname: str, path: str, root: str, extract_method: str = ..., trans_type: str = ..., self, fname: str, path: str, root: str
extra_comments: list[str] | None = ..., extract_keywords: dict = ...) -> None: ... ) -> tuple[str | None, str | None, str | None, str | None]: ...
def _babel_extract_terms(
self,
fname: str,
path: str,
root: str,
extract_method: str = ...,
trans_type: str = ...,
extra_comments: list[str] | None = ...,
extract_keywords: dict = ...,
) -> None: ...
def _export_translatable_resources(self) -> None: ... def _export_translatable_resources(self) -> None: ...
def DeepDefaultDict() -> defaultdict: ... def DeepDefaultDict() -> defaultdict: ...
@@ -146,16 +187,37 @@ class TranslationImporter:
cr: Cursor cr: Cursor
verbose: bool verbose: bool
env: Environment env: Environment
model_translations: defaultdict[str, defaultdict[str, defaultdict[str, defaultdict]]] model_translations: defaultdict[
model_terms_translations: defaultdict[str, defaultdict[str, defaultdict[str, defaultdict]]] str, defaultdict[str, defaultdict[str, defaultdict]]
]
model_terms_translations: defaultdict[
str, defaultdict[str, defaultdict[str, defaultdict]]
]
def __init__(self, cr: Cursor, verbose: bool = ...) -> None: ... def __init__(self, cr: Cursor, verbose: bool = ...) -> None: ...
def load_file(self, filepath: str, lang: str, xmlids: Iterable[str] | None = ...) -> None: ... def load_file(
def load(self, fileobj: IO, fileformat: str, lang: str, xmlids: Iterable[str] | None = ...) -> None: ... self, filepath: str, lang: str, xmlids: Iterable[str] | None = ...
) -> None: ...
def load(
self,
fileobj: IO,
fileformat: str,
lang: str,
xmlids: Iterable[str] | None = ...,
) -> None: ...
def _load(self, reader, lang: str, xmlids: Iterable[str] | None = ...) -> None: ... def _load(self, reader, lang: str, xmlids: Iterable[str] | None = ...) -> None: ...
def save(self, overwrite: bool = ..., force_overwrite: bool = ...) -> None: ... def save(self, overwrite: bool = ..., force_overwrite: bool = ...) -> None: ...
def trans_load(cr: Cursor, filepath: str, lang: str, verbose: bool = ..., overwrite: bool = ...) -> None: ... def trans_load(
def trans_load_data(cr: Cursor, fileobj: IO, fileformat: str, lang: str, verbose: bool = ..., overwrite: bool = ...) -> None: ... cr: Cursor, filepath: str, lang: str, verbose: bool = ..., overwrite: bool = ...
) -> None: ...
def trans_load_data(
cr: Cursor,
fileobj: IO,
fileformat: str,
lang: str,
verbose: bool = ...,
overwrite: bool = ...,
) -> 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: ...
@@ -169,7 +231,9 @@ class CodeTranslations:
@staticmethod @staticmethod
def _read_code_translations_file(fileobj: IO, filter_func: Callable) -> dict: ... def _read_code_translations_file(fileobj: IO, filter_func: Callable) -> dict: ...
@staticmethod @staticmethod
def _get_code_translations(module_name: str, lang: str, filter_func: Callable) -> dict: ... def _get_code_translations(
module_name: str, lang: str, filter_func: Callable
) -> dict: ...
def _load_python_translations(self, module_name: str, lang: str): ... def _load_python_translations(self, module_name: str, lang: str): ...
def _load_web_translations(self, module_name: str, lang: str): ... def _load_web_translations(self, module_name: str, lang: str): ...
def get_python_translations(self, module_name: str, lang: str) -> dict: ... def get_python_translations(self, module_name: str, lang: str) -> dict: ...

View File

@@ -5,7 +5,7 @@ from typing import Callable, TypeVar
from lxml.etree import RelaxNG, _Element from lxml.etree import RelaxNG, _Element
_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]

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, Callable, Iterable, Literal
from lxml import etree from lxml import etree
from lxml.etree import _Element from lxml.etree import _Element
from typing import Callable, IO, Iterable, Literal
from ..api import Environment from ..api import Environment
@@ -10,13 +11,41 @@ class odoo_resolver(etree.Resolver):
def __init__(self, env: Environment, prefix: str | None) -> None: ... def __init__(self, env: Environment, prefix: str | None) -> 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 = ..., prefix: str | 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,
def create_xml_node(parent_node: _Element, node_name: str, node_value: str | None = ...) -> _Element: ... stream: str | IO,
def cleanup_xml_node(xml_node_or_string: _Element | str, remove_blank_text: bool = ..., remove_blank_nodes: bool = ..., env: Environment | None = ...,
indent_level: int = ..., indent_space: str = ...) -> _Element: ... prefix: str | None = ...,
def load_xsd_files_from_url(env: Environment, url: str, file_name: str | None = ..., force_reload: bool = ..., request_max_timeout: int = ..., ) -> None: ...
xsd_name_prefix: str = ..., xsd_names_filter: str | list[str] | None = ..., def create_xml_node_chain(
modify_xsd_content: Callable[[bytes], bytes] | None = ...) -> 'odoo.model.ir_attachment | Literal[False]': ... first_parent_node: _Element,
def validate_xml_from_attachment(env: Environment, xml_content, xsd_name: str, reload_files_function: Callable | None = ..., nodes_list: Iterable[str],
prefix: str | None = ...) -> None: ... 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: ...
def load_xsd_files_from_url(
env: Environment,
url: str,
file_name: str | None = ...,
force_reload: bool = ...,
request_max_timeout: int = ...,
xsd_name_prefix: str = ...,
xsd_names_filter: str | list[str] | None = ...,
modify_xsd_content: Callable[[bytes], bytes] | None = ...,
) -> "odoo.model.ir_attachment | Literal[False]": ...
def validate_xml_from_attachment(
env: Environment,
xml_content,
xsd_name: str,
reload_files_function: Callable | None = ...,
prefix: str | None = ...,
) -> None: ...