This commit is contained in:
Trinh Anh Ngoc
2023-05-19 14:41:42 +07:00
parent 25f426ca78
commit f8d2546c77
41 changed files with 44 additions and 705 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

@@ -6,7 +6,6 @@ from typing import (
Iterable, Iterable,
Iterator, Iterator,
KeysView, KeysView,
Literal,
Mapping, Mapping,
Optional, Optional,
Sequence, Sequence,
@@ -15,6 +14,9 @@ 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
@@ -52,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]):
@@ -81,8 +72,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, context: dict, su: bool = ... cls, cr: Cursor, uid: int, context: dict, su: bool = ...
) -> Environment: ... ) -> Environment: ...
@@ -96,7 +85,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: ...
@@ -107,11 +96,11 @@ 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: ...
@@ -146,10 +135,7 @@ NOTHING: object
EMPTY_DICT: frozendict EMPTY_DICT: frozendict
class Cache: class Cache:
_data: defaultdict[Field, dict]
def __init__(self) -> None: ... def __init__(self) -> None: ...
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 get(self, record: BaseModel, field: Field, default=...): ... def get(self, record: BaseModel, field: Field, default=...): ...
def set(self, record: BaseModel, field: Field, value) -> None: ... def set(self, record: BaseModel, field: Field, value) -> None: ...

View File

@@ -3,7 +3,6 @@ import enum
from typing import ( from typing import (
Any, Any,
Callable, Callable,
Collection,
Generic, Generic,
Iterator, Iterator,
Sequence, Sequence,
@@ -53,14 +52,6 @@ class Field(Generic[_FieldValueT], metaclass=MetaField):
column_cast_from: tuple[str, ...] column_cast_from: tuple[str, ...]
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: bool index: bool
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
@@ -97,54 +86,19 @@ 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(self, env: Environment) -> dict[str, Any]: ... def get_description(self, env: Environment) -> dict[str, Any]: ...
_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_deprecated: bool | None
_description_group_operator: str | None
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 null(self, record: BaseModel) -> bool: ... def null(self, record: BaseModel) -> bool: ...
def convert_to_column( def convert_to_column(
@@ -199,13 +153,11 @@ 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
column_cast_from: tuple[str, str, str] column_cast_from: tuple[str, str, 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
@@ -213,8 +165,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: ...
@@ -237,7 +187,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: ...
@@ -255,9 +204,6 @@ class _String(Field[str]):
translate: Callable | bool translate: Callable | bool
prefetch: Any prefetch: Any
def __init__(self, string: str = ..., **kwargs) -> None: ... def __init__(self, string: str = ..., **kwargs) -> None: ...
def _setup_attrs(self, model_class: type[BaseModel], name: str) -> None: ...
_related_translate: bool
def _description_translate(self, env: Environment) -> bool: ...
def get_trans_terms(self, value) -> list: ... def get_trans_terms(self, value) -> list: ...
def get_trans_func(self, records: BaseModel) -> Callable: ... def get_trans_func(self, records: BaseModel) -> Callable: ...
def write(self, records: _ModelT, value) -> _ModelT: ... def write(self, records: _ModelT, value) -> _ModelT: ...
@@ -267,14 +213,9 @@ class Char(_String):
column_cast_from: tuple[str] column_cast_from: tuple[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: ...
@@ -299,19 +240,6 @@ 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]: ...
_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: ...
@@ -375,17 +303,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: ...
@@ -404,8 +327,6 @@ class Image(Binary):
verify_resolution: bool verify_resolution: bool
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
@@ -418,13 +339,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 = ...
@@ -457,12 +371,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: ...
def null(self, record: BaseModel) -> BaseModel: ... def null(self, record: BaseModel) -> BaseModel: ...
class Many2one(_Relational): class Many2one(_Relational):
@@ -474,12 +382,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 = ...
): ... ): ...
@@ -492,17 +398,11 @@ 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) -> _ModelT: ... def write(self, records: _ModelT, value) -> _ModelT: ...
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
def convert_to_cache(self, value, record: BaseModel, validate: bool = ...): ... def convert_to_cache(self, value, record: BaseModel, validate: bool = ...): ...
def _remove_inverses(self, records: BaseModel, value) -> None: ...
def _update_inverses(self, records: BaseModel, value) -> None: ...
def _record_ids_per_res_model(self, records: BaseModel) -> dict[str, set]: ...
class Command(enum.IntEnum): class Command(enum.IntEnum):
CREATE: int CREATE: int
@@ -529,7 +429,6 @@ class Command(enum.IntEnum):
class _RelationalMulti(_Relational): class _RelationalMulti(_Relational):
write_sequence: int write_sequence: int
def _update(self, records: BaseModel, 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_record_multi(self, values, records: BaseModel): ... def convert_to_record_multi(self, values, records: BaseModel): ...
@@ -556,7 +455,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): ...
@@ -565,7 +463,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,9 +1,10 @@
from logging import Logger from logging import Logger
from typing import Any, Callable, Collection, Generator, TypeVar from typing import Any, Callable, Generator, TypeVar
import werkzeug import werkzeug
from odoo.addons.base.models.res_lang import Lang
from odoo.addons.website.models.website import Website
from werkzeug.exceptions import NotFound from werkzeug.exceptions import NotFound
from werkzeug.local import LocalStack
from werkzeug.routing import Map from werkzeug.routing import Map
from .api import Environment from .api import Environment
@@ -18,7 +19,6 @@ rpc_response: Logger
STATIC_CACHE: int STATIC_CACHE: int
STATIC_CACHE_LONG: int STATIC_CACHE_LONG: int
ALLOWED_DEBUG_MODES: list[str] ALLOWED_DEBUG_MODES: list[str]
_request_stack: LocalStack
request: HttpRequest | JsonRequest request: HttpRequest | JsonRequest
def replace_request_password(args) -> tuple: ... def replace_request_password(args) -> tuple: ...
@@ -33,17 +33,11 @@ class WebRequest:
endpoint: EndPoint | None endpoint: EndPoint | None
endpoint_arguments: Any endpoint_arguments: Any
auth_method: str | None auth_method: str | None
website: "odoo.model.website" website: "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"
_db: str | None
_cr: Cursor | None
_uid: int | None
_context: dict | None
_env: Environment | None
_failed: Exception | None
def __init__(self, httprequest: werkzeug.Request) -> None: ... def __init__(self, httprequest: werkzeug.Request) -> None: ...
@property @property
def cr(self) -> Cursor: ... def cr(self) -> Cursor: ...
@@ -62,13 +56,10 @@ class WebRequest:
def __enter__(self: _T) -> _T: ... def __enter__(self: _T) -> _T: ...
def __exit__(self, exc_type, exc_value, traceback) -> None: ... def __exit__(self, exc_type, exc_value, traceback) -> None: ...
def set_handler(self, endpoint: EndPoint, arguments, auth) -> None: ... def set_handler(self, endpoint: EndPoint, arguments, auth) -> None: ...
def _handle_exception(self, exception: Exception) -> None: ...
def redirect(self, location, code: int = ..., local: bool = ...) -> Response: ... def redirect(self, location, code: int = ..., local: bool = ...) -> Response: ...
def redirect_query( def redirect_query(
self, location, query: Any | None = ..., code: int = ..., local: bool = ... self, location, query: Any | None = ..., code: int = ..., local: bool = ...
) -> Response: ... ) -> Response: ...
def _is_cors_preflight(self, endpoint: EndPoint) -> bool: ...
def _call_function(self, *args, **kwargs): ...
def registry_cr(self) -> Generator[tuple[Registry, Cursor], None, None]: ... def registry_cr(self) -> Generator[tuple[Registry, Cursor], None, None]: ...
@property @property
def registry(self) -> Registry: ... def registry(self) -> Registry: ...
@@ -88,25 +79,17 @@ def route(
): ... ): ...
class JsonRequest(WebRequest): class JsonRequest(WebRequest):
_request_type: str
params: dict params: dict
jsonrequest: Any jsonrequest: Any
context: dict context: dict
def __init__(self, *args) -> None: ... def __init__(self, *args) -> None: ...
def _json_response(
self, result: Any | None = ..., error: dict | None = ...
) -> Response: ...
def _handle_exception(self, exception: Exception) -> Response: ...
def dispatch(self) -> Response: ... def dispatch(self) -> Response: ...
def serialize_exception(e: Exception) -> dict[str, Any]: ... def serialize_exception(e: Exception) -> dict[str, Any]: ...
class HttpRequest(WebRequest): class HttpRequest(WebRequest):
_request_type: str
params: dict params: dict
def __init__(self, *args) -> None: ... def __init__(self, *args) -> None: ...
def _handle_exception(self, exception: Exception): ...
def _is_cors_preflight(self, endpoint: EndPoint) -> bool: ...
def dispatch(self): ... def dispatch(self): ...
def make_response( def make_response(
self, self,
@@ -138,12 +121,6 @@ class EndPoint:
def __call__(self, *args, **kw): ... def __call__(self, *args, **kw): ...
def __eq__(self, other) -> bool: ... def __eq__(self, other) -> bool: ...
def __hash__(self) -> int: ... def __hash__(self) -> int: ...
def _as_tuple(self) -> tuple[Callable, dict]: ...
def __repr__(self) -> str: ...
def _generate_routing_rules(
modules: Collection[str], nodb_only: bool, converters: Any | None = ...
) -> Generator[tuple[str, EndPoint, dict], None, None]: ...
class AuthenticationError(Exception): ... class AuthenticationError(Exception): ...
class SessionExpiredException(Exception): ... class SessionExpiredException(Exception): ...
@@ -166,10 +143,8 @@ class OpenERPSession(sessions.Session):
def finalize(self) -> None: ... def finalize(self) -> None: ...
def check_security(self) -> None: ... def check_security(self) -> None: ...
def logout(self, keep_db: bool = ...) -> None: ... def logout(self, keep_db: bool = ...) -> None: ...
def _default_values(self) -> None: ...
context: dict context: dict
def get_context(self) -> dict: ... def get_context(self) -> dict: ...
def _fix_lang(self, context: dict) -> None: ...
def save_action(self, action) -> int: ... def save_action(self, action) -> int: ...
def get_action(self, key: int): ... def get_action(self, key: int): ...
@@ -200,7 +175,6 @@ class DisableCacheMiddleware:
def __call__(self, environ: dict, start_response: Callable): ... def __call__(self, environ: dict, start_response: Callable): ...
class Root: class Root:
_loaded: bool
def __init__(self) -> None: ... def __init__(self) -> None: ...
@property @property
def session_store(self) -> sessions.FilesystemSessionStore: ... def session_store(self) -> sessions.FilesystemSessionStore: ...

View File

@@ -17,6 +17,8 @@ from typing import (
import psycopg2 import psycopg2
from lxml.etree import _Element from lxml.etree import _Element
from odoo.addons.base.models.res_company import Company
from odoo.addons.base.models.res_partner import Partner
from . import api, fields from . import api, fields
from .api import Environment from .api import Environment
@@ -447,12 +449,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[Partner, 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 = ...
@@ -495,7 +493,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): ...
@@ -537,7 +535,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,4 +1,4 @@
from typing import Any, Iterable from typing import Any
from ..sql_db import Cursor from ..sql_db import Cursor
from ..tests.runner import OdooTestResult from ..tests.runner import OdooTestResult
@@ -17,7 +17,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(
cr: Cursor, cr: Cursor,
graph: Graph, graph: Graph,

View File

@@ -10,5 +10,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

@@ -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, 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.runner 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,18 +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
_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
@@ -47,7 +33,6 @@ class Registry(Mapping[str, type[BaseModel]]):
field_inverses: Collector field_inverses: Collector
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
populated_models: dict[str, list[int]] populated_models: dict[str, list[int]]
@@ -64,7 +49,6 @@ 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]]: ...
@@ -73,9 +57,6 @@ class Registry(Mapping[str, type[BaseModel]]):
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: ...
@@ -93,7 +74,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

View File

@@ -43,8 +43,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

@@ -28,7 +28,6 @@ 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 _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: ...
@@ -37,7 +36,6 @@ def check_leaf(element, internal: bool = ...) -> None: ...
def get_unaccent_wrapper(cr: Cursor) -> Callable[[Any], str]: ... def get_unaccent_wrapper(cr: Cursor) -> Callable[[Any], str]: ...
class expression: class expression:
_unaccent: Callable[[Any], str]
root_model: BaseModel root_model: BaseModel
root_alias: str | None root_alias: str | None
expression: _Domain expression: _Domain
@@ -52,5 +50,4 @@ class expression:
) -> None: ... ) -> None: ...
def get_tables(self) -> tuple[str, ...]: ... def get_tables(self) -> tuple[str, ...]: ...
def parse(self): ... def parse(self): ...
def __leaf_to_sql(self, leaf, model: BaseModel, alias: str) -> tuple[str, list]: ...
def to_sql(self) -> tuple[str, list]: ... def to_sql(self) -> tuple[str, list]: ...

View File

@@ -5,15 +5,7 @@ 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
@@ -40,23 +32,9 @@ 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 get_sql(self) -> tuple[str, str, list]: ... def get_sql(self) -> tuple[str, str, list]: ...
@property
def _result(self) -> list: ...
def __str__(self) -> str: ...
def __bool__(self) -> bool: ... def __bool__(self) -> bool: ...
def __len__(self) -> int: ... def __len__(self) -> int: ...
def __iter__(self) -> Iterator: ... def __iter__(self) -> Iterator: ...

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

@@ -2,11 +2,11 @@ from typing import Callable, TypeVar
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 check(f: _CallableT) -> _CallableT: ... def check(f: _CallableT) -> _CallableT: ...
def execute_cr(cr: Cursor, uid: int, obj: str, method: str, *args, **kw): ... def execute_cr(cr: Cursor, uid: int, obj: str, method: str, *args, **kw): ...

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
@@ -68,7 +68,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
@@ -162,7 +161,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
@@ -177,7 +175,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: ...
@@ -186,7 +183,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,17 +1,7 @@
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, Generator, Iterable, Iterator, NoReturn, TypeVar
Any,
Callable,
Generator,
Iterable,
Iterator,
Literal,
NoReturn,
Sequence,
TypeVar,
)
import psycopg2.extensions import psycopg2.extensions
from decorator import decorator from decorator import decorator
@@ -61,25 +51,15 @@ class Cursor(BaseCursor):
sql_into_log: dict sql_into_log: dict
sql_log: bool sql_log: bool
sql_log_count: int sql_log_count: int
_closed: bool
__pool: ConnectionPool
dbname: str dbname: str
_serialized: bool
_cnx: PsycoConnection
_obj: psycopg2.extensions.cursor
__caller: tuple[str, int | str] | Literal[False]
_default_log_exceptions: bool
cache: dict cache: dict
_now: datetime | None
def __init__( def __init__(
self, pool: ConnectionPool, dbname: str, dsn: dict, serialized: bool = ... self, pool: ConnectionPool, dbname: str, dsn: dict, serialized: bool = ...
) -> None: ... ) -> 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( def execute(
self, query, params: Any | None = ..., log_exceptions: Any | None = ... self, query, params: Any | None = ..., log_exceptions: Any | None = ...
): ... ): ...
@@ -88,7 +68,6 @@ class Cursor(BaseCursor):
) -> Iterator[tuple]: ... ) -> Iterator[tuple]: ...
def print_log(self): ... def print_log(self): ...
def close(self): ... def close(self): ...
def _close(self, leak: bool = ...) -> None: ...
def autocommit(self, on: bool) -> None: ... def autocommit(self, on: bool) -> None: ...
def after(self, event: str, func: Callable) -> None: ... def after(self, event: str, func: Callable) -> None: ...
def commit(self): ... def commit(self): ...
@@ -99,11 +78,6 @@ class Cursor(BaseCursor):
def now(self) -> datetime: ... def now(self) -> datetime: ...
class TestCursor(BaseCursor): class TestCursor(BaseCursor):
_savepoint_seq: Iterator[int]
_closed: bool
_cursor: Cursor
_lock: RLock
_savepoint: str
def __init__(self, cursor: Cursor, lock: RLock) -> None: ... def __init__(self, cursor: Cursor, lock: RLock) -> None: ...
def close(self) -> None: ... def close(self) -> None: ...
def autocommit(self, on: bool) -> None: ... def autocommit(self, on: bool) -> None: ...
@@ -115,24 +89,14 @@ class PsycoConnection(psycopg2.extensions.connection): ...
class ConnectionPool: class ConnectionPool:
def locked(fun: Callable[..., _T]) -> Callable[..., _T]: ... def locked(fun: Callable[..., _T]) -> Callable[..., _T]: ...
_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: ...
@@ -143,9 +107,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

@@ -3,23 +3,11 @@ import logging
import unittest import unittest
from itertools import count from itertools import count
from re import Pattern from re import Pattern
from types import TracebackType from typing import Any, Callable, Generator, Generic, Iterator, Mapping, Match, TypeVar
from typing import (
Any,
Callable,
Generator,
Generic,
Iterator,
Literal,
Mapping,
Match,
TypeVar,
)
from unittest import TestCase
from xmlrpc import client as xmlrpclib from xmlrpc import client as xmlrpclib
import requests import requests
from lxml.etree import _Element 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
@@ -53,14 +41,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
@@ -68,23 +52,11 @@ class RecordCapturer:
class OdooSuite(unittest.suite.TestSuite): class OdooSuite(unittest.suite.TestSuite):
def __init__(self, *args, **kwargs) -> None: ... def __init__(self, *args, **kwargs) -> None: ...
def _handleClassSetUp(self, test, result) -> None: ...
def _createClassOrModuleLevelException(
self, result, exc, method_name, parent, info: Any | None = ...
) -> None: ...
def _addClassOrModuleLevelException(
self, result, exception, errorName, info: Any | None = ...
) -> None: ...
def _tearDownPreviousClass(self, test, result) -> None: ...
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(unittest.TestCase, metaclass=MetaCase): class BaseCase(unittest.TestCase, metaclass=MetaCase):
_python_version: tuple
_class_cleanups: list
tearDown_exceptions: list tearDown_exceptions: list
registry: Registry registry: Registry
env: Environment env: Environment
@@ -106,9 +78,6 @@ class BaseCase(unittest.TestCase, metaclass=MetaCase):
def browse_ref(self, xid: str) -> BaseModel | None: ... def browse_ref(self, xid: str) -> BaseModel | None: ...
def patch(self, obj, key, val) -> None: ... def patch(self, obj, key, val) -> None: ...
def with_user(self, login: str) -> None: ... def with_user(self, login: str) -> 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: ...
@@ -123,20 +92,10 @@ class BaseCase(unittest.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
def profile(self, description: str = ..., **kwargs) -> Profiler: ... def profile(self, description: str = ..., **kwargs) -> Profiler: ...
def _callSetUp(self) -> None: ...
class _ErrorCatcher(list):
test: TestCase
def __init__(self, test: TestCase) -> None: ...
def append(self, error) -> None: ...
def _complete_traceback(self, initial_tb: TracebackType) -> TracebackType: ...
savepoint_seq: count[int] savepoint_seq: count[int]
@@ -146,7 +105,6 @@ class TransactionCase(BaseCase):
cr: Cursor cr: Cursor
@classmethod @classmethod
def setUpClass(cls) -> None: ... def setUpClass(cls) -> None: ...
_savepoint_id: int
def setUp(self): ... def setUp(self): ...
class SavepointCase(TransactionCase): class SavepointCase(TransactionCase):
@@ -182,33 +140,14 @@ class ChromeBrowser:
def stop(self) -> None: ... def stop(self) -> None: ...
@property @property
def executable(self) -> str | None: ... def executable(self) -> str | None: ...
def _spawn_chrome(self, cmd: list[str]) -> int | None: ...
def _chrome_start(self) -> None: ...
def _find_websocket(self) -> None: ...
def _json_command(
self, command: str, timeout: int = ..., get_key: Any | None = ...
): ...
def _open_websocket(self) -> None: ...
def _websocket_send(self, method: str, params: Any | None = ...) -> int | None: ...
def _get_message(self, raise_log_error: bool = ...) -> dict: ...
_TO_LEVEL: dict[str, int]
def _websocket_wait_id(self, awaited_id: int, timeout: int = ...) -> dict: ...
def _websocket_wait_event(
self, method: str, params: dict | None = ..., timeout: int = ...
) -> dict | None: ...
def take_screenshot(self, prefix: str = ..., suffix: str | None = ...) -> None: ... def take_screenshot(self, prefix: str = ..., suffix: str | None = ...) -> None: ...
def _save_screencast(self, prefix: str = ...) -> None: ...
screencasts_frames_dir: str screencasts_frames_dir: str
def start_screencast(self) -> None: ... def start_screencast(self) -> None: ...
def set_cookie(self, name: str, value, path, domain) -> dict: ... def set_cookie(self, name: str, value, path, domain) -> dict: ...
def delete_cookie(self, name: str, **kwargs) -> dict: ... def delete_cookie(self, name: str, **kwargs) -> dict: ...
def _wait_ready(self, ready_code, timeout: int = ...) -> bool: ...
def _wait_code_ok(self, code, timeout: float) -> Literal[True] | 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):
@@ -225,7 +164,6 @@ class HttpCase(TransactionCase):
registry_test_mode: bool registry_test_mode: bool
browser: ChromeBrowser browser: ChromeBrowser
browser_size: str browser_size: str
_logger: logging.Logger
@classmethod @classmethod
def setUpClass(cls) -> None: ... def setUpClass(cls) -> None: ...
xmlrpc_common: xmlrpclib.ServerProxy xmlrpc_common: xmlrpclib.ServerProxy
@@ -247,7 +185,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: OpenERPSession session: OpenERPSession
def authenticate(self, user, password) -> OpenERPSession: ... def authenticate(self, user, password) -> OpenERPSession: ...
@@ -279,90 +216,27 @@ def can_import(module: str) -> bool: ...
ref_re: Pattern ref_re: Pattern
class Form(Generic[_ModelT]): class Form(Generic[_ModelT]):
_env: Environment
_model: _ModelT
_view: dict
_values: dict
_changed: set
def __init__(self, recordp: _ModelT, view: _ModelT | str | None = ...) -> None: ... def __init__(self, recordp: _ModelT, view: _ModelT | str | None = ...) -> None: ...
def _o2m_set_edition_view(
self, descr: dict, node: _Element, level: int
) -> None: ...
def __str__(self) -> str: ...
def _process_fvg(self, model: BaseModel, fvg: dict, level: int = ...) -> None: ...
def _init_from_defaults(self, model: BaseModel) -> None: ...
def _init_from_values(self, values: BaseModel) -> None: ...
def __getattr__(self, field: str): ... def __getattr__(self, field: str): ...
def _get_modifier(
self,
field: str,
modifier: str,
*,
default: Any = ...,
view: Any = ...,
modmap: Any | None = ...,
vals: Any | None = ...
): ...
_OPS: dict[str, Callable[..., bool]]
def _get_context(self, field: str): ...
def __setattr__(self, field: str, value) -> None: ... def __setattr__(self, field: str, value) -> None: ...
def __enter__(self: _FormT) -> _FormT: ... def __enter__(self: _FormT) -> _FormT: ...
def __exit__(self, etype, _evalue, _etb) -> None: ... def __exit__(self, etype, _evalue, _etb) -> None: ...
def save(self) -> _ModelT: ... def save(self) -> _ModelT: ...
def _values_to_save(self, all_fields: bool = ...) -> dict: ...
def _values_to_save_(
self,
record_values: dict,
fields: dict,
view: Any,
changed: set,
all_fields: bool = ...,
modifiers_values: dict | None = ...,
parent_link: Any | None = ...,
) -> dict: ...
def _perform_onchange(self, fields: list[str]) -> dict: ...
def _onchange_values(self) -> dict: ...
def _onchange_values_(self, fields, record: dict) -> dict: ...
def _cleanup_onchange(self, descr: 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: str,
modifier: str,
*,
default: Any = ...,
view: Any = ...,
modmap: Any | None = ...,
vals: Any | None = ...
): ...
def _onchange_values(self) -> dict: ...
def save(self) -> None: ... def save(self) -> None: ...
def _values_to_save(self, all_fields: bool = ...) -> UpdateDict: ...
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[Any, Any]]: ... def changed_items(self) -> Iterator[tuple[Any, Any]]: ...
def update(self, *args, **kw) -> None: ... def update(self, *args, **kw) -> None: ...
class X2MProxy: class X2MProxy: ...
_parent: Form
_field: str
def _assert_editable(self) -> None: ...
class O2MProxy(X2MProxy): class O2MProxy(X2MProxy):
_records: list[dict]
def __init__(self, parent: Form, field: str) -> None: ... def __init__(self, parent: Form, field: str) -> None: ...
def __len__(self) -> int: ... def __len__(self) -> int: ...
@property
def _model(self) -> BaseModel: ...
@property
def _descr(self) -> dict: ...
def _command_index(self, for_record: int) -> int: ...
def new(self) -> O2MForm: ... def new(self) -> O2MForm: ...
def edit(self, index: int): ... def edit(self, index: int): ...
def remove(self, index: int) -> None: ... def remove(self, index: int) -> None: ...
@@ -374,13 +248,10 @@ class M2MProxy(X2MProxy, collections.Sequence):
def __iter__(self) -> Iterator[BaseModel]: ... def __iter__(self) -> Iterator[BaseModel]: ...
def __contains__(self, record: BaseModel) -> bool: ... def __contains__(self, record: BaseModel) -> bool: ...
def add(self, record: BaseModel) -> None: ... def add(self, record: BaseModel) -> None: ...
def _get_ids(self) -> list[int]: ...
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 record_to_values(fields: dict, record: BaseModel) -> dict: ... def record_to_values(fields: dict, record: BaseModel) -> dict: ...
def _cleanup_from_default(type_: str, value): ...
def _get_node(view, f, *arg): ...
def tagged(*tags: str) -> Callable[[_CallableT], _CallableT]: ... def tagged(*tags: str) -> Callable[[_CallableT], _CallableT]: ...
class TagsSelector: class TagsSelector:

View File

@@ -1,12 +1,9 @@
from types import ModuleType
from typing import Iterator from typing import Iterator
from ..tests import OdooSuite from ..tests import OdooSuite
from .runner import OdooTestResult from .runner import OdooTestResult
def get_test_modules(module: str) -> list: ... def get_test_modules(module: str) -> list: ...
def _get_tests_modules(path: str, module: str) -> 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,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,16 @@ 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 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) -> None: ... def save(self) -> None: ...
def get(self, key, default: Any | None = ...): ... def get(self, key, default: Any | None = ...): ...
@@ -52,6 +35,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

@@ -7,13 +7,6 @@ from ..api import Environment
from ..sql_db import Cursor 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 +16,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 +24,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_report(self, rec: _Element): ...
def _tag_function(self, rec: _Element) -> None: ...
def _tag_act_window(self, rec: _Element) -> None: ...
def _tag_menuitem(self, rec: _Element, parent: Any | None = ...) -> None: ...
def _tag_record(self, rec: _Element) -> tuple[str, int] | None: ...
def _tag_template(self, el: _Element) -> tuple[str, int] | None: ...
def id_get(self, id_str: str, raise_if_not_found: bool = ...) -> int | None: ... def id_get(self, id_str: str, raise_if_not_found: bool = ...) -> int | None: ...
def model_id_get( 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 +36,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,
cr: Cursor, cr: Cursor,

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

@@ -27,13 +27,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

@@ -2,10 +2,7 @@ from collections import OrderedDict
from threading import RLock 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

@@ -2,8 +2,6 @@ from email.message import Message
from re import Pattern from re import Pattern
from typing import FrozenSet, Literal from typing import FrozenSet, Literal
from lxml.etree import _Element
from lxml.html import clean
from markupsafe import Markup from markupsafe import Markup
tags_to_kill: list[str] tags_to_kill: list[str]
@@ -11,16 +9,6 @@ tags_to_remove: list[str]
allowed_tags: FrozenSet allowed_tags: FrozenSet
safe_attrs: FrozenSet safe_attrs: FrozenSet
class _Cleaner(clean.Cleaner):
_style_re: Pattern
_style_whitelist: list[str]
strip_classes: bool
sanitize_style: bool
def __call__(self, doc: _Element) -> None: ...
def tag_quote(self, el: _Element) -> None: ...
def strip_class(self, el: _Element) -> None: ...
def parse_style(self, el: _Element) -> None: ...
def html_sanitize( def html_sanitize(
src: str, src: str,
silent: bool = ..., silent: bool = ...,

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 logging import Filter, LogRecord from logging import Filter, LogRecord
from types import ModuleType from types import ModuleType
@@ -16,12 +15,15 @@ from typing import (
Iterator, Iterator,
NoReturn, NoReturn,
TypeVar, TypeVar,
Union,
) )
import markupsafe 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
@@ -41,9 +43,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 +107,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 UnquoteEvalContext(defaultdict): class UnquoteEvalContext(defaultdict):
def __init__(self, *args, **kwargs) -> None: ... def __init__(self, *args, **kwargs) -> None: ...
@@ -128,8 +126,6 @@ class mute_logger(Filter):
) -> None: ... ) -> None: ...
def __call__(self, func: _CallableT) -> _CallableT: ... def __call__(self, func: _CallableT) -> _CallableT: ...
_ph: Any
class CountingStream(Generic[_T]): class CountingStream(Generic[_T]):
stream: Iterator[_T] stream: Iterator[_T]
index: int index: int
@@ -142,7 +138,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: ...
@@ -171,19 +166,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: ...
@@ -192,13 +184,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: ...
@@ -230,7 +220,7 @@ def ignore(*exc) -> None: ...
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,
@@ -239,7 +229,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,
@@ -258,24 +248,17 @@ 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: "Union[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: ...
def _consteq(str1: str, str2: str) -> bool: ...
consteq: Callable[[str, str], bool] consteq: Callable[[str, str], bool]
@@ -283,10 +266,6 @@ class Unpickler(pickle_.Unpickler):
find_global: Any find_global: Any
find_class: Any find_class: Any
def _pickle_load(
stream: pickle_._ReadableFileobj, encoding: str = ..., errors: bool = ...
): ...
pickle: ModuleType pickle: ModuleType
class DotDict(dict): class DotDict(dict):

View File

@@ -1,4 +1,3 @@
import ctypes
from re import Pattern from re import Pattern
from typing import Any, BinaryIO, Callable, Generator, Iterable, Iterator from typing import Any, BinaryIO, Callable, Generator, Iterable, Iterator
@@ -19,7 +18,3 @@ def zip_dir(
getppid: Callable[[], int] getppid: Callable[[], int]
is_running_as_nt_service: Callable[[], bool] is_running_as_nt_service: Callable[[], bool]
_TH32CS_SNAPPROCESS: int
class _PROCESSENTRY32(ctypes.Structure):
_fields_: list[tuple[str, Any]]

View File

@@ -4,5 +4,4 @@ from typing import Callable, Iterator
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: ...
@@ -31,19 +29,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,33 +10,22 @@ _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: ...
def stop(self) -> None: ... def stop(self) -> None: ...
def add(self, entry: dict | None = ..., frame: FrameType | None = ...) -> None: ... def add(self, entry: dict | None = ..., frame: FrameType | None = ...) -> None: ...
def _get_stack_trace(
self, frame: FrameType | None = ...
) -> list[tuple[str, int, str, str]]: ...
def post_process(self) -> None: ... def post_process(self) -> None: ...
@property @property
def entries(self) -> list[dict]: ... def entries(self) -> list[dict]: ...
@@ -64,7 +53,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 +76,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 +112,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

@@ -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
@@ -24,16 +15,6 @@ def assert_valid_codeobj(
def test_expr(expr: str, allowed_codes: set[int], mode: str = ...): ... def test_expr(expr: str, allowed_codes: set[int], mode: str = ...): ...
def const_eval(expr: str): ... def const_eval(expr: str): ...
def expr_eval(expr: str): ... def expr_eval(expr: str): ...
def _import(
name: str,
globals: dict | None = ...,
locals: dict | None = ...,
fromlist: list | None = ...,
level: int = ...,
): ...
_BUILTINS: dict[str, Any]
def safe_eval( def safe_eval(
expr: str, expr: str,
globals_dict: dict | None = ..., globals_dict: dict | None = ...,
@@ -46,9 +27,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): ... def __getattr__(self, item): ...
mods: list[str] mods: list[str]

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

@@ -3,8 +3,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: ...
def table_kind(cr: Cursor, tablename: str) -> str | None: ... def table_kind(cr: Cursor, tablename: str) -> str | None: ...

View File

@@ -1,21 +1,18 @@
import csv import csv
from collections import namedtuple from collections import 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, Container, Iterable, Iterator, NoReturn from typing import IO, Any, BinaryIO, Callable, Container, 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 ..models import BaseModel from ..sql_db import Cursor
from ..sql_db import Connection, Cursor
from .pycompat import _CsvWriter from .pycompat import _CsvWriter
WEB_TRANSLATION_COMMENT: str WEB_TRANSLATION_COMMENT: str
SKIPPED_ELEMENTS: tuple[str, ...] SKIPPED_ELEMENTS: tuple[str, ...]
_LOCALE2WIN32: dict[str, str]
ENGLISH_SMALL_WORDS: set[str] ENGLISH_SMALL_WORDS: set[str]
class UNIX_LINE_TERMINATOR(csv.excel): class UNIX_LINE_TERMINATOR(csv.excel):
@@ -39,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: ...
@@ -52,20 +46,10 @@ def translate(
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) -> str: ...
class _lt: class _lt:
_source: str
_args: tuple
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: ...
@@ -78,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 = ...
@@ -124,56 +107,17 @@ 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 trans_parse_rml(de: Iterable) -> list[bytes]: ... def trans_parse_rml(de: Iterable) -> list[bytes]: ...
def _push(callback: Callable[[str, int], Any], term: str, source_line: int) -> None: ...
def in_modules(object_name: str, modules: Container[str]) -> bool: ... def in_modules(object_name: str, modules: Container[str]) -> bool: ...
def _extract_translatable_qweb_terms(
element: _Element, callback: Callable[[str, int], Any]
) -> None: ...
def babel_extract_qweb(fileobj: IO, keywords, comment_tags, options) -> list[tuple]: ... def babel_extract_qweb(fileobj: IO, keywords, comment_tags, options) -> list[tuple]: ...
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 = ...,
) -> 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 trans_load( def trans_load(
cr: Cursor, cr: Cursor,

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

@@ -10,9 +10,6 @@ class odoo_resolver(etree.Resolver):
def __init__(self, env: Environment) -> None: ... def __init__(self, env: Environment) -> None: ...
def resolve(self, url: str, id: str, context) -> str: ... def resolve(self, url: str, id: str, context) -> str: ...
def _check_with_xsd(
tree_or_str: str | _Element, stream: str | IO, env: Environment | None = ...
) -> None: ...
def 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],