This commit is contained in:
Trinh Anh Ngoc
2023-05-19 10:50:36 +07:00
parent 37365a8a1c
commit 32f840613a
47 changed files with 60 additions and 900 deletions

View File

@@ -1,5 +1,3 @@
from psycopg2 import connection
from . import addons as addons from . import addons as addons
from . import api as api from . import api as api
from . import conf as conf from . import conf as conf
@@ -19,13 +17,7 @@ from .tools.translate import _ as _
from .tools.translate import _lt as _lt from .tools.translate import _lt as _lt
evented: bool evented: bool
def gevent_wait_callback(conn: connection, timeout: float | None = ...) -> None: ...
multi_process: bool multi_process: bool
def _decompress(data: bytes) -> bytes: ...
SUPERUSER_ID: int SUPERUSER_ID: int
def registry(database_name: str | None = ...) -> Registry: ... def registry(database_name: str | None = ...) -> Registry: ...

View File

@@ -7,7 +7,6 @@ from typing import (
Iterable, Iterable,
Iterator, Iterator,
KeysView, KeysView,
Literal,
Mapping, Mapping,
Optional, Optional,
Sequence, Sequence,
@@ -16,11 +15,14 @@ from typing import (
) )
from weakref import WeakSet from weakref import WeakSet
from odoo.addons.base.models.res_company import Company
from odoo.addons.base.models.res_users import Users
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, StackMap, frozendict from .tools import StackMap, frozendict
_T = TypeVar("_T") _T = TypeVar("_T")
_ModelT = TypeVar("_ModelT", bound=BaseModel) _ModelT = TypeVar("_ModelT", bound=BaseModel)
@@ -32,7 +34,6 @@ class Params:
args: tuple args: tuple
kwargs: dict kwargs: dict
def __init__(self, args: tuple, kwargs: dict) -> None: ... def __init__(self, args: tuple, kwargs: dict) -> None: ...
def __str__(self) -> str: ...
class Meta(type): class Meta(type):
def __new__(meta, name: str, bases: tuple, attrs: dict): ... def __new__(meta, name: str, bases: tuple, attrs: dict): ...
@@ -53,19 +54,8 @@ 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(
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(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_create(
method: Callable[..., _ModelT], self: _ModelT, args, kwargs
) -> list[int] | int | Literal[False]: ...
def _call_kw_multi(method: Callable[..., _ModelT], self: _ModelT, args, kwargs): ...
def call_kw(model: BaseModel, name: str, args, kwargs): ... def call_kw(model: BaseModel, name: str, args, kwargs): ...
class Environment(Mapping[str, BaseModel]): class Environment(Mapping[str, BaseModel]):
@@ -79,8 +69,6 @@ class Environment(Mapping[str, BaseModel]):
transaction: Transaction transaction: Transaction
registry: Registry registry: Registry
cache: Cache cache: Cache
_cache_key: dict[Field, Any]
_protected: StackMap[Field, set[int]]
def __new__( def __new__(
cls, cr: Cursor, uid: int | None, context: dict, su: bool = ... cls, cr: Cursor, uid: int | None, context: dict, su: bool = ...
) -> Environment: ... ) -> Environment: ...
@@ -94,7 +82,7 @@ class Environment(Mapping[str, BaseModel]):
def __call__( def __call__(
self, self,
cr: Cursor | None = ..., cr: Cursor | None = ...,
user: Union["odoo.model.res_users", int, None] = ..., user: "Union[Users, int, None]" = ...,
context: dict | None = ..., context: dict | None = ...,
su: bool | None = ..., su: bool | None = ...,
) -> Environment: ... ) -> Environment: ...
@@ -105,16 +93,15 @@ class Environment(Mapping[str, BaseModel]):
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) -> "Users": ...
@property @property
def company(self) -> "odoo.model.res_company": ... def company(self) -> "Company": ...
@property @property
def companies(self) -> "odoo.model.res_company": ... def companies(self) -> "Company": ...
@property @property
def lang(self) -> str: ... def lang(self) -> str: ...
def clear(self) -> None: ... def clear(self) -> None: ...
def invalidate_all(self, flush: bool = ...) -> None: ... def invalidate_all(self, flush: bool = ...) -> None: ...
def _recompute_all(self) -> None: ...
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: ...
@@ -145,12 +132,7 @@ NOTHING: object
EMPTY_DICT: frozendict EMPTY_DICT: frozendict
class Cache: class Cache:
_data: defaultdict[Field, dict]
_dirty: defaultdict[Field, OrderedSet[int]]
def __init__(self) -> None: ... def __init__(self) -> None: ...
def __repr__(self) -> str: ...
def _get_field_cache(self, model: BaseModel, field: Field) -> dict: ...
def _set_field_cache(self, model: BaseModel, field: Field): ...
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=...): ...
@@ -203,4 +185,3 @@ class Cache:
class Starred: class Starred:
value: Any value: Any
def __init__(self, value) -> None: ... def __init__(self, value) -> None: ...
def __repr__(self) -> str: ...

View File

@@ -1,5 +1,3 @@
from typing import Any
from .fields import Field from .fields import Field
from .models import BaseModel from .models import BaseModel
@@ -18,7 +16,6 @@ class RedirectWarning(Exception):
def name(self): ... def name(self): ...
class AccessDenied(UserError): class AccessDenied(UserError):
__cause__: Any
traceback: tuple[str, str, str] traceback: tuple[str, str, str]
def __init__(self, message: str = ...) -> None: ... def __init__(self, message: str = ...) -> None: ...

View File

@@ -3,7 +3,6 @@ import enum
from typing import ( from typing import (
Any, Any,
Callable, Callable,
Collection,
Container, Container,
Generic, Generic,
Iterator, Iterator,
@@ -53,14 +52,6 @@ class Field(Generic[_FieldValueT], metaclass=MetaField):
column_type: tuple[str, str] | None column_type: tuple[str, str] | None
write_sequence: int write_sequence: int
args: dict[str, Any] | None args: dict[str, Any] | None
_module: str
_modules: tuple[str, ...]
_setup_done: bool
_sequence: int | None
_base_fields: tuple[Field, ...]
_extra_keys: tuple[str, ...]
_direct: bool
_toplevel: bool
automatic: bool automatic: bool
inherited: bool inherited: bool
inherited_field: Field | None inherited_field: Field | None
@@ -71,8 +62,6 @@ class Field(Generic[_FieldValueT], metaclass=MetaField):
index: str | bool | None index: str | bool | None
manual: bool manual: bool
copy: bool copy: bool
_depends: Collection[str] | None
_depends_context: Collection[str] | None
recursive: bool recursive: bool
compute: str | Callable | None compute: str | Callable | None
compute_sudo: bool compute_sudo: bool
@@ -99,59 +88,21 @@ class Field(Generic[_FieldValueT], metaclass=MetaField):
related_attrs: list[tuple[str, str]] related_attrs: list[tuple[str, str]]
description_attrs: list[tuple[str, str]] description_attrs: list[tuple[str, str]]
def __init__(self, string: str = ..., **kwargs) -> None: ... def __init__(self, string: str = ..., **kwargs) -> None: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def __set_name__(self, owner: Type[BaseModel], name: str) -> None: ... def __set_name__(self, owner: Type[BaseModel], name: str) -> None: ...
def _get_attrs(self, model_class: Type[BaseModel], name: str) -> dict[str, Any]: ...
def _setup_attrs(self, model_class: Type[BaseModel], name: str): ...
def prepare_setup(self) -> None: ... def prepare_setup(self) -> None: ...
def setup(self, model: BaseModel) -> None: ... def setup(self, model: BaseModel) -> None: ...
def setup_nonrelated(self, model: BaseModel) -> None: ... def setup_nonrelated(self, model: BaseModel) -> None: ...
def get_depends(self, model: BaseModel) -> tuple: ... def get_depends(self, model: BaseModel) -> tuple: ...
def setup_related(self, model: BaseModel) -> None: ... def setup_related(self, model: BaseModel) -> None: ...
def traverse_related(self, record: _ModelT) -> tuple[_ModelT, Field]: ... def traverse_related(self, record: _ModelT) -> tuple[_ModelT, Field]: ...
def _compute_related(self, records: BaseModel) -> None: ...
def _process_related(self, value): ...
def _inverse_related(self, records: BaseModel) -> None: ...
def _search_related(self, records: BaseModel, operator: str, value) -> list: ...
_related_comodel_name: str | None
_related_string: str | None
_related_help: str | None
_related_groups: str | None
_related_group_operator: str | None
@property @property
def base_field(self) -> Field: ... def base_field(self) -> Field: ...
@property @property
def groupable(self) -> bool: ... def groupable(self) -> bool: ...
def _default_company_dependent(self, model: BaseModel): ...
def _compute_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 resolve_depends(self, registry: Registry) -> Iterator[tuple]: ... def resolve_depends(self, registry: Registry) -> Iterator[tuple]: ...
def get_description( def get_description(
self, env: Environment, attributes: Container[str] | None = ... self, env: Environment, attributes: Container[str] | None = ...
) -> dict[str, Any]: ... ) -> dict[str, Any]: ...
_description_name: str
_description_type: str
_description_store: bool | None
_description_manual: Any
_description_related: str | None
_description_company_dependent: bool
_description_readonly: bool
_description_required: bool
_description_states: dict[str, list[tuple]] | None
_description_groups: str | None
_description_change_default: bool
_description_group_operator: str | None
_description_default_export_compatible: bool
_description_exportable: bool
def _description_depends(self, env: Environment): ...
@property
def _description_searchable(self) -> bool: ...
@property
def _description_sortable(self) -> bool: ...
def _description_string(self, env: Environment) -> str | None: ...
def _description_help(self, env: Environment) -> str | None: ...
def is_editable(self) -> bool: ... def is_editable(self) -> bool: ...
def convert_to_column( def convert_to_column(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ... self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
@@ -168,7 +119,6 @@ class Field(Generic[_FieldValueT], metaclass=MetaField):
def column_order(self) -> int: ... def column_order(self) -> int: ...
def update_db(self, model: BaseModel, columns: dict[str, Any]): ... def update_db(self, model: BaseModel, columns: dict[str, Any]): ...
def update_db_column(self, model: BaseModel, column: dict | None) -> None: ... def update_db_column(self, model: BaseModel, column: dict | None) -> None: ...
def _convert_db_column(self, model: BaseModel, column: dict | None) -> None: ...
def update_db_notnull(self, model: BaseModel, column: dict | None) -> None: ... def update_db_notnull(self, model: BaseModel, column: dict | None) -> None: ...
def update_db_related(self, model: BaseModel) -> None: ... def update_db_related(self, model: BaseModel) -> None: ...
def read(self, records: BaseModel) -> None: ... def read(self, records: BaseModel) -> None: ...
@@ -200,7 +150,6 @@ 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 _get_attrs(self, model_class: Type[BaseModel], name: str): ...
def convert_to_column( def convert_to_column(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ... self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
) -> int: ... ) -> int: ...
@@ -209,12 +158,10 @@ class Integer(Field[int]):
) -> int | None: ... ) -> 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 convert_to_export(self, value, record): ... def convert_to_export(self, value, record): ...
class Float(Field[float]): class Float(Field[float]):
type: str type: str
_digits: tuple[int, int] | str | None
group_operator: str group_operator: str
def __init__( def __init__(
self, string: str = ..., digits: tuple[int, int] | str | None = ..., **kwargs self, string: str = ..., digits: tuple[int, int] | str | None = ..., **kwargs
@@ -222,8 +169,6 @@ class Float(Field[float]):
@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
def _description_digits(self, env: Environment) -> tuple[int, int]: ...
def convert_to_column( def convert_to_column(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ... self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
) -> float: ... ) -> float: ...
@@ -245,7 +190,6 @@ class Monetary(Field[float]):
def __init__( def __init__(
self, string: str = ..., currency_field: str = ..., **kwargs self, string: str = ..., currency_field: str = ..., **kwargs
) -> None: ... ) -> None: ...
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: ...
@@ -263,36 +207,26 @@ class _String(Field[str]):
translate: Callable | bool translate: Callable | bool
unaccent: bool unaccent: bool
def __init__(self, string: str = ..., **kwargs) -> None: ... def __init__(self, string: str = ..., **kwargs) -> None: ...
_related_translate: bool
def _description_translate(self, env: Environment) -> bool: ...
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( def convert_to_column(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ... self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
): ... ): ...
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( def get_translation_dictionary(
self, from_lang_value: str, to_lang_values: dict self, from_lang_value: str, to_lang_values: dict
) -> dict: ... ) -> dict: ...
def _get_stored_translations(self, record: BaseModel) -> dict[str, str]: ...
def write(self, records: _ModelT, value) -> None: ... def write(self, records: _ModelT, value) -> None: ...
class Char(_String): class Char(_String):
type: str type: str
size: int | None size: int | None
trim: bool trim: bool
def _setup_attrs(self, model_class: Type[BaseModel], name: str) -> None: ...
@property @property
def column_type(self) -> tuple[str, str]: ... def column_type(self) -> tuple[str, str]: ...
def update_db_column(self, model: BaseModel, column: dict | None) -> None: ... def update_db_column(self, model: BaseModel, column: dict | None) -> None: ...
_related_size: int | None
_related_trim: bool
_description_size: int | None
_description_trim: bool
def convert_to_column( def convert_to_column(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ... self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
) -> str | None: ... ) -> str | None: ...
@@ -316,28 +250,14 @@ class Html(_String):
sanitize_form: bool sanitize_form: bool
strip_style: bool strip_style: bool
strip_classes: bool strip_classes: bool
def _get_attrs(self, model_class: Type[BaseModel], name: str) -> dict[str, Any]: ...
@property @property
def column_type(self) -> tuple[str, str]: ... def column_type(self) -> tuple[str, str]: ...
_related_sanitize: bool
_related_sanitize_tags: bool
_related_sanitize_attributes: bool
_related_sanitize_style: bool
_related_strip_style: bool
_related_strip_classes: bool
_description_sanitize: bool
_description_sanitize_tags: bool
_description_sanitize_attributes: bool
_description_sanitize_style: bool
_description_strip_style: bool
_description_strip_classes: bool
def convert_to_column( def convert_to_column(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ... self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
) -> Markup | None: ... ) -> Markup | None: ...
def convert_to_cache( def convert_to_cache(
self, value, record: BaseModel, validate: bool = ... self, value, record: BaseModel, validate: bool = ...
) -> Markup | None: ... ) -> 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( def convert_to_read(
self, value, record: BaseModel, use_name_get: bool = ... self, value, record: BaseModel, use_name_get: bool = ...
@@ -393,17 +313,12 @@ class Datetime(Field[datetime.datetime]):
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: ...
_BINARY = memoryview
class Binary(Field[bytes]): class Binary(Field[bytes]):
type: str type: str
prefetch: bool prefetch: bool
_depends_context: tuple[str]
attachment: bool attachment: bool
@property @property
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]: ...
_description_attachment: bool
def convert_to_column( def convert_to_column(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ... self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
) -> psycopg2.Binary | None: ... ) -> psycopg2.Binary | None: ...
@@ -423,8 +338,6 @@ class Image(Binary):
def setup(self, model: BaseModel) -> None: ... def setup(self, model: BaseModel) -> None: ...
def create(self, record_values: list[tuple[BaseModel, Any]]) -> None: ... def create(self, record_values: list[tuple[BaseModel, Any]]) -> None: ...
def write(self, records: BaseModel, value) -> None: ... def write(self, records: BaseModel, value) -> None: ...
def _image_process(self, value): ...
def _process_related(self, value): ...
class Selection(Field[str]): class Selection(Field[str]):
type: str type: str
@@ -437,13 +350,6 @@ class Selection(Field[str]):
) -> None: ... ) -> 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 _setup_attrs(self, model_class: Type[BaseModel], name: str) -> None: ...
def _selection_modules(self, model: BaseModel) -> dict[str, set[str, str]]: ...
def _description_selection(self, env: Environment) -> _Selection: ...
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( def convert_to_column(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ... self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
@@ -476,12 +382,6 @@ class _Relational(Field[BaseModel]):
comodel_name: str comodel_name: str
def setup_nonrelated(self, model: BaseModel) -> None: ... def setup_nonrelated(self, model: BaseModel) -> None: ...
def get_domain_list(self, model: BaseModel) -> _Domain: ... def get_domain_list(self, model: BaseModel) -> _Domain: ...
@property
def _related_domain(self) -> _DomainRaw: ...
_related_context: dict
_description_relation: str | None
_description_context: dict
def _description_domain(self, env: Environment) -> _Domain: ...
class Many2one(_Relational): class Many2one(_Relational):
type: str type: str
@@ -492,12 +392,10 @@ class Many2one(_Relational):
def __init__( def __init__(
self, comodel_name: str = ..., string: str = ..., **kwargs self, comodel_name: str = ..., string: str = ..., **kwargs
) -> None: ... ) -> 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 convert_to_column( def convert_to_column(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ... self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
): ... ): ...
@@ -510,17 +408,12 @@ class Many2one(_Relational):
def convert_to_display_name(self, value, record: BaseModel) -> str: ... def convert_to_display_name(self, value, record: BaseModel) -> str: ...
def convert_to_onchange(self, value, record: BaseModel, names): ... def convert_to_onchange(self, value, record: BaseModel, names): ...
def write(self, records: _ModelT, value) -> None: ... def write(self, records: _ModelT, value) -> None: ...
def _remove_inverses(self, records: BaseModel, value): ...
def _update_inverses(self, records: BaseModel, value) -> None: ...
class Many2oneReference(Integer): class Many2oneReference(Integer):
type: str type: str
model_field: str | None model_field: str | None
_related_model_field: str | None
group_operator: str | None group_operator: str | None
def convert_to_cache(self, value, record: BaseModel, validate: bool = ...): ... def convert_to_cache(self, value, record: BaseModel, validate: bool = ...): ...
def _update_inverses(self, records: BaseModel, value) -> None: ...
def _record_ids_per_res_model(self, records: BaseModel) -> dict[str, set]: ...
class Json(Field): class Json(Field):
type: str type: str
@@ -545,12 +438,8 @@ class Properties(Field):
definition: str | None definition: str | None
definition_record: str | None definition_record: str | None
definition_record_field: str | None definition_record_field: str | None
_description_definition_record: str | None
_description_definition_record_field: str | None
ALLOWED_TYPES: tuple[str, ...] ALLOWED_TYPES: tuple[str, ...]
_depends: tuple[str, ...]
compute: Callable compute: Callable
def _setup_attrs(self, model_class: Type[BaseModel], name: str) -> None: ...
def convert_to_column( def convert_to_column(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ... self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
): ... ): ...
@@ -562,36 +451,7 @@ class Properties(Field):
): ... ): ...
def convert_to_write(self, value, record: BaseModel): ... def convert_to_write(self, value, record: BaseModel): ...
def convert_to_onchange(self, value, record: BaseModel, names): ... def convert_to_onchange(self, value, record: BaseModel, names): ...
def _get_res_ids_per_model(
self, records: BaseModel, values_list, use_name_get: bool = ...
) -> dict[str, set[int]]: ...
def write(self, records: _ModelT, value) -> None: ... def write(self, records: _ModelT, value) -> None: ...
def _compute(self, records: BaseModel) -> None: ...
def _add_default_values(self, env: Environment, values: dict[str, Any]): ...
def _get_properties_definition(self, record: BaseModel): ...
@classmethod
def _add_display_name(
cls, values_list: list[dict], env: Environment, value_keys: tuple[str] = ...
) -> None: ...
@classmethod
def _remove_display_name(
cls, values_list: list[dict], value_key: str = ...
) -> None: ...
@classmethod
def _add_missing_names(cls, values_list: list[dict]) -> None: ...
@classmethod
def _parse_json_types(
cls,
values_list: list[dict],
env: Environment,
res_ids_per_model: dict[str, set[int]],
) -> None: ...
@classmethod
def _list_to_dict(cls, values_list: list[dict]) -> dict: ...
@classmethod
def _dict_to_list(
cls, values_dict: dict, properties_definition: Sequence[dict]
) -> Sequence[dict]: ...
class PropertiesDefinition(Field): class PropertiesDefinition(Field):
type: str type: str
@@ -607,10 +467,6 @@ class PropertiesDefinition(Field):
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
def _validate_properties_definition(
cls, properties_definition: Sequence[dict], env
): ...
class Command(enum.IntEnum): class Command(enum.IntEnum):
CREATE: int CREATE: int
@@ -637,7 +493,6 @@ class Command(enum.IntEnum):
class _RelationalMulti(_Relational): class _RelationalMulti(_Relational):
write_sequence: int write_sequence: int
def _update(self, records: BaseModel, value) -> None: ...
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): ...
@@ -665,7 +520,6 @@ class One2many(_RelationalMulti):
**kwargs **kwargs
) -> None: ... ) -> None: ...
def setup_nonrelated(self, model: BaseModel) -> None: ... def setup_nonrelated(self, model: BaseModel) -> None: ...
_description_relation_field: str | None
def update_db(self, model: BaseModel, columns) -> None: ... def update_db(self, model: BaseModel, columns) -> None: ...
def get_domain_list(self, records: BaseModel): ... def get_domain_list(self, records: BaseModel): ...
def read(self, records: BaseModel): ... def read(self, records: BaseModel): ...
@@ -676,7 +530,6 @@ class One2many(_RelationalMulti):
class Many2many(_RelationalMulti): class Many2many(_RelationalMulti):
type: str type: str
_explicit: bool
relation: str | None relation: str | None
column1: str | None column1: str | None
column2: str | None column2: str | None

View File

@@ -1,24 +1,15 @@
from abc import ABC, abstractmethod 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 typing import Any, Callable, Iterable, Literal, Mapping, TypeVar
from typing import (
Any,
Callable,
Collection,
Generator,
Iterable,
Literal,
Mapping,
TypeVar,
)
import geoip2.database import geoip2.database
import geoip2.models import geoip2.models
import werkzeug import werkzeug
from odoo.addons.base.models.res_lang import Lang
from odoo.addons.website.models.website import Website
from werkzeug.datastructures import Headers from werkzeug.datastructures import Headers
from werkzeug.exceptions import NotFound from werkzeug.exceptions import NotFound
from werkzeug.local import LocalStack
from werkzeug.middleware.proxy_fix import ProxyFix as ProxyFix_ from werkzeug.middleware.proxy_fix import ProxyFix as ProxyFix_
from werkzeug.routing import Map, Rule from werkzeug.routing import Map, Rule
from werkzeug.urls import URL from werkzeug.urls import URL
@@ -28,7 +19,6 @@ 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._vendor import sessions from .tools._vendor import sessions
from .tools.profiler import Profiler
_T = TypeVar("_T") _T = TypeVar("_T")
@@ -86,7 +76,7 @@ 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) -> 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: ...
@@ -111,12 +101,6 @@ def route(
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 _check_and_complete_route_definition(
controller_cls: type, submethod, merged_routing: dict
) -> 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: ...
@@ -127,7 +111,6 @@ class FilesystemSessionStore(sessions.FilesystemSessionStore):
class Session(MutableMapping): class Session(MutableMapping):
can_save: bool can_save: bool
__data: dict
is_dirty: bool is_dirty: bool
is_explicit: bool is_explicit: bool
is_new: bool is_new: bool
@@ -156,10 +139,6 @@ class GeoIP(Mapping):
ip: str ip: str
def __init__(self, ip: str) -> None: ... def __init__(self, ip: str) -> None: ...
@property @property
def _city_record(self) -> geoip2.models.City: ...
@property
def _country_record(self) -> geoip2.models.Country: ...
@property
def country_name(self): ... def country_name(self): ...
@property @property
def country_code(self): ... def country_code(self): ...
@@ -169,7 +148,6 @@ class GeoIP(Mapping):
def __iter__(self): ... def __iter__(self): ...
def __len__(self) -> int: ... def __len__(self) -> int: ...
_request_stack: LocalStack
request: Request request: Request
class Response(werkzeug.Response): class Response(werkzeug.Response):
@@ -232,16 +210,15 @@ class Request:
session: Session session: Session
db: str | None db: str | None
env: Environment | None env: Environment | None
website: "odoo.model.website" website: "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: "Lang"
def __init__(self, httprequest: werkzeug.Request) -> None: ... def __init__(self, httprequest: werkzeug.Request) -> None: ...
def _get_session_and_dbname(self) -> tuple[Session, str]: ...
def update_env( def update_env(
self, self,
user: "odoo.model.res_users | int | None" = ..., user=...,
context: dict[str, Any] | None = ..., context: dict[str, Any] | None = ...,
su: bool | None = ..., su: bool | None = ...,
) -> None: ... ) -> None: ...
@@ -258,7 +235,6 @@ class Request:
def cr(self) -> Cursor: ... def cr(self) -> Cursor: ...
@cr.setter @cr.setter
def cr(self, value) -> None: ... def cr(self, value) -> None: ...
_cr: Cursor
@property @property
def best_lang(self) -> str | None: ... def best_lang(self) -> str | None: ...
def csrf_token(self, time_limit: int | None = ...) -> str: ... def csrf_token(self, time_limit: int | None = ...) -> str: ...
@@ -267,8 +243,6 @@ class Request:
def default_lang(self) -> str: ... def default_lang(self) -> str: ...
def get_http_params(self) -> dict: ... def get_http_params(self) -> dict: ...
def get_json_data(self): ... def get_json_data(self): ...
def _get_profiler_context_manager(self) -> Profiler | nullcontext: ...
def _inject_future_response(self, response: werkzeug.Response): ...
def make_response( def make_response(
self, self,
data: str, data: str,
@@ -297,15 +271,6 @@ class Request:
def render( def render(
self, template: str, qcontext: dict | None = ..., lazy: bool = ..., **kw self, template: str, qcontext: dict | None = ..., lazy: bool = ..., **kw
): ... ): ...
def _save_session(self) -> None: ...
def _set_request_dispatcher(self, rule: Rule) -> None: ...
def _serve_static(self) -> werkzeug.Response: ...
def _serve_nodb(self): ...
def _serve_db(self): ...
params: dict
def _serve_ir_http(self): ...
_dispatchers: dict[str, type[Dispatcher]]
class Dispatcher(ABC): class Dispatcher(ABC):
routing_type: str routing_type: str
@@ -338,9 +303,6 @@ 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: ...
class Application: class Application:
@property @property

View File

@@ -15,6 +15,8 @@ from typing import (
import dateutil.relativedelta import dateutil.relativedelta
import psycopg2 import psycopg2
from odoo.addons.base.models.res_company import Company
from odoo.addons.base.models.res_users import Users
from . import api, fields from . import api, fields
from .api import Environment from .api import Environment
@@ -62,8 +64,6 @@ class NewId:
def __bool__(self) -> bool: ... def __bool__(self) -> bool: ...
def __eq__(self, other) -> bool: ... def __eq__(self, other) -> bool: ...
def __hash__(self) -> int: ... def __hash__(self) -> int: ...
def __repr__(self) -> str: ...
def __str__(self) -> str: ...
def origin_ids(ids: Iterable) -> Iterator[int]: ... def origin_ids(ids: Iterable) -> Iterator[int]: ...
@@ -436,12 +436,8 @@ 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( def with_user(self: _ModelT, user: "Union[Users, int]") -> _ModelT: ...
self: _ModelT, user: Union["odoo.model.res_partner", int] def with_company(self: _ModelT, company: "Union[Company, int]") -> _ModelT: ...
) -> _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( def with_prefetch(
self: _ModelT, prefetch_ids: Iterable[int] | None = ... self: _ModelT, prefetch_ids: Iterable[int] | None = ...
@@ -485,7 +481,7 @@ class BaseModel(metaclass=MetaModel):
def __le__(self: _ModelT, other: _ModelT) -> bool: ... def __le__(self: _ModelT, other: _ModelT) -> bool: ...
def __gt__(self: _ModelT, other: _ModelT) -> bool: ... def __gt__(self: _ModelT, other: _ModelT) -> bool: ...
def __ge__(self: _ModelT, other: _ModelT) -> bool: ... def __ge__(self: _ModelT, other: _ModelT) -> bool: ...
def __int__(self): ... def __int__(self) -> int: ...
def __repr__(self) -> str: ... def __repr__(self) -> str: ...
def __hash__(self) -> int: ... def __hash__(self) -> int: ...
def __getitem__(self, key: str | int | slice): ... def __getitem__(self, key: str | int | slice): ...
@@ -530,7 +526,6 @@ class BaseModel(metaclass=MetaModel):
def _populate(self: _ModelT, size: str) -> _ModelT: ... def _populate(self: _ModelT, size: str) -> _ModelT: ...
class RecordCache(MutableMapping): class RecordCache(MutableMapping):
_record: BaseModel
def __init__(self, record: BaseModel) -> None: ... def __init__(self, record: BaseModel) -> None: ...
def __contains__(self, name: str) -> bool: ... def __contains__(self, name: str) -> bool: ...
def __getitem__(self, name: str) -> Any: ... def __getitem__(self, name: str) -> Any: ...

View File

@@ -10,7 +10,6 @@ class Graph(dict[str, Node]):
self, cr: Cursor, module_list: list[str], force: list | None = ... self, cr: Cursor, module_list: list[str], force: list | None = ...
): ... ): ...
def __iter__(self) -> Iterator[Node]: ... def __iter__(self) -> Iterator[Node]: ...
def __str__(self) -> str: ...
class Node: class Node:
def __new__(cls, name: str, graph: Graph, info: dict[str, Any]) -> Node: ... def __new__(cls, name: str, graph: Graph, info: dict[str, Any]) -> Node: ...
@@ -31,8 +30,6 @@ class Node:
def add_child(self, name: str, info: dict[str, Any]): ... def add_child(self, name: str, info: dict[str, Any]): ...
def __setattr__(self, name: str, value) -> None: ... def __setattr__(self, name: str, value) -> None: ...
def __iter__(self) -> Iterator[Node]: ... def __iter__(self) -> Iterator[Node]: ...
def __str__(self) -> str: ...
def _pprint(self, depth: int = ...) -> str: ...
def should_have_demo(self) -> bool: ... def should_have_demo(self) -> bool: ...
@property @property
def parents(self) -> Iterable[Node]: ... def parents(self) -> Iterable[Node]: ...

View File

@@ -1,7 +1,6 @@
from typing import Any, Iterable from typing import Any
from ..api import Environment from ..api import Environment
from ..sql_db import Cursor
from ..tests.result import OdooTestResult from ..tests.result import OdooTestResult
from .graph import Graph, Node from .graph import Graph, Node
from .registry import Registry from .registry import Registry
@@ -20,7 +19,6 @@ def load_module_graph(
report: OdooTestResult | None = ..., report: OdooTestResult | None = ...,
models_to_check: set[str] | None = ..., models_to_check: set[str] | None = ...,
) -> tuple[list[str], list[str]]: ... ) -> tuple[list[str], list[str]]: ...
def _check_module_names(cr: Cursor, module_names: Iterable[str]) -> None: ...
def load_marked_modules( def load_marked_modules(
env: Environment, env: Environment,
graph: Graph, graph: Graph,

View File

@@ -13,5 +13,4 @@ class MigrationManager:
graph: Graph graph: Graph
migrations: dict migrations: dict
def __init__(self, cr: Cursor, graph: Graph) -> None: ... def __init__(self, cr: Cursor, graph: Graph) -> None: ...
def _get_files(self) -> None: ...
def migrate_module(self, pkg: Node, stage: str) -> None: ... def migrate_module(self, pkg: Node, stage: str) -> None: ...

View File

@@ -5,7 +5,6 @@ from ..tools import pycompat as pycompat
MANIFEST_NAMES: tuple[str, ...] MANIFEST_NAMES: tuple[str, ...]
README: list[str] README: list[str]
_DEFAULT_MANIFEST: dict[str, Any]
class UpgradeHook: class UpgradeHook:
def find_module(self, name: str, path: Any | None = ...) -> UpgradeHook | None: ... def find_module(self, name: str, path: Any | None = ...) -> UpgradeHook | None: ...

View File

@@ -1,20 +1,15 @@
import threading
from collections import defaultdict, deque
from collections.abc import Mapping 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, Iterable, Iterator
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 Cursor
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 from .graph import Node
class Registry(Mapping[str, type[BaseModel]]): class Registry(Mapping[str, type[BaseModel]]):
_lock: RLock
_saved_lock: RLock | None
registries: ClassVar[LRU] registries: ClassVar[LRU]
def __new__(cls, db_name: str) -> Registry: ... def __new__(cls, db_name: str) -> Registry: ...
@classmethod @classmethod
@@ -26,19 +21,9 @@ class Registry(Mapping[str, type[BaseModel]]):
update_module: bool = ..., update_module: bool = ...,
) -> Registry: ... ) -> Registry: ...
models: dict[str, type[BaseModel]] models: dict[str, type[BaseModel]]
_sql_constraints: set
_init: bool
_database_translated_fields: Collection[str]
_assertion_report: OdooTestResult
_fields_by_model: Any
_ordinary_tables: set[str] | None
_constraint_queue: deque
__cache: LRU
_init_modules: set[str]
updated_modules: list[str] updated_modules: list[str]
loaded_xmlids: set loaded_xmlids: set
db_name: str db_name: str
_db: Connection
test_cr: Cursor | None test_cr: Cursor | None
test_lock: RLock | None test_lock: RLock | None
loaded: bool loaded: bool
@@ -46,11 +31,8 @@ class Registry(Mapping[str, type[BaseModel]]):
field_depends: Collector field_depends: Collector
field_depends_context: Collector field_depends_context: Collector
field_inverses: Collector field_inverses: Collector
_field_trigger_trees: dict[Field, TriggerTree]
_is_modifying_relations: dict[Field, bool]
registry_sequence: int | None registry_sequence: int | None
cache_sequence: int | None cache_sequence: int | None
_invalidation_flags: threading.local
has_unaccent: bool has_unaccent: bool
has_trigram: bool has_trigram: bool
def init(self, db_name: str) -> None: ... def init(self, db_name: str) -> None: ...
@@ -66,23 +48,16 @@ class Registry(Mapping[str, type[BaseModel]]):
def __delitem__(self, model_name: str) -> None: ... def __delitem__(self, model_name: str) -> None: ...
def descendants(self, model_names: Iterable[str], *kinds) -> set[str]: ... def descendants(self, model_names: Iterable[str], *kinds) -> set[str]: ...
def load(self, cr: Cursor, module: Node) -> set[str]: ... def load(self, cr: Cursor, module: Node) -> set[str]: ...
_m2m: defaultdict[Any, list]
def setup_models(self, cr: Cursor) -> None: ... def setup_models(self, cr: Cursor) -> None: ...
@property @property
def field_computed(self) -> dict[Field, list[Field]]: ... def field_computed(self) -> dict[Field, list[Field]]: ...
def get_trigger_tree(self, fields: list, select: Callable = ...) -> TriggerTree: ... def get_trigger_tree(self, fields: list, select: Callable = ...) -> TriggerTree: ...
def get_dependent_fields(self, field: Field) -> Iterator[Field]: ... def get_dependent_fields(self, field: Field) -> Iterator[Field]: ...
def _discard_fields(self, fields: list[Field]) -> None: ...
def get_field_trigger_tree(self, field: Field) -> TriggerTree: ... def get_field_trigger_tree(self, field: Field) -> TriggerTree: ...
@property
def _field_triggers(self) -> defaultdict[Field, Any]: ...
def is_modifying_relations(self, field: Field) -> bool: ... def is_modifying_relations(self, field: Field) -> bool: ...
def post_init(self, func: Callable, *args, **kwargs) -> None: ... def post_init(self, func: Callable, *args, **kwargs) -> None: ...
def post_constraint(self, func: Callable, *args, **kwargs) -> None: ... def post_constraint(self, func: Callable, *args, **kwargs) -> None: ...
def finalize_constraints(self) -> None: ... def finalize_constraints(self) -> None: ...
_post_init_queue: deque
_foreign_keys: Any
_is_install: bool
def init_models( def init_models(
self, cr: Cursor, model_names: Iterable[str], context: dict, install: bool = ... self, cr: Cursor, model_names: Iterable[str], context: dict, install: bool = ...
) -> None: ... ) -> None: ...
@@ -100,7 +75,6 @@ class Registry(Mapping[str, type[BaseModel]]):
) -> None: ... ) -> 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_caches(self) -> None: ... def clear_caches(self) -> None: ...
def is_an_ordinary_table(self, model: BaseModel) -> bool: ... def is_an_ordinary_table(self, model: BaseModel) -> bool: ...
@property @property
@@ -131,7 +105,6 @@ class TriggerTree(dict):
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: ...
def __repr__(self) -> str: ...
def increase(self, key) -> TriggerTree: ... def increase(self, key) -> TriggerTree: ...
def depth_first(self) -> Iterator[TriggerTree]: ... def depth_first(self) -> Iterator[TriggerTree]: ...
@classmethod @classmethod

View File

@@ -1,7 +1,7 @@
import logging.handlers import logging.handlers
import warnings import warnings
from logging import Logger, LogRecord from logging import Logger, LogRecord
from typing import IO, TextIO from typing import TextIO
def log( def log(
logger: Logger, level: int, prefix: str, msg, depth: int | None = ... logger: Logger, level: int, prefix: str, msg, depth: int | None = ...
@@ -9,9 +9,7 @@ def log(
class WatchedFileHandler(logging.handlers.WatchedFileHandler): class WatchedFileHandler(logging.handlers.WatchedFileHandler):
errors: None errors: None
_builtin_open: None
def __init__(self, filename: str) -> None: ... def __init__(self, filename: str) -> None: ...
def _open(self) -> IO: ...
class PostgreSQLHandler(logging.Handler): class PostgreSQLHandler(logging.Handler):
def emit(self, record: LogRecord) -> None: ... def emit(self, record: LogRecord) -> None: ...
@@ -24,7 +22,6 @@ BLUE: int
MAGENTA: int MAGENTA: int
CYAN: int CYAN: int
WHITE: int WHITE: int
_NOTHING: int
DEFAULT: int DEFAULT: int
RESET_SEQ: str RESET_SEQ: str
COLOR_SEQ: str COLOR_SEQ: str
@@ -49,8 +46,6 @@ class DBFormatter(logging.Formatter):
class ColoredFormatter(DBFormatter): class ColoredFormatter(DBFormatter):
def format(self, record: LogRecord): ... def format(self, record: LogRecord): ...
_logger_init: bool
def init_logger(): ... def init_logger(): ...
DEFAULT_LOG_CONFIGURATION: list[str] DEFAULT_LOG_CONFIGURATION: list[str]

View File

@@ -1,6 +1,5 @@
from typing import Any, Callable, Iterable from typing import Any, Callable
from ..fields import Field
from ..models import MAGIC_COLUMNS as MAGIC_COLUMNS from ..models import MAGIC_COLUMNS as MAGIC_COLUMNS
from ..models import BaseModel from ..models import BaseModel
from ..sql_db import Cursor from ..sql_db import Cursor
@@ -29,27 +28,16 @@ def combine(operator: str, unit, zero, domains: list[_Domain]) -> _Domain: ...
def AND(domains: list[_Domain]) -> _Domain: ... def AND(domains: list[_Domain]) -> _Domain: ...
def OR(domains: list[_Domain]) -> _Domain: ... def OR(domains: list[_Domain]) -> _Domain: ...
def distribute_not(domain: _Domain) -> _Domain: ... def distribute_not(domain: _Domain) -> _Domain: ...
def _anyfy_leaves(domain: _Domain, model: BaseModel) -> _Domain: ...
def _tree_from_domain(domain: _Domain) -> tuple: ...
def _tree_not(tree: tuple) -> tuple: ...
def _tree_and(trees: Iterable[tuple]) -> tuple: ...
def _tree_or(trees: Iterable[tuple]) -> tuple: ...
def _tree_combine_anies(tree: tuple, model: BaseModel) -> tuple: ...
def _tree_as_domain(tree: tuple) -> _Domain: ...
def domain_combine_anies(domain: _Domain, model: BaseModel) -> _Domain: ... def domain_combine_anies(domain: _Domain, model: BaseModel) -> _Domain: ...
def prettify_domain(domain: _Domain, pre_indent: int = ...) -> str: ... def prettify_domain(domain: _Domain, pre_indent: int = ...) -> str: ...
def _quote(to_quote: str) -> str: ...
def normalize_leaf(element): ... def normalize_leaf(element): ...
def is_operator(element) -> bool: ... def is_operator(element) -> bool: ...
def is_leaf(element, internal: bool = ...) -> bool: ... def is_leaf(element, internal: bool = ...) -> bool: ...
def is_boolean(element) -> bool: ... def is_boolean(element) -> bool: ...
def check_leaf(element, internal: bool = ...) -> None: ... def check_leaf(element, internal: bool = ...) -> None: ...
def _unaccent_wrapper(x) -> str: ...
def get_unaccent_wrapper(cr: Cursor) -> Callable[[Any], str]: ... def get_unaccent_wrapper(cr: Cursor) -> Callable[[Any], str]: ...
class expression: class expression:
_unaccent_wrapper: Callable[[Any], str]
_has_trigram: bool
root_model: BaseModel root_model: BaseModel
root_alias: str | None root_alias: str | None
expression: _Domain expression: _Domain
@@ -62,6 +50,4 @@ class expression:
alias: str | None = ..., alias: str | None = ...,
query: Query | None = ..., query: Query | None = ...,
) -> None: ... ) -> None: ...
def _unaccent(self, field: Field) -> Callable[[Any], str]: ...
def parse(self): ... def parse(self): ...
def __leaf_to_sql(self, leaf, model: BaseModel, alias: str) -> tuple[str, list]: ...

View File

@@ -9,17 +9,6 @@ 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 = ...,
country_code: str | None = ...,
phone: str | None = ...,
) -> None: ...
def _create_empty_database(name: str) -> None: ...
def exp_create_database( def exp_create_database(
db_name: str, db_name: str,
demo: bool, demo: bool,
@@ -30,7 +19,6 @@ def exp_create_database(
phone: str | None = ..., phone: str | None = ...,
) -> Literal[True]: ... ) -> 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 exp_drop(db_name: str) -> bool: ... def exp_drop(db_name: str) -> bool: ...
def exp_dump(db_name: str, format: str) -> str: ... def exp_dump(db_name: str, format: str) -> str: ...
def dump_db_manifest(cr: Cursor) -> dict[str, Any]: ... def dump_db_manifest(cr: Cursor) -> dict[str, Any]: ...

View File

@@ -1,22 +1,17 @@
from typing import Any, Callable, Iterator, TypeVar from typing import Any, Callable, TypeVar
from psycopg2 import IntegrityError
from ..api import Environment from ..api import Environment
from ..exceptions import ValidationError
from ..sql_db import Cursor from ..sql_db import Cursor
_CallableT = TypeVar("_CallableT", bound=Callable)
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)
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( def execute_kw(
db: str, uid: int, obj: str, method: str, args, kw: dict | None = ... 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 retrying(func: Callable[[], Any], env: Environment): ... def retrying(func: Callable[[], Any], env: Environment): ...
def _traverse_containers(val, type_) -> Iterator: ...

View File

@@ -1,7 +1,7 @@
from itertools import chain as chain 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 typing import Any, Callable, Iterable, Literal, TypeVar from typing import Any, Callable, Literal, TypeVar
import werkzeug.serving import werkzeug.serving
from gevent.pywsgi import WSGIServer from gevent.pywsgi import WSGIServer
@@ -47,7 +47,6 @@ class ThreadedWSGIServerReloadable(
def server_bind(self) -> None: ... def server_bind(self) -> None: ...
def server_activate(self) -> None: ... def server_activate(self) -> None: ...
def process_request(self, request, client_address) -> None: ... def process_request(self, request, client_address) -> None: ...
def _handle_request_noblock(self) -> None: ...
def shutdown_request(self, request) -> None: ... def shutdown_request(self, request) -> None: ...
class FSWatcherBase: class FSWatcherBase:
@@ -71,7 +70,6 @@ class FSWatcherInotify(FSWatcherBase):
class CommonServer: class CommonServer:
app: Any app: Any
_on_stop_funcs: list[Callable]
interface: str interface: str
port: int port: int
pid: int pid: int
@@ -167,7 +165,6 @@ class Worker:
def start(self) -> None: ... def start(self) -> None: ...
def stop(self) -> None: ... def stop(self) -> None: ...
def run(self) -> None: ... def run(self) -> None: ...
def _runloop(self) -> None: ...
class WorkerHTTP(Worker): class WorkerHTTP(Worker):
sock_timeout: float sock_timeout: float
@@ -182,7 +179,6 @@ class WorkerCron(Worker):
watchdog_timeout: int watchdog_timeout: int
def __init__(self, multi: PreforkServer) -> None: ... def __init__(self, multi: PreforkServer) -> None: ...
def sleep(self) -> None: ... def sleep(self) -> None: ...
def _db_list(self): ...
def process_work(self) -> None: ... def process_work(self) -> None: ...
dbcursor: Cursor dbcursor: Cursor
def start(self) -> None: ... def start(self) -> None: ...
@@ -191,7 +187,6 @@ class WorkerCron(Worker):
server: CommonServer | None server: CommonServer | None
def load_server_wide_modules() -> None: ... def load_server_wide_modules() -> None: ...
def _reexec(updated_modules: Iterable[str] | None = ...) -> None: ...
def load_test_file_py(registry: Registry, test_file: str) -> None: ... def load_test_file_py(registry: Registry, test_file: str) -> None: ...
def preload_registries(dbnames: list[str] | None): ... def preload_registries(dbnames: list[str] | None): ...
def start(preload: list[str] | None = ..., stop: bool = ...): ... def start(preload: list[str] | None = ..., stop: bool = ...): ...

View File

@@ -1,20 +1,9 @@
from datetime import datetime from datetime import datetime
from re import Pattern from re import Pattern
from threading import Lock, RLock from threading import RLock
from typing import ( from typing import Any, Callable, Iterable, Iterator, NoReturn, TypeVar
Any,
Callable,
Generator,
Iterable,
Iterator,
Literal,
NoReturn,
Sequence,
TypeVar,
)
import psycopg2.extensions import psycopg2.extensions
from psycopg2.sql import Identifier
from .api import Transaction from .api import Transaction
from .tools import Callbacks from .tools import Callbacks
@@ -33,20 +22,12 @@ MAX_IDLE_TIMEOUT: int
class Savepoint: class Savepoint:
name: str name: str
_name: Identifier
_cr: BaseCursor
closed: bool closed: bool
def __init__(self, cr: BaseCursor) -> None: ... def __init__(self, cr: BaseCursor) -> None: ...
def __enter__(self: _SavepointT) -> _SavepointT: ... def __enter__(self: _SavepointT) -> _SavepointT: ...
def __exit__(self, exc_type, exc_val, exc_tb) -> None: ... def __exit__(self, exc_type, exc_val, exc_tb) -> None: ...
def close(self, *, rollback: bool = ...) -> None: ... def close(self, *, rollback: bool = ...) -> None: ...
def rollback(self) -> None: ... def rollback(self) -> None: ...
def _close(self, rollback: bool) -> None: ...
class _FlushingSavepoint(Savepoint):
def __init__(self, cr: BaseCursor) -> None: ...
def rollback(self) -> None: ...
def _close(self, rollback: bool) -> None: ...
class BaseCursor: class BaseCursor:
precommit: Callbacks precommit: Callbacks
@@ -71,29 +52,19 @@ class Cursor(BaseCursor):
sql_from_log: dict sql_from_log: dict
sql_into_log: dict sql_into_log: dict
sql_log_count: int sql_log_count: int
_closed: bool
__pool: ConnectionPool
dbname: str dbname: str
_cnx: PsycoConnection
_obj: psycopg2.extensions.cursor
__caller: tuple[str, int | str] | Literal[False]
cache: dict cache: dict
_now: datetime | None
def __init__(self, pool: ConnectionPool, dbname: str, dsn: dict) -> None: ... def __init__(self, pool: ConnectionPool, dbname: str, dsn: dict) -> None: ...
def __build_dict(self, row: Sequence) -> dict[str, Any]: ...
def dictfetchone(self) -> dict[str, Any] | None: ... def dictfetchone(self) -> dict[str, Any] | None: ...
def dictfetchmany(self, size) -> list[dict[str, Any]]: ... def dictfetchmany(self, size) -> list[dict[str, Any]]: ...
def dictfetchall(self) -> list[dict[str, Any]]: ... def dictfetchall(self) -> list[dict[str, Any]]: ...
def __del__(self) -> None: ... def __del__(self) -> None: ...
def _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( def split_for_in_conditions(
self, ids: Iterable, size: int | None = ... self, ids: Iterable, size: int | None = ...
) -> Iterator[tuple]: ... ) -> Iterator[tuple]: ...
def print_log(self): ... def print_log(self): ...
def _enable_logging(self) -> Generator[None, None, None]: ...
def close(self): ... def close(self): ...
def _close(self, leak: bool = ...) -> None: ...
def commit(self): ... def commit(self): ...
def rollback(self): ... def rollback(self): ...
def __getattr__(self, name: str): ... def __getattr__(self, name: str): ...
@@ -102,12 +73,6 @@ class Cursor(BaseCursor):
def now(self) -> datetime: ... def now(self) -> datetime: ...
class TestCursor(BaseCursor): class TestCursor(BaseCursor):
_cursors_stack: list[TestCursor]
_now: datetime | None
_closed: bool
_cursor: Cursor
_lock: RLock
_savepoint: Savepoint | None
def __init__(self, cursor: Cursor, lock: RLock) -> None: ... def __init__(self, cursor: Cursor, lock: RLock) -> None: ...
def execute(self, *args, **kwargs): ... def execute(self, *args, **kwargs): ...
def close(self) -> None: ... def close(self) -> None: ...
@@ -119,24 +84,14 @@ class TestCursor(BaseCursor):
class PsycoConnection(psycopg2.extensions.connection): ... class PsycoConnection(psycopg2.extensions.connection): ...
class ConnectionPool: class ConnectionPool:
_connections: list[tuple[psycopg2.extensions.connection, bool]]
_maxconn: int
_lock: Lock
def __init__(self, maxconn: int = ...) -> None: ... def __init__(self, maxconn: int = ...) -> None: ...
def __repr__(self) -> str: ...
def _debug(self, msg, *args) -> None: ...
def borrow(self, connection_info: dict) -> PsycoConnection: ... def borrow(self, connection_info: dict) -> PsycoConnection: ...
def give_back( def give_back(
self, connection: PsycoConnection, keep_in_pool: bool = ... self, connection: PsycoConnection, keep_in_pool: bool = ...
) -> None: ... ) -> 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_to_dict(self, dsn) -> dict: ...
class Connection: class Connection:
__dbname: str
__dsn: dict
__pool: ConnectionPool
def __init__(self, pool: ConnectionPool, dbname: str, dsn: dict) -> None: ... def __init__(self, pool: ConnectionPool, dbname: str, dsn: dict) -> None: ...
@property @property
def dsn(self) -> dict: ... def dsn(self) -> dict: ...
@@ -146,9 +101,6 @@ class Connection:
def __bool__(self) -> NoReturn: ... def __bool__(self) -> NoReturn: ...
def connection_info_for(db_or_uri: str) -> tuple[str, dict]: ... def connection_info_for(db_or_uri: str) -> tuple[str, dict]: ...
_Pool: ConnectionPool | None
def db_connect(to: str, allow_uri: bool = ...) -> Connection: ... def db_connect(to: str, allow_uri: bool = ...) -> Connection: ...
def close_db(db_name: str) -> None: ... def close_db(db_name: str) -> None: ...
def close_all() -> None: ... def close_all() -> None: ...

View File

@@ -1,53 +1,16 @@
from collections.abc import Generator from collections.abc import Generator
from typing import Any
from unittest import TestCase as _TestCase from unittest import TestCase as _TestCase
__unittest: bool
_subtest_msg_sentinel: object
class _Outcome:
result: Any
success: bool
test: Any
def __init__(self, test, result) -> None: ...
def testPartExecutor(
self, test_case, isTest: bool = ...
) -> Generator[None, None, None]: ...
def _complete_traceback(self, initial_tb): ...
class TestCase(_TestCase): class TestCase(_TestCase):
_class_cleanups: list
__unittest_skip__: bool __unittest_skip__: bool
__unittest_skip_why__: str __unittest_skip_why__: str
_moduleSetUpFailed: bool
_testMethodName: str
_outcome: Any
_cleanups: list
_subtest: Any
_type_equality_funcs: dict
def __init__(self, methodName: str = ...) -> None: ... def __init__(self, methodName: str = ...) -> None: ...
def addCleanup(self, function, *args, **kwargs) -> None: ... def addCleanup(self, function, *args, **kwargs) -> None: ...
@classmethod @classmethod
def addClassCleanup(cls, function, *args, **kwargs) -> None: ... def addClassCleanup(cls, function, *args, **kwargs) -> None: ...
def shortDescription(self) -> None: ... def shortDescription(self) -> None: ...
def subTest(self, msg=..., **params) -> Generator[None, None, None]: ... def subTest(self, msg=..., **params) -> Generator[None, None, None]: ...
def _addError(self, result, test, exc_info) -> None: ...
def _callSetUp(self) -> None: ...
def _callTestMethod(self, method) -> None: ...
def _callTearDown(self) -> None: ...
def _callCleanup(self, function, *args, **kwargs) -> None: ...
def run(self, result): ... def run(self, result): ...
def doCleanups(self) -> None: ... def doCleanups(self) -> None: ...
@classmethod @classmethod
def doClassCleanups(cls) -> None: ... def doClassCleanups(cls) -> None: ...
class _SubTest(TestCase):
_message: Any
test_case: Any
params: Any
failureException: Any
def __init__(self, test_case, message, params) -> None: ...
def runTest(self) -> None: ...
def _subDescription(self) -> str: ...
def id(self) -> str: ...
def __str__(self) -> str: ...

View File

@@ -1,13 +1,11 @@
import collections import collections
import logging
from concurrent.futures import Future from concurrent.futures import Future
from itertools import count from itertools import count
from subprocess import Popen
from threading import Thread
from typing import Any, Callable, Generator, Mapping, Match, TypeVar from typing import Any, Callable, Generator, Mapping, Match, TypeVar
from xmlrpc import client as xmlrpclib from xmlrpc import client as xmlrpclib
import requests import requests
from odoo.addons.base.models.res_users import Users
from websocket import WebSocket from websocket import WebSocket
from ..api import Environment from ..api import Environment
@@ -46,14 +44,10 @@ def new_test_user(
groups: str = ..., groups: str = ...,
context: dict | None = ..., context: dict | None = ...,
**kwargs **kwargs
) -> "odoo.model.res_users": ... ) -> "Users": ...
class RecordCapturer: class RecordCapturer:
_model: BaseModel
_domain: list
def __init__(self, model: BaseModel, domain: list) -> None: ... def __init__(self, model: BaseModel, domain: list) -> None: ...
_before: BaseModel | None
_after: BaseModel | None
def __enter__(self: _T) -> _T: ... def __enter__(self: _T) -> _T: ...
def __exit__(self, exc_type, exc_value, exc_traceback) -> None: ... def __exit__(self, exc_type, exc_value, exc_traceback) -> None: ...
@property @property
@@ -62,15 +56,12 @@ class RecordCapturer:
class MetaCase(type): class MetaCase(type):
def __init__(cls, name, bases, attrs) -> None: ... def __init__(cls, name, bases, attrs) -> None: ...
def _normalize_arch_for_assert(arch_string: str, parser_method: str = ...) -> str: ...
class BaseCase(case.TestCase, metaclass=MetaCase): class BaseCase(case.TestCase, metaclass=MetaCase):
registry: Registry registry: Registry
env: Environment env: Environment
cr: Cursor cr: Cursor
longMessage: bool longMessage: bool
warm: bool warm: bool
_python_version: tuple
def __init__(self, methodName: str = ...) -> None: ... def __init__(self, methodName: str = ...) -> None: ...
def run(self, result: OdooTestResult) -> None: ... def run(self, result: OdooTestResult) -> None: ...
def cursor(self) -> Cursor: ... def cursor(self) -> Cursor: ...
@@ -88,9 +79,6 @@ 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 self, exception, func: Any | None = ..., *args, **kwargs
) -> Generator[Any, None, None] | None: ... ) -> Generator[Any, None, None] | None: ...
@@ -105,9 +93,6 @@ class BaseCase(case.TestCase, metaclass=MetaCase):
) -> None: ... ) -> 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) -> 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
@@ -120,10 +105,7 @@ class TransactionCase(BaseCase):
env: Environment env: Environment
cr: Cursor cr: Cursor
@classmethod @classmethod
def _gc_filestore(cls) -> None: ...
@classmethod
def setUpClass(cls) -> None: ... def setUpClass(cls) -> None: ...
_savepoint_id: int
def setUp(self): ... def setUp(self): ...
class SingleTransactionCase(BaseCase): class SingleTransactionCase(BaseCase):
@@ -154,58 +136,23 @@ class ChromeBrowser:
window_size: str window_size: str
touch_enabled: bool touch_enabled: bool
sigxcpu_handler: Any sigxcpu_handler: Any
_request_id: count[int]
_result: Future
error_checker: Any error_checker: Any
had_failure: bool had_failure: bool
_responses: dict[int, Future]
_frames: dict
_handlers: dict
_receiver: Thread
def __init__(self, test_class: type[HttpCase]) -> None: ... def __init__(self, test_class: type[HttpCase]) -> None: ...
def signal_handler(self, sig, frame) -> None: ... def signal_handler(self, sig, frame) -> None: ...
def stop(self) -> None: ... def stop(self) -> None: ...
@property @property
def executable(self) -> str | None: ... def executable(self) -> str | None: ...
def _chrome_without_limit(self, cmd) -> Popen: ...
def _spawn_chrome(self, cmd: list[str]) -> int | None: ...
def _chrome_start(self) -> None: ...
dev_tools_frontend_url: str dev_tools_frontend_url: str
def _find_websocket(self) -> None: ...
def _json_command(
self, command: str, timeout: int = ..., get_key: Any | None = ...
): ...
def _open_websocket(self) -> None: ...
def _receive(self, dbname: str) -> None: ...
def _websocket_request(
self, method: str, *, params: Any | None = ..., timeout: float = ...
): ...
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_frame_stopped_loading(self, frameId) -> None: ...
def _handle_screencast_frame(self, sessionId, data, metadata) -> None: ...
_TO_LEVEL: dict[str, int]
def take_screenshot( def take_screenshot(
self, prefix: str = ..., suffix: str | None = ... self, prefix: str = ..., suffix: str | None = ...
) -> Future: ... ) -> Future: ...
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_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): ...
LINE_PATTERN: str LINE_PATTERN: str
def _format_stack(self, logrecord: Mapping) -> None: ...
def console_formatter(self, args: list) -> Callable[[Match[str]], str]: ... def console_formatter(self, args: list) -> Callable[[Match[str]], str]: ...
class Opener(requests.Session): class Opener(requests.Session):
@@ -224,7 +171,6 @@ class HttpCase(TransactionCase):
browser_size: str browser_size: str
touch_enabled: bool touch_enabled: bool
allow_end_on_form: bool allow_end_on_form: bool
_logger: logging.Logger
@classmethod @classmethod
def setUpClass(cls) -> None: ... def setUpClass(cls) -> None: ...
xmlrpc_common: xmlrpclib.ServerProxy xmlrpc_common: xmlrpclib.ServerProxy
@@ -246,7 +192,6 @@ class HttpCase(TransactionCase):
allow_redirects: bool = ..., allow_redirects: bool = ...,
head: bool = ..., head: bool = ...,
) -> requests.Response: ... ) -> requests.Response: ...
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: ...

View File

@@ -1,119 +1,51 @@
import collections import collections
from typing import Any, Callable, Generic, Iterator, TypeVar from typing import Any, Generic, Iterator, TypeVar
from lxml.etree import _Element
from ..api import Environment
from ..models import BaseModel from ..models import BaseModel
_ModelT = TypeVar("_ModelT", bound=BaseModel) _ModelT = TypeVar("_ModelT", bound=BaseModel)
_FormT = TypeVar("_FormT", bound=Form) _FormT = TypeVar("_FormT", bound=Form)
class Form(Generic[_ModelT]): class Form(Generic[_ModelT]):
_record: _ModelT
_env: Environment
_models_info: dict
_view: Any
_values: dict
_changed: set
def __init__(self, record: _ModelT, view: Any | None = ...) -> None: ... def __init__(self, record: _ModelT, view: Any | None = ...) -> None: ...
def _process_view(
self, tree: _Element, model: BaseModel, level: int = ...
) -> dict: ...
def _get_one2many_edition_view(
self, field_info: dict, node: _Element, level: int
) -> dict: ...
def __str__(self) -> str: ...
def _init_from_defaults(self) -> None: ...
def __getattr__(self, field_name: str): ... def __getattr__(self, field_name: str): ...
def __setattr__(self, field_name: str, value) -> None: ... def __setattr__(self, field_name: str, value) -> None: ...
def _get_modifier(
self,
field_name: str,
modifier: str,
*,
view: Any | None = ...,
vals: dict | None = ...
): ...
_OPS: dict[str, Callable]
def _get_context(self, field_name: str): ...
def _get_eval_context(self) -> dict: ...
def __enter__(self: _FormT) -> _FormT: ... def __enter__(self: _FormT) -> _FormT: ...
def __exit__(self, exc_type, exc_value, traceback) -> None: ... def __exit__(self, exc_type, exc_value, traceback) -> None: ...
def save(self) -> _ModelT: ... def save(self) -> _ModelT: ...
@property @property
def record(self) -> _ModelT: ... def record(self) -> _ModelT: ...
def _values_to_save(self, all_fields: bool = ...) -> dict: ...
def _values_to_save_(
self,
values: dict,
fields: dict,
view: dict,
changed: set,
all_fields: bool = ...,
modifiers_values: dict | None = ...,
parent_link: str | None = ...,
) -> dict: ...
def _perform_onchange(self, field_name: str | None = ...) -> dict: ...
def _onchange_values(self) -> dict: ...
def _onchange_values_(self, fields: dict, values: dict) -> dict: ...
def _cleanup_onchange(self, field_info: dict, value, current): ...
class O2MForm(Form): class O2MForm(Form):
_proxy: O2MProxy
_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_name: str,
modifier: str,
*,
view: Any | None = ...,
vals: dict | None = ...
): ...
def _get_eval_context(self) -> dict: ...
def _onchange_values(self) -> dict: ...
def save(self) -> None: ... def save(self) -> None: ...
def _values_to_save(self, all_fields: bool = ...) -> dict: ...
class UpdateDict(dict): class UpdateDict(dict):
_changed: set
def __init__(self, *args, **kwargs) -> None: ... def __init__(self, *args, **kwargs) -> None: ...
def changed_items(self) -> Iterator[tuple]: ... def changed_items(self) -> Iterator[tuple]: ...
def update(self, *args, **kw) -> None: ... def update(self, *args, **kw) -> None: ...
class X2MProxy: class X2MProxy:
_form: Form
_field: str
_field_info: dict
def __init__(self, form: Form, field_name: str) -> None: ... def __init__(self, form: Form, field_name: str) -> None: ...
def _assert_editable(self) -> None: ...
class O2MProxy(X2MProxy): class O2MProxy(X2MProxy):
_records: list
def __init__(self, form: Form, field_name: str) -> None: ... def __init__(self, form: Form, field_name: str) -> None: ...
def __len__(self) -> int: ... def __len__(self) -> int: ...
@property
def _model(self) -> BaseModel: ...
def new(self) -> O2MForm: ... def new(self) -> O2MForm: ...
def edit(self, index: int) -> O2MForm: ... def edit(self, index: int) -> O2MForm: ...
def remove(self, index: int) -> None: ... def remove(self, index: int) -> None: ...
def _command_index(self, for_record: int) -> int: ...
class M2MProxy(X2MProxy, collections.abc.Sequence): class M2MProxy(X2MProxy, collections.abc.Sequence):
def __getitem__(self, index: int) -> BaseModel: ... def __getitem__(self, index: int) -> BaseModel: ...
def __len__(self) -> int: ... def __len__(self) -> int: ...
def __iter__(self) -> Iterator[BaseModel]: ... def __iter__(self) -> Iterator[BaseModel]: ...
def __contains__(self, record: BaseModel) -> bool: ... def __contains__(self, record: BaseModel) -> bool: ...
def _get_ids(self) -> list: ...
def add(self, record: BaseModel) -> None: ... def add(self, record: BaseModel) -> None: ...
def remove(self, id: int | None = ..., index: int | None = ...) -> None: ... def remove(self, id: int | None = ..., index: int | None = ...) -> None: ...
def clear(self) -> None: ... def clear(self) -> None: ...
def read_record(record: BaseModel, fields: dict) -> dict: ... def read_record(record: BaseModel, fields: dict) -> dict: ...
def _cleanup_from_default(type_: str, value): ...
class Dotter: class Dotter:
__values: Any
def __init__(self, values) -> None: ... def __init__(self, values) -> None: ...
def __getattr__(self, key): ... def __getattr__(self, key): ...

View File

@@ -1,13 +1,9 @@
from importlib.machinery import ModuleSpec
from types import ModuleType
from typing import Iterator from typing import Iterator
from .result import OdooTestResult from .result import OdooTestResult
from .suite import OdooSuite from .suite import OdooSuite
def get_test_modules(module: str) -> list: ... def get_test_modules(module: str) -> list: ...
def _get_tests_modules(mod: ModuleSpec) -> list: ...
def _get_upgrade_test_modules(module) -> Iterator[ModuleType]: ...
def make_suite(module_names: list[str], position: str = ...) -> OdooSuite: ... def make_suite(module_names: list[str], position: str = ...) -> OdooSuite: ...
def run_suite(suite: OdooSuite, module_name: str | None = ...) -> OdooTestResult: ... def run_suite(suite: OdooSuite, module_name: str | None = ...) -> OdooTestResult: ...
def unwrap_suite(test) -> Iterator: ... def unwrap_suite(test) -> Iterator: ...

View File

@@ -1,9 +1,7 @@
from collections.abc import Generator from collections.abc import Generator
from logging import Logger from logging import Logger
from re import Pattern
from typing import Any, NamedTuple from typing import Any, NamedTuple
__unittest: bool
STDOUT_LINE: str STDOUT_LINE: str
STDERR_LINE: str STDERR_LINE: str
stats_logger: Logger stats_logger: Logger
@@ -13,11 +11,7 @@ class Stat(NamedTuple):
queries: int queries: int
def __add__(self, other: Stat) -> Stat: ... def __add__(self, other: Stat) -> Stat: ...
_TEST_ID: Pattern
class OdooTestResult: class OdooTestResult:
_previousTestClass: Any
_moduleSetUpFailed: bool
failures_count: int failures_count: int
errors_count: int errors_count: int
testsRun: int testsRun: int
@@ -25,7 +19,6 @@ class OdooTestResult:
tb_locals: bool tb_locals: bool
time_start: float | None time_start: float | None
queries_start: int | None queries_start: int | None
_soft_fail: bool
had_failure: bool had_failure: bool
stats: dict[str, Stat] stats: dict[str, Stat]
def __init__( def __init__(
@@ -43,11 +36,6 @@ class OdooTestResult:
def addSuccess(self, test) -> None: ... def addSuccess(self, test) -> None: ...
def addSkip(self, test, reason) -> None: ... def addSkip(self, test, reason) -> None: ...
def wasSuccessful(self) -> bool: ... def wasSuccessful(self) -> bool: ...
def _exc_info_to_string(self, err, test) -> str: ...
def _is_relevant_tb_level(self, tb) -> bool: ...
def _count_relevant_tb_levels(self, tb) -> int: ...
def __repr__(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( def log(

View File

@@ -1,29 +1,7 @@
from typing import Any
from unittest import BaseTestSuite from unittest import BaseTestSuite
__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 _createClassOrModuleLevelException(
self, result, exception, method_name, parent, info: Any | None = ...
) -> None: ...
def _tearDownPreviousClass(self, test, result) -> None: ...
class _ErrorHolder:
failureException: Any
description: str
def __init__(self, description: str) -> None: ...
def id(self) -> str: ...
def shortDescription(self) -> None: ...
def __repr__(self) -> str: ...
def __str__(self) -> str: ...
def run(self, result) -> None: ...
def __call__(self, result) -> None: ...
def countTestCases(self) -> int: ...
class OdooSuite(TestSuite): class OdooSuite(TestSuite):
def _handleClassSetUp(self, test, result) -> None: ...
def _tearDownPreviousClass(self, test, result) -> None: ...
def has_http_case(self) -> bool: ... def has_http_case(self) -> bool: ...

View File

@@ -1,4 +1,3 @@
from re import Pattern
from typing import Any, Generic, TypeVar from typing import Any, Generic, TypeVar
from werkzeug.datastructures import CallbackDict from werkzeug.datastructures import CallbackDict
@@ -8,8 +7,6 @@ _ModificationTrackingDictT = TypeVar(
) )
_SessionT = TypeVar("_SessionT", bound=Session) _SessionT = TypeVar("_SessionT", bound=Session)
_sha1_re: Pattern
def generate_key(salt: Any = ...) -> str: ... def generate_key(salt: Any = ...) -> str: ...
class ModificationTrackingDict(CallbackDict): class ModificationTrackingDict(CallbackDict):
@@ -22,7 +19,6 @@ class Session(ModificationTrackingDict):
sid: str sid: str
new: bool new: bool
def __init__(self, data, sid, new: bool = ...): ... def __init__(self, data, sid, new: bool = ...): ...
def __repr__(self) -> str: ...
@property @property
def should_save(self) -> bool: ... def should_save(self) -> bool: ...
@@ -37,8 +33,6 @@ class SessionStore(Generic[_SessionT]):
def delete(self, session: _SessionT) -> None: ... def delete(self, session: _SessionT) -> None: ...
def get(self, sid: str) -> _SessionT: ... def get(self, sid: str) -> _SessionT: ...
_fs_transaction_suffix: str
class FilesystemSessionStore(SessionStore[_SessionT]): class FilesystemSessionStore(SessionStore[_SessionT]):
path: str | None path: str | None
filename_template: str filename_template: str

View File

@@ -3,15 +3,12 @@ from re import Pattern
class UserAgentParser(object): class UserAgentParser(object):
platforms: list[tuple[str, Pattern]] platforms: list[tuple[str, Pattern]]
browsers: list[tuple[str, Pattern]] browsers: list[tuple[str, Pattern]]
_browser_version_re: str
_language_re: Pattern
def __init__(self) -> None: ... def __init__(self) -> None: ...
def __call__( def __call__(
self, user_agent: str self, user_agent: str
) -> tuple[str | None, str | None, str | None, str | None]: ... ) -> tuple[str | None, str | None, str | None, str | None]: ...
class UserAgent(object): class UserAgent(object):
_parser: UserAgentParser
string: str string: str
platform: str | None platform: str | None
browser: str | None browser: str | None
@@ -19,7 +16,5 @@ class UserAgent(object):
language: str | None language: str | None
def __init__(self, environ_or_string: dict | str): ... def __init__(self, environ_or_string: dict | str): ...
def to_header(self) -> str: ... def to_header(self) -> str: ...
def __str__(self) -> str: ...
def __nonzero__(self) -> bool: ... def __nonzero__(self) -> bool: ...
__bool__ = __nonzero__ __bool__ = __nonzero__
def __repr__(self) -> str: ...

View File

@@ -1,7 +1,4 @@
from typing import Callable
__version_info__: tuple __version_info__: tuple
__version__: str
def user_data_dir( def user_data_dir(
appname: str | None = ..., appname: str | None = ...,
@@ -66,9 +63,3 @@ class AppDirs:
def user_cache_dir(self) -> str: ... def user_cache_dir(self) -> str: ...
@property @property
def user_log_dir(self) -> str: ... def user_log_dir(self) -> 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_ctypes(csidl_name: str) -> str: ...
_get_win_folder: Callable[[str], str]

View File

@@ -11,33 +11,15 @@ class MyOption(Option):
DEFAULT_LOG_HANDLER: str DEFAULT_LOG_HANDLER: str
def _get_default_datadir() -> str: ...
def _deduplicate_loggers(loggers) -> tuple[str, ...]: ...
class configmanager: class configmanager:
options: dict[str, Any] options: dict[str, Any]
blacklist_for_save: set[str] blacklist_for_save: set[str]
casts: dict casts: dict
misc: dict misc: dict
config_file: str config_file: str
_LOGLEVELS: dict
parser: OptionParser parser: OptionParser
def __init__(self, fname: str | None = ...) -> None: ... def __init__(self, fname: str | None = ...) -> None: ...
def parse_config(self, args: list | None = ...): ... def parse_config(self, args: list | None = ...): ...
rcfile: str
def _parse_config(self, args: list | None = ...): ...
def _warn_deprecated_options(self) -> None: ...
def _is_addons_path(self, path: str) -> bool: ...
def _check_addons_path(
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 _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 = ...): ...
@@ -52,6 +34,5 @@ class configmanager:
def filestore(self, dbname: str) -> str: ... def filestore(self, dbname: str) -> str: ...
def set_admin_password(self, new_password) -> None: ... def set_admin_password(self, new_password) -> None: ...
def verify_admin_password(self, password) -> bool: ... def verify_admin_password(self, password) -> bool: ...
def _normalize(self, path: str) -> str: ...
config: configmanager config: configmanager

View File

@@ -0,0 +1,6 @@
SCRIPT_EXTENSIONS: tuple[str, ...]
STYLE_EXTENSIONS: tuple[str, ...]
TEMPLATE_EXTENSIONS: tuple[str, ...]
ASSET_EXTENSIONS: tuple[str, ...]
SUPPORTED_DEBUGGER: set[str]
EXTERNAL_ASSET: object

View File

@@ -4,16 +4,8 @@ from typing import Any, Callable, TextIO
from lxml.etree import _Element from lxml.etree import _Element
from ..api import Environment from ..api import Environment
from ..sql_db import Cursor
from .misc import ustr as ustr from .misc import ustr as ustr
__all__ = [
"convert_file",
"convert_sql_import",
"convert_csv_import",
"convert_xml_import",
]
safe_eval: Callable safe_eval: Callable
class ParseError(Exception): ... class ParseError(Exception): ...
@@ -23,9 +15,6 @@ class RecordDictWrapper(dict):
def __init__(self, record) -> None: ... def __init__(self, record) -> None: ...
def __getitem__(self, key): ... def __getitem__(self, key): ...
def _get_idref(self, env: Environment, model_str: str, idref: dict) -> dict: ...
def _fix_multiple_roots(node: _Element) -> None: ...
def _eval_xml(self, node: _Element, env: Environment): ...
def str2bool(value) -> bool: ... def str2bool(value) -> bool: ...
def nodeattr2bool(node: _Element, attr, default: bool = ...) -> bool: ... def nodeattr2bool(node: _Element, attr, default: bool = ...) -> bool: ...
@@ -34,19 +23,10 @@ class xml_import:
self, node: _Element, eval_context: dict | None = ... self, node: _Element, eval_context: dict | None = ...
) -> Environment: ... ) -> 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 _tag_delete(self, rec: _Element) -> None: ...
def _tag_function(self, rec: _Element) -> 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_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( def model_id_get(
self, id_str: str, raise_if_not_found: bool = ... self, id_str: str, raise_if_not_found: bool = ...
) -> tuple[Any, Any]: ... ) -> tuple[Any, Any]: ...
def _tag_root(self, el: _Element) -> None: ...
@property @property
def env(self) -> Environment: ... def env(self) -> Environment: ...
@property @property
@@ -55,9 +35,7 @@ class xml_import:
module: str module: str
envs: list[Environment] envs: list[Environment]
idref: dict idref: dict
_noupdate: list[bool]
xml_filename: str xml_filename: str
_tags: dict[str, Callable]
def __init__( def __init__(
self, self,
env: Environment, env: Environment,

View File

@@ -1,7 +1,4 @@
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_round( def float_round(
value: float, value: float,
precision_digits: int | None = ..., precision_digits: int | None = ...,
@@ -20,9 +17,6 @@ def float_compare(
precision_rounding: float | None = ..., precision_rounding: float | None = ...,
) -> int: ... ) -> int: ...
def float_repr(value: float, precision_digits: int) -> str: ... def float_repr(value: float, precision_digits: int) -> str: ...
_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( def json_float_round(

View File

@@ -31,13 +31,9 @@ def classproperty(func: Callable[..., _T]) -> _ClassProperty[_T]: ...
class lazy: class lazy:
def __init__(self, func, *args, **kwargs) -> None: ... def __init__(self, func, *args, **kwargs) -> None: ...
@property
def _value(self): ...
def __getattr__(self, name): ... def __getattr__(self, name): ...
def __setattr__(self, name, value): ... def __setattr__(self, name, value): ...
def __delattr__(self, name): ... def __delattr__(self, name): ...
def __repr__(self): ...
def __str__(self): ...
def __bytes__(self): ... def __bytes__(self): ...
def __format__(self, format_spec): ... def __format__(self, format_spec): ...
def __lt__(self, other): ... def __lt__(self, other): ...

View File

@@ -1,11 +1,7 @@
from collections import OrderedDict from collections import OrderedDict
from threading import RLock
from typing import Any from typing import Any
__all__ = ["LRU"]
class LRU: class LRU:
_lock: RLock
count: int count: int
d: OrderedDict d: OrderedDict
def __init__(self, count: int, pairs: tuple[Any, Any] = ...) -> None: ... def __init__(self, count: int, pairs: tuple[Any, Any] = ...) -> None: ...

View File

@@ -3,21 +3,11 @@ from re import Pattern
from typing import Callable, Collection, FrozenSet, Literal from typing import Callable, Collection, FrozenSet, Literal
from lxml.etree import _Element from lxml.etree import _Element
from lxml.html import clean
from markupsafe import Markup from markupsafe import Markup
safe_attrs: FrozenSet safe_attrs: FrozenSet
SANITIZE_TAGS: dict[str, Collection[str]] SANITIZE_TAGS: dict[str, Collection[str]]
class _Cleaner(clean.Cleaner):
_style_re: Pattern
_style_whitelist: list[str]
strip_classes: bool
sanitize_style: bool
def __call__(self, doc: _Element) -> None: ...
def strip_class(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( def html_normalize(
src: str, filter_callback: Callable[[_Element], _Element] | None = ... src: str, filter_callback: Callable[[_Element], _Element] | None = ...

View File

@@ -1,30 +1,3 @@
import collections
from re import Pattern
from typing import Any, Literal
__all__ = ["guess_mimetype"]
_ooxml_dirs: dict[str, str]
def _check_ooxml(data: bytes) -> str | Literal[False]: ...
_mime_validator: Pattern
def _check_open_container_format(data: bytes) -> str | Literal[False]: ...
_xls_pattern: Pattern
_ppt_pattern: Pattern
def _check_olecf(data: bytes) -> str | Literal[False]: ...
def _check_svg(data: bytes) -> str | None: ...
_Entry = collections.namedtuple("_Entry", ["mimetype", "signatures", "discriminants"])
_mime_mappings: tuple[_Entry, ...]
def _odoo_guess_mimetype(bin_data: str, default: str = ...) -> str: ...
_guesser: 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) -> str: ...
def get_extension(filename: str) -> str: ... def get_extension(filename: str) -> str: ...

View File

@@ -1,6 +1,5 @@
import datetime import datetime
import pickle as pickle_ import pickle as pickle_
from collections import deque
from collections.abc import Mapping, MutableMapping, MutableSet from collections.abc import Mapping, MutableMapping, MutableSet
from contextlib import ContextDecorator, suppress from contextlib import ContextDecorator, suppress
from logging import Handler, LogRecord from logging import Handler, LogRecord
@@ -24,6 +23,8 @@ import markupsafe
import xlsxwriter import xlsxwriter
import xlwt import xlwt
from babel.core import Locale from babel.core import Locale
from odoo.addons.base.models.res_currency import Currency
from odoo.addons.base.models.res_lang import Lang
from xlwt import Worksheet from xlwt import Worksheet
from ..api import Environment from ..api import Environment
@@ -44,9 +45,6 @@ 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_command_pipe( def exec_command_pipe(
name: str, *args name: str, *args
) -> tuple[IO[AnyStr] | None, IO[AnyStr] | None]: ... ) -> tuple[IO[AnyStr] | None, IO[AnyStr] | None]: ...
@@ -108,8 +106,7 @@ def attrgetter(*items): ...
def discardattr(obj, key: str) -> None: ... def discardattr(obj, key: str) -> None: ...
def remove_accents(input_str: str) -> str: ... def remove_accents(input_str: str) -> str: ...
class unquote(str): class unquote(str): ...
def __repr__(self) -> str: ...
class mute_logger(Handler): class mute_logger(Handler):
loggers: tuple[str] loggers: tuple[str]
@@ -141,8 +138,6 @@ class lower_logging(Handler):
) -> None: ... ) -> None: ...
def emit(self, record: LogRecord) -> None: ... def emit(self, record: LogRecord) -> None: ...
_ph: Any
class CountingStream(Generic[_T]): class CountingStream(Generic[_T]):
stream: Iterator[_T] stream: Iterator[_T]
index: int index: int
@@ -155,7 +150,6 @@ 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]):
_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: ...
@@ -184,19 +178,16 @@ 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):
_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): ...
def __setitem__(self, key, val) -> None: ... def __setitem__(self, key, val) -> None: ...
def __delitem__(self, key) -> None: ... def __delitem__(self, key) -> None: ...
def __iter__(self) -> Iterator: ... def __iter__(self) -> Iterator: ...
def __len__(self) -> int: ... def __len__(self) -> int: ...
def __str__(self) -> str: ...
def pushmap(self, m: MutableMapping | None = ...) -> None: ... def pushmap(self, m: MutableMapping | None = ...) -> None: ...
def popmap(self) -> MutableMapping: ... def popmap(self) -> MutableMapping: ...
class OrderedSet(MutableSet): class OrderedSet(MutableSet):
_map: dict
def __init__(self, elems: Iterable = ...) -> None: ... def __init__(self, elems: Iterable = ...) -> None: ...
def __contains__(self, elem) -> bool: ... def __contains__(self, elem) -> bool: ...
def __iter__(self) -> Iterator: ... def __iter__(self) -> Iterator: ...
@@ -205,13 +196,11 @@ class OrderedSet(MutableSet):
def discard(self, elem) -> None: ... def discard(self, elem) -> None: ...
def update(self, elems: Iterable) -> None: ... def update(self, elems: Iterable) -> None: ...
def difference_update(self, elems: Iterable) -> None: ... def difference_update(self, elems: Iterable) -> None: ...
def __repr__(self) -> str: ...
class LastOrderedSet(OrderedSet): class LastOrderedSet(OrderedSet):
def add(self, elem) -> None: ... def add(self, elem) -> None: ...
class Callbacks: class Callbacks:
_funcs: deque
data: dict data: dict
def __init__(self) -> None: ... def __init__(self) -> None: ...
def add(self, func: Callable) -> None: ... def add(self, func: Callable) -> None: ...
@@ -251,7 +240,7 @@ 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 = ...) -> "Lang": ...
def babel_locale_parse(lang_code: str) -> Locale: ... def babel_locale_parse(lang_code: str) -> Locale: ...
def formatLang( def formatLang(
env: Environment, env: Environment,
@@ -260,7 +249,7 @@ def formatLang(
grouping: bool = ..., grouping: bool = ...,
monetary: bool = ..., monetary: bool = ...,
dp: bool = ..., dp: bool = ...,
currency_obj: "odoo.model.res_currency" = ..., currency_obj: "Currency" = ...,
) -> str: ... ) -> str: ...
def format_date( def format_date(
env: Environment, env: Environment,
@@ -279,34 +268,23 @@ def format_datetime(
def format_time( def format_time(
env: Environment, value, tz: str = ..., time_format: str = ..., lang_code: str = ... env: Environment, value, tz: str = ..., time_format: str = ..., lang_code: str = ...
) -> 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( def format_decimalized_amount(
amount: float, currency: "odoo.model.res_currency | None" = ... amount: float, currency: "Currency | None" = ...
) -> str: ... ) -> str: ...
def format_amount( def format_amount(
env: Environment, env: Environment,
amount: float, amount: float,
currency: "odoo.model.res_currency", currency: "Currency",
lang_code: str = ..., lang_code: str = ...,
) -> str: ... ) -> str: ...
def format_duration(value: float) -> str: ... def format_duration(value: float) -> str: ...
consteq: Callable[[str, str], bool] consteq: Callable[[str, str], bool]
_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 = ...
): ...
pickle: ModuleType pickle: ModuleType
class DotDict(dict): class DotDict(dict):

View File

@@ -1,8 +1,7 @@
from re import Pattern from re import Pattern
from typing import Callable, Iterator from typing import Callable
component_re: Pattern component_re: Pattern
replace: Callable replace: Callable
def _parse_version_parts(s: str) -> Iterator[str]: ...
def parse_version(s: str) -> tuple[str]: ... def parse_version(s: str) -> tuple[str]: ...

View File

@@ -2,17 +2,15 @@ from io import BytesIO
from re import Pattern from re import Pattern
from typing import Any, BinaryIO, Iterable from typing import Any, BinaryIO, Iterable
from odoo.addons.base.models.ir_attachment import IrAttachment
from PyPDF2 import PdfFileReader, PdfFileWriter from PyPDF2 import PdfFileReader, PdfFileWriter
from PyPDF2.generic import ArrayObject as ArrayObject 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
REGEX_SUBTYPE_UNFORMATED: Pattern REGEX_SUBTYPE_UNFORMATED: Pattern
REGEX_SUBTYPE_FORMATED: Pattern REGEX_SUBTYPE_FORMATED: Pattern
def _unwrapping_get(self, key, default: Any | None = ...): ...
class BrandedFileWriter(PdfFileWriter): class BrandedFileWriter(PdfFileWriter):
def __init__(self) -> None: ... def __init__(self) -> None: ...
@@ -20,7 +18,7 @@ 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: "IrAttachment") -> BytesIO: ...
def add_banner( def add_banner(
pdf_stream: str | BinaryIO, pdf_stream: str | BinaryIO,
text: str | None = ..., text: str | None = ...,
@@ -32,19 +30,13 @@ class OdooPdfFileReader(PdfFileReader):
def getAttachments(self) -> Iterable[tuple[Any, Any]]: ... def getAttachments(self) -> Iterable[tuple[Any, Any]]: ...
class OdooPdfFileWriter(PdfFileWriter): class OdooPdfFileWriter(PdfFileWriter):
_reader: PdfFileReader | None
is_pdfa: bool is_pdfa: bool
_header: bytes
_ID: Any
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
None 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( def embed_odoo_attachment(
self, attachment: "odoo.model.ir_attachment", subtype: str | None = ... self, attachment: "IrAttachment", subtype: str | None = ...
) -> 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: ...

View File

@@ -10,25 +10,17 @@ _T = TypeVar("_T")
real_datetime_now: Callable[..., datetime] real_datetime_now: Callable[..., datetime]
real_time: Callable[[], float] real_time: Callable[[], float]
def _format_frame(frame: FrameType) -> tuple[str, int, str, str]: ...
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 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: ...
class Collector: class Collector:
name: str | None name: str | None
_registry: dict[str, Any]
@classmethod @classmethod
def __init_subclass__(cls) -> None: ... def __init_subclass__(cls) -> None: ...
@classmethod @classmethod
def make(cls, name: str, *args, **kwargs): ... def make(cls, name: str, *args, **kwargs): ...
_processed: bool
_entries: list[dict]
profiler: Profiler | None profiler: Profiler | None
def __init__(self) -> None: ... def __init__(self) -> None: ...
def start(self) -> None: ... def start(self) -> None: ...
@@ -64,7 +56,6 @@ class SyncCollector(Collector):
def start(self) -> None: ... def start(self) -> None: ...
def stop(self) -> None: ... def stop(self) -> None: ...
def hook(self, _frame: FrameType, event: str, _arg: Any | None = ...): ... def hook(self, _frame: FrameType, event: str, _arg: Any | None = ...): ...
def _get_stack_trace(self, frame: FrameType | None = ...) -> None: ...
def post_process(self) -> None: ... def post_process(self) -> None: ...
class QwebTracker: class QwebTracker:
@@ -88,7 +79,6 @@ class QwebCollector(Collector):
events: list events: list
hook: Callable hook: Callable
def __init__(self) -> None: ... def __init__(self) -> None: ...
def _get_directive_profiling_name(self, directive: str, attrib: dict) -> str: ...
def start(self) -> None: ... def start(self) -> None: ...
def stop(self) -> None: ... def stop(self) -> None: ...
def post_process(self) -> None: ... def post_process(self) -> None: ...
@@ -125,7 +115,6 @@ class Profiler:
) -> 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 entry_count(self) -> int: ... def entry_count(self) -> int: ...
def format_path(self, path: str) -> str: ... def format_path(self, path: str) -> str: ...
def json(self) -> str: ... def json(self) -> str: ...

View File

@@ -1,12 +1,5 @@
from codecs import StreamReader, StreamWriter
from csv import Dialect from csv import Dialect
from typing import BinaryIO, Iterable, Iterator, Protocol from typing import BinaryIO, Iterable, Iterator
class _StreamReader(Protocol):
def __call__(self, stream: BinaryIO, errors: str = ...) -> StreamReader: ...
class _StreamWriter(Protocol):
def __call__(self, stream: BinaryIO, errors: str = ...) -> StreamWriter: ...
class _CsvReader(Iterator[list[str]]): class _CsvReader(Iterator[list[str]]):
dialect: Dialect dialect: Dialect
@@ -18,9 +11,6 @@ class _CsvWriter:
def writerow(self, row: Iterable): ... def writerow(self, row: Iterable): ...
def writerows(self, rows: Iterable[Iterable]) -> None: ... def writerows(self, rows: Iterable[Iterable]) -> None: ...
_reader: _StreamReader
_writer: _StreamWriter
def csv_reader(stream: BinaryIO, **params) -> _CsvReader: ... def csv_reader(stream: BinaryIO, **params) -> _CsvReader: ...
def csv_writer(stream: BinaryIO, **params) -> _CsvWriter: ... def csv_writer(stream: BinaryIO, **params) -> _CsvWriter: ...
def to_text(source) -> str: ... def to_text(source) -> str: ...

View File

@@ -5,19 +5,10 @@ from ..sql_db import Cursor
IDENT_RE: Pattern IDENT_RE: Pattern
def _from_table(table: str, alias: str) -> str: ...
def _generate_table_alias(src_table_alias: str, link: str) -> str: ...
class Query: class Query:
_cr: Cursor
_tables: dict[str, str]
_joins: dict[str, tuple]
_where_clauses: list[str]
_where_params: list
order: str | None order: str | None
limit: int | None limit: int | None
offset: int | None offset: int | None
_ids: tuple[int, ...] | None
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: ...
@@ -41,24 +32,12 @@ class Query:
extra: str | None = ..., extra: str | None = ...,
extra_params: tuple = ..., extra_params: tuple = ...,
) -> str: ... ) -> 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 is_empty(self) -> bool: ... def is_empty(self) -> bool: ...
def get_sql(self) -> tuple[str, str, list]: ... def get_sql(self) -> tuple[str, str, list]: ...
def get_result_ids(self) -> tuple[int, ...]: ... def get_result_ids(self) -> tuple[int, ...]: ...
def set_result_ids(self, ids, ordered: bool = ...) -> None: ... def set_result_ids(self, ids, ordered: bool = ...) -> None: ...
def __str__(self) -> str: ...
def __bool__(self) -> bool: ... def __bool__(self) -> bool: ...
def __len__(self) -> int: ... def __len__(self) -> int: ...
def __iter__(self) -> Iterator[int]: ... def __iter__(self) -> Iterator[int]: ...

View File

@@ -1,22 +1,13 @@
from types import CodeType from types import CodeType
from typing import Any, Iterable, Iterator, Literal from typing import Iterable, Iterator, Literal
from opcode import HAVE_ARGUMENT as HAVE_ARGUMENT from opcode import HAVE_ARGUMENT as HAVE_ARGUMENT
unsafe_eval = eval unsafe_eval = eval
_ALLOWED_MODULES: list[str]
_UNSAFE_ATTRIBUTES: list[str]
def to_opcodes( def to_opcodes(
opnames: Iterable[str], _opmap: dict[str, int] = ... opnames: Iterable[str], _opmap: dict[str, int] = ...
) -> Iterator[int]: ... ) -> Iterator[int]: ...
_BLACKLIST: set[int]
_CONST_OPCODES: set[int]
_operations: list[str]
_EXPR_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( def assert_valid_codeobj(
allowed_codes: set[int], code_obj: CodeType, expr: str allowed_codes: set[int], code_obj: CodeType, expr: str
@@ -26,16 +17,6 @@ def test_expr(
): ... ): ...
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 = ...,
): ...
_BUILTINS: dict[str, Any]
def safe_eval( def safe_eval(
expr: str, expr: str,
globals_dict: dict | None = ..., globals_dict: dict | None = ...,
@@ -49,10 +30,7 @@ def test_python_expr(expr: str, mode: str = ...) -> str | Literal[False]: ...
def check_values(d: dict): ... def check_values(d: dict): ...
class wrap_module: class wrap_module:
_repr: str
def __init__(self, module, attributes) -> None: ... def __init__(self, module, attributes) -> None: ...
def __repr__(self) -> str: ...
def __getattr__(self, item): ...
mods: list[str] mods: list[str]
datetime: wrap_module datetime: wrap_module

View File

@@ -1,15 +1,5 @@
from typing import Any
class SourceMapGenerator: class SourceMapGenerator:
_file: None
_source_root: str | None
_sources: dict[str, int]
_mappings: list[dict[str, Any]]
_sources_contents: dict[str, str]
_version: int
_cache: dict[tuple[int, int], str]
def __init__(self, source_root: str | None = ...) -> None: ... def __init__(self, source_root: str | None = ...) -> None: ...
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( def add_source(

View File

@@ -5,8 +5,6 @@ from typing import Iterable, Literal
from ..models import BaseModel from ..models import BaseModel
from ..sql_db import Cursor from ..sql_db import Cursor
_CONFDELTYPES: dict[str, str]
def existing_tables(cr: Cursor, tablenames: Iterable[str]) -> list[str]: ... def existing_tables(cr: Cursor, tablenames: Iterable[str]) -> list[str]: ...
def table_exists(cr: Cursor, tablename: str) -> bool: ... def table_exists(cr: Cursor, tablename: str) -> bool: ...
@@ -43,9 +41,6 @@ def convert_column(
def convert_column_translatable( def convert_column_translatable(
cr: Cursor, tablename: str, columnname: str, columntype: str cr: Cursor, tablename: str, columnname: str, columntype: str
) -> None: ... ) -> 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: ...

View File

@@ -1,24 +1,20 @@
import csv import csv
from collections import defaultdict, namedtuple from collections import defaultdict, namedtuple
from re import Match, Pattern from re import Pattern
from tarfile import TarFile from tarfile import TarFile
from types import FrameType
from typing import IO, Any, BinaryIO, Callable, Iterable, Iterator, NoReturn from typing import IO, Any, BinaryIO, Callable, Iterable, Iterator, NoReturn
from lxml.etree import HTMLParser, _Element from lxml.etree import _Element
from polib import POFile from polib import POFile
from ..api import Environment from ..api import Environment
from ..fields import Field from ..sql_db import Cursor
from ..models import BaseModel
from ..sql_db import Connection, Cursor
from .pycompat import _CsvWriter from .pycompat import _CsvWriter
PYTHON_TRANSLATION_COMMENT: str PYTHON_TRANSLATION_COMMENT: str
JAVASCRIPT_TRANSLATION_COMMENT: str JAVASCRIPT_TRANSLATION_COMMENT: str
WEB_TRANSLATION_COMMENT: str WEB_TRANSLATION_COMMENT: str
SKIPPED_ELEMENTS: tuple[str, ...] SKIPPED_ELEMENTS: tuple[str, ...]
_LOCALE2WIN32: dict[str, str]
class UNIX_LINE_TERMINATOR(csv.excel): class UNIX_LINE_TERMINATOR(csv.excel):
lineterminator: str lineterminator: str
@@ -40,9 +36,6 @@ def translate_xml_node(
) -> _Element: ... ) -> _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: ...
_HTML_PARSER: HTMLParser
def parse_html(text: str) -> _Element: ... def parse_html(text: str) -> _Element: ...
def serialize_html(node: _Element) -> str: ... def serialize_html(node: _Element) -> str: ...
def xml_translate(callback: Callable[[str], str | None], value: str) -> str: ... def xml_translate(callback: Callable[[str], str | None], value: str) -> str: ...
@@ -53,21 +46,10 @@ def get_text_content(term: str) -> str: ...
def translate_sql_constraint(cr: Cursor, key: str, lang: str) -> str: ... def translate_sql_constraint(cr: Cursor, key: str, lang: str) -> str: ...
class GettextAlias: class GettextAlias:
def _get_db(self) -> Connection | None: ...
def _get_cr(
self, frame: FrameType, allow_create: bool = ...
) -> tuple[Cursor, bool]: ...
def _get_uid(self, frame: FrameType) -> int: ...
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: ...
class _lt: class _lt:
_source: str
_args: tuple
_module: str
def __init__(self, source: str, *args, **kwargs) -> None: ... def __init__(self, source: str, *args, **kwargs) -> None: ...
def __str__(self) -> str: ...
def __eq__(self, other) -> NoReturn: ... def __eq__(self, other) -> NoReturn: ...
def __lt__(self, other) -> NoReturn: ... def __lt__(self, other) -> NoReturn: ...
def __add__(self, other: str | _lt) -> str: ... def __add__(self, other: str | _lt) -> str: ...
@@ -80,7 +62,6 @@ def quote(s: str) -> str: ...
re_escaped_char: Pattern re_escaped_char: Pattern
re_escaped_replacements: dict[str, str] re_escaped_replacements: dict[str, str]
def _sub_replacement(match_obj: Match) -> str: ...
def unquote(str: str) -> str: ... def unquote(str: str) -> str: ...
def TranslationFileReader( def TranslationFileReader(
source: IO, fileformat: str = ... source: IO, fileformat: str = ...
@@ -125,10 +106,6 @@ class TarFileWriter:
def trans_export( def trans_export(
lang: str, modules: list[str], buffer, format: str, cr: Cursor lang: str, modules: list[str], buffer, format: str, cr: Cursor
) -> None: ... ) -> 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 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( def extract_spreadsheet_terms(
@@ -138,47 +115,11 @@ def extract_spreadsheet_terms(
ImdInfo = namedtuple("ExternalId", ["name", "model", "res_id", "module"]) ImdInfo = namedtuple("ExternalId", ["name", "model", "res_id", "module"])
class TranslationModuleReader: class TranslationModuleReader:
_cr: Cursor
_modules: list[str]
_lang: str | None
env: Environment env: Environment
_to_translate: list[tuple]
_path_list: list[tuple[str, Any]]
_installed_modules: list[str]
def __init__( def __init__(
self, cr: Cursor, modules: list[str] | None = ..., lang: str | None = ... self, cr: Cursor, modules: list[str] | None = ..., lang: str | None = ...
) -> 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,
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 _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 _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 DeepDefaultDict() -> defaultdict: ... def DeepDefaultDict() -> defaultdict: ...
@@ -203,7 +144,6 @@ class TranslationImporter:
lang: str, lang: str,
xmlids: Iterable[str] | None = ..., xmlids: Iterable[str] | None = ...,
) -> 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( def trans_load(
@@ -225,19 +165,7 @@ class CodeTranslations:
python_translations: dict[tuple[str, str], dict] python_translations: dict[tuple[str, str], dict]
web_translations: dict[tuple[str, str], dict] web_translations: dict[tuple[str, str], dict]
def __init__(self) -> None: ... def __init__(self) -> None: ...
@staticmethod
def _get_po_paths(mod: str, lang: str) -> list[str]: ...
@staticmethod
def _read_code_translations_file(fileobj: IO, filter_func: Callable) -> dict: ...
@staticmethod
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_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: ...
def get_web_translations(self, module_name: str, lang: str) -> dict: ... def get_web_translations(self, module_name: str, lang: str) -> dict: ...
code_translations: CodeTranslations code_translations: CodeTranslations
def _get_translation_upgrade_queries(cr: Cursor, field: Field) -> tuple[list, list]: ...

View File

@@ -1,5 +1,4 @@
from ast import expr as _expr from ast import expr as _expr
from collections import defaultdict
from re import Pattern from re import Pattern
from typing import Callable, TypeVar from typing import Callable, TypeVar
@@ -7,14 +6,10 @@ from lxml.etree import RelaxNG, _Element
_CallableT = TypeVar("_CallableT", bound=Callable) _CallableT = TypeVar("_CallableT", bound=Callable)
_validators: defaultdict[str, list[Callable]]
_relaxng_cache: dict[str, RelaxNG | None]
READONLY: Pattern READONLY: Pattern
def _get_attrs_symbols() -> set[str]: ...
def get_variable_names(expr: str | _expr) -> set[str]: ... def get_variable_names(expr: str | _expr) -> set[str]: ...
def get_dict_asts(expr: str | _expr) -> dict: ... def get_dict_asts(expr: str | _expr) -> dict: ...
def _check(condition: bool, explanation: str) -> None: ...
def get_domain_identifiers(expr: str | _expr) -> tuple[set[str], set[str]]: ... def get_domain_identifiers(expr: str | _expr) -> tuple[set[str], set[str]]: ...
def valid_view(arch: _Element, **kwargs) -> bool: ... def valid_view(arch: _Element, **kwargs) -> bool: ...
def validate(*view_types: str) -> Callable[[_CallableT], _CallableT]: ... def validate(*view_types: str) -> Callable[[_CallableT], _CallableT]: ...

View File

@@ -3,7 +3,6 @@ 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
__docformat__: str
ENOENT: int ENOENT: int
windows: bool windows: bool
seen: set seen: set

View File

@@ -1,7 +1,8 @@
from typing import IO, Callable, Iterable, Literal from typing import IO, Callable, Iterable, Literal, Union
from lxml import etree from lxml import etree
from lxml.etree import _Element from lxml.etree import _Element
from odoo.addons.base.models.ir_attachment import IrAttachment
from ..api import Environment from ..api import Environment
@@ -11,12 +12,6 @@ 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 create_xml_node_chain( def create_xml_node_chain(
first_parent_node: _Element, first_parent_node: _Element,
nodes_list: Iterable[str], nodes_list: Iterable[str],
@@ -41,7 +36,7 @@ def load_xsd_files_from_url(
xsd_name_prefix: str = ..., xsd_name_prefix: str = ...,
xsd_names_filter: str | list[str] | None = ..., xsd_names_filter: str | list[str] | None = ...,
modify_xsd_content: Callable[[bytes], bytes] | None = ..., modify_xsd_content: Callable[[bytes], bytes] | None = ...,
) -> "odoo.model.ir_attachment | Literal[False]": ... ) -> "Union[IrAttachment, Literal[False]]": ...
def validate_xml_from_attachment( def validate_xml_from_attachment(
env: Environment, env: Environment,
xml_content, xml_content,