Update stubs

This commit is contained in:
Trinh Anh Ngoc
2023-04-22 16:08:06 +07:00
parent b7de5e24cd
commit c2b4f78846
6 changed files with 40 additions and 32 deletions

View File

@@ -1,6 +1,6 @@
import datetime import datetime
import enum import enum
from typing import Any, Callable, Container, Collection, Iterator, Sequence, TypeVar, Union from typing import Any, Callable, Container, Collection, Iterator, Sequence, Type, TypeVar, Union
import psycopg2 import psycopg2
from markupsafe import Markup from markupsafe import Markup
@@ -87,9 +87,9 @@ class Field(metaclass=MetaField):
def __init__(self, string: str = ..., **kwargs) -> None: ... def __init__(self, string: str = ..., **kwargs) -> None: ...
def __str__(self) -> str: ... def __str__(self) -> str: ...
def __repr__(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 _get_attrs(self, model_class: Type[BaseModel], name: str) -> dict[str, Any]: ...
def _setup_attrs(self, model_class: type[BaseModel], name: str): ... 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: ...
@@ -166,15 +166,16 @@ class Field(metaclass=MetaField):
class Boolean(Field): class Boolean(Field):
type: str type: str
column_type: type[str, str] column_type: tuple[str, str]
def convert_to_column(self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...) -> bool: ... def convert_to_column(self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...) -> bool: ...
def convert_to_cache(self, value, record: BaseModel, validate: bool = ...) -> bool: ... def convert_to_cache(self, value, record: BaseModel, validate: bool = ...) -> bool: ...
def convert_to_export(self, value, record: BaseModel): ... def convert_to_export(self, value, record: BaseModel): ...
class Integer(Field): class Integer(Field):
type: str type: str
column_type: type[str, str] column_type: tuple[str, str]
group_operator: str group_operator: str
def _get_attrs(self, model_class: Type[BaseModel], name: str): ...
def convert_to_column(self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...) -> int: ... def convert_to_column(self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...) -> int: ...
def convert_to_cache(self, value, record: BaseModel, validate: bool = ...) -> int | None: ... def convert_to_cache(self, value, record: BaseModel, validate: bool = ...) -> int | None: ...
def convert_to_record(self, value, record: BaseModel): ... def convert_to_record(self, value, record: BaseModel): ...
@@ -191,7 +192,7 @@ class Float(Field):
def column_type(self): ... def column_type(self): ...
def get_digits(self, env: Environment) -> tuple[int, int]: ... def get_digits(self, env: Environment) -> tuple[int, int]: ...
_related__digits: Any _related__digits: Any
def _description_digits(self, env: Environment) -> type[int, int]: ... def _description_digits(self, env: Environment) -> tuple[int, int]: ...
def convert_to_column(self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...) -> float: ... def convert_to_column(self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...) -> float: ...
def convert_to_cache(self, value, record: BaseModel, validate: bool = ...) -> float: ... def convert_to_cache(self, value, record: BaseModel, validate: bool = ...) -> float: ...
def convert_to_record(self, value, record: BaseModel): ... def convert_to_record(self, value, record: BaseModel): ...
@@ -239,7 +240,7 @@ class Char(_String):
type: str type: str
size: int | None size: int | None
trim: bool trim: bool
def _setup_attrs(self, model_class: type[BaseModel], name: str) -> None: ... 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: ...
@@ -266,7 +267,7 @@ 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]: ... def _get_attrs(self, model_class: Type[BaseModel], name: str) -> dict[str, Any]: ...
@property @property
def column_type(self) -> tuple[str, str]: ... def column_type(self) -> tuple[str, str]: ...
_related_sanitize: bool _related_sanitize: bool
@@ -338,7 +339,7 @@ class Binary(Field):
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]: ... def _get_attrs(self, model_class: Type[BaseModel], name: str) -> dict[str, Any]: ...
_description_attachment: bool _description_attachment: bool
def convert_to_column(self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...) -> psycopg2.Binary | None: ... def convert_to_column(self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...) -> psycopg2.Binary | None: ...
def convert_to_cache(self, value, record: BaseModel, validate: bool = ...) -> bytes | None: ... def convert_to_cache(self, value, record: BaseModel, validate: bool = ...) -> bytes | None: ...
@@ -367,8 +368,8 @@ class Selection(Field):
def __init__(self, selection: _SelectionRaw = ..., string: str = ..., **kwargs) -> None: ... def __init__(self, selection: _SelectionRaw = ..., string: str = ..., **kwargs) -> None: ...
def setup_nonrelated(self, model: BaseModel) -> None: ... def setup_nonrelated(self, model: BaseModel) -> None: ...
def setup_related(self, model: BaseModel): ... def setup_related(self, model: BaseModel): ...
def _get_attrs(self, model_class: type[BaseModel], name: str) -> dict[str, Any]: ... def _get_attrs(self, model_class: Type[BaseModel], name: str) -> dict[str, Any]: ...
def _setup_attrs(self, model_class: type[BaseModel], name: str) -> None: ... def _setup_attrs(self, model_class: Type[BaseModel], name: str) -> None: ...
def _selection_modules(self, model: BaseModel) -> dict[str, set[str, str]]: ... def _selection_modules(self, model: BaseModel) -> dict[str, set[str, str]]: ...
def _description_selection(self, env: Environment) -> _Selection: ... def _description_selection(self, env: Environment) -> _Selection: ...
def _default_group_expand(self, records: BaseModel, groups, domain, order) -> _Selection: ... def _default_group_expand(self, records: BaseModel, groups, domain, order) -> _Selection: ...
@@ -411,7 +412,7 @@ class Many2one(_Relational):
auto_join: bool auto_join: bool
delegate: bool delegate: bool
def __init__(self, comodel_name: str = ..., string: str = ..., **kwargs) -> None: ... def __init__(self, comodel_name: str = ..., string: str = ..., **kwargs) -> None: ...
def _setup_attrs(self, model_class: type[BaseModel], name: str) -> None: ... def _setup_attrs(self, model_class: Type[BaseModel], name: str) -> None: ...
def setup_nonrelated(self, model: BaseModel) -> None: ... def setup_nonrelated(self, model: BaseModel) -> None: ...
def update_db(self, model: BaseModel, columns): ... def update_db(self, model: BaseModel, columns): ...
def update_db_column(self, model: BaseModel, column) -> None: ... def update_db_column(self, model: BaseModel, column) -> None: ...
@@ -434,6 +435,7 @@ class Many2oneReference(Integer):
type: str type: str
model_field: str | None model_field: str | None
_related_model_field: str | None _related_model_field: str | None
group_operator: str | None
def convert_to_cache(self, value, record: BaseModel, validate: bool = ...): ... def convert_to_cache(self, value, record: BaseModel, validate: bool = ...): ...
def _update_inverses(self, records: BaseModel, value) -> None: ... def _update_inverses(self, records: BaseModel, value) -> None: ...
def _record_ids_per_res_model(self, records: BaseModel) -> dict[str, set]: ... def _record_ids_per_res_model(self, records: BaseModel) -> dict[str, set]: ...
@@ -464,7 +466,7 @@ class Properties(Field):
ALLOWED_TYPES: tuple[str, ...] ALLOWED_TYPES: tuple[str, ...]
_depends: tuple[str, ...] _depends: tuple[str, ...]
compute: Callable compute: Callable
def _setup_attrs(self, model_class: type[BaseModel], name: str) -> None: ... def _setup_attrs(self, model_class: Type[BaseModel], name: str) -> None: ...
def convert_to_column(self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...): ... def convert_to_column(self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...): ...
def convert_to_cache(self, value, record: BaseModel, validate: bool = ...): ... def convert_to_cache(self, value, record: BaseModel, validate: bool = ...): ...
def convert_to_record(self, value, record: BaseModel): ... def convert_to_record(self, value, record: BaseModel): ...

View File

@@ -98,9 +98,9 @@ class FilesystemSessionStore(sessions.FilesystemSessionStore):
def vacuum(self) -> None: ... def vacuum(self) -> None: ...
class Session(MutableMapping): class Session(MutableMapping):
__slots__ = ('can_save', 'data', 'is_dirty', 'is_explicit', 'is_new', 'should_rotate', 'sid') __slots__ = ('can_save', '_Session__data', 'is_dirty', 'is_explicit', 'is_new', 'should_rotate', 'sid')
can_save: bool can_save: bool
data: dict __data: dict
is_dirty: bool is_dirty: bool
is_explicit: bool is_explicit: bool
is_new: bool is_new: bool

View File

@@ -2,6 +2,7 @@ from collections import defaultdict
from re import Pattern from re import Pattern
from typing import Any, Callable, Collection, Container, Iterable, Iterator, MutableMapping, Sequence, TypeVar, Union from typing import Any, Callable, Collection, Container, Iterable, Iterator, MutableMapping, Sequence, TypeVar, Union
import dateutil.relativedelta
import psycopg2 import psycopg2
from . import api, fields from . import api, fields
@@ -20,10 +21,12 @@ regex_order: Pattern[str]
regex_object_name: Pattern[str] regex_object_name: Pattern[str]
regex_pg_name: Pattern[str] regex_pg_name: Pattern[str]
regex_field_agg: Pattern[str] regex_field_agg: Pattern[str]
regex_read_group_spec: Pattern[str]
AUTOINIT_RECALCULATE_STORED_FIELDS: int AUTOINIT_RECALCULATE_STORED_FIELDS: int
INSERT_BATCH_SIZE: int INSERT_BATCH_SIZE: int
SQL_DEFAULT: psycopg2.extensions.AsIs SQL_DEFAULT: psycopg2.extensions.AsIs
def parse_read_group_spec(spec: str) -> tuple: ...
def check_object_name(name: str) -> bool: ... def check_object_name(name: str) -> bool: ...
def raise_on_invalid_object_name(name: str) -> None: ... def raise_on_invalid_object_name(name: str) -> None: ...
def check_pg_name(name: str) -> None: ... def check_pg_name(name: str) -> None: ...
@@ -65,7 +68,9 @@ IdType: tuple[type[int], type[NewId]]
PREFETCH_MAX: int PREFETCH_MAX: int
LOG_ACCESS_COLUMNS: list[str] LOG_ACCESS_COLUMNS: list[str]
MAGIC_COLUMNS: list[str] MAGIC_COLUMNS: list[str]
VALID_AGGREGATE_FUNCTIONS: set[str] READ_GROUP_TIME_GRANULARITY: dict[str, dateutil.relativedelta.relativedelta]
READ_GROUP_AGGREGATE: dict[str, Callable[[str, str], str]]
READ_GROUP_DISPLAY_FORMAT: dict[str, str]
def is_definition_class(cls) -> bool: ... def is_definition_class(cls) -> bool: ...
def is_registry_class(cls) -> bool: ... def is_registry_class(cls) -> bool: ...
@@ -157,17 +162,20 @@ class BaseModel(metaclass=MetaModel):
def _add_missing_default_values(self, values: dict[str, Any]) -> dict[str, Any]: ... def _add_missing_default_values(self, values: dict[str, Any]) -> dict[str, Any]: ...
@classmethod @classmethod
def clear_caches(cls) -> None: ... def clear_caches(cls) -> None: ...
def _read_group(self, domain: _Domain, groupby: Iterable[str] = ..., aggregates: Iterable[str] = ..., having: _Domain = ..., offset: int = ..., limit: int | None = ..., order: str | None = ...) -> list[tuple]: ...
def _read_group_select(self, aggregate_spec: str, query: Query) -> tuple[str, list[str]]: ...
def _read_group_groupby(self, groupby_spec: str, query: Query) -> tuple[str, list[str]]: ...
def _read_group_having(self, having_domain: _Domain, query: Query) -> tuple[str, list, list[str]]: ...
def _read_group_orderby(self, order: str | None, groupby: Iterable[str], query: Query) -> tuple[list[str], list[str], list[str]]: ...
def _read_group_check_field_access_rights(self, field_names: Collection[str]) -> None: ...
def _read_group_empty_value(self, spec: str) -> Any: ...
def _read_group_postprocess_groupby(self, groupby_spec: str, raw_values) -> Iterator: ...
def _read_group_postprocess_aggregate(self, aggregate_spec: str, raw_values) -> Iterator: ...
def _read_group_expand_full(self, groups: _ModelT, domain: _Domain | None, order: str | None) -> _ModelT: ... def _read_group_expand_full(self, groups: _ModelT, domain: _Domain | None, order: str | None) -> _ModelT: ...
def _read_group_fill_results(self, domain: _Domain, groupby: str, remaining_groupbys: list[str], aggregated_fields: list[str], count_field: str, read_group_result, read_group_order: str | None = ...) -> list: ... def _read_group_fill_results(self, domain: _Domain, groupby: str, annoted_aggregates: dict[str, str], read_group_result: list[dict], read_group_order: str | None = ...) -> list: ...
def _read_group_fill_temporal(self, data: list, groupby: list[str], aggregated_fields: list[str], annotated_groupbys: list[dict], fill_from: str | None = ..., fill_to: str | None = ..., min_groups: int | None = ...) -> list: ... def _read_group_fill_temporal(self, data: list, groupby: list[str], annoted_aggregates: dict[str, str], fill_from: bool = ..., fill_to: bool = ..., min_groups: bool = ...) -> list: ...
def _read_group_prepare(self, orderby: str, aggregated_fields: list[str], annotated_groupbys: list[dict], query: Query) -> tuple[list, list]: ... def _read_group_format_result(self, rows_dict: Iterable[dict], lazy_groupby: Iterable[str]) -> None: ...
def _read_group_process_groupby(self, gb: str, query: Query) -> dict[str, Any]: ...
def _read_group_prepare_data(self, key, value, groupby_dict: dict[str, dict[str, Any]]) -> Any: ...
def _read_group_format_result(self, data: dict, annotated_groupbys: list[dict], groupby: list, domain: _Domain) -> dict: ...
def _read_group(self, domain: _Domain, fields: list[str], groupby: str | list[str], offset: int = ..., limit: int | None = ..., orderby: str | None = ..., lazy: bool = ...) -> list[dict[str, Any]]: ...
def read_group(self, domain: _Domain, fields: list[str], groupby: str | list[str], offset: int = ..., limit: int | None = ..., orderby: str | None = ..., lazy: bool = ...) -> list[dict[str, Any]]: ... def read_group(self, domain: _Domain, fields: list[str], groupby: str | list[str], offset: int = ..., limit: int | None = ..., orderby: str | None = ..., lazy: bool = ...) -> list[dict[str, Any]]: ...
def _read_group_raw(self, domain: _Domain, fields: list[str], groupby: str | list[str], offset: int = ..., limit: int | None = ..., orderby: str | None = ..., lazy: bool = ...) -> list[dict[str, Any]]: ...
def _read_group_resolve_many2x_fields(self, data: list[dict[str, Any]], fields: list[dict[str, Any]]) -> None: ...
def _inherits_join_add(self, current_model: BaseModel, parent_model_name: str, query: Query) -> str: ... def _inherits_join_add(self, current_model: BaseModel, parent_model_name: str, query: Query) -> str: ...
def _inherits_join_calc(self, alias: str, fname: str, query: Query) -> str: ... def _inherits_join_calc(self, alias: str, fname: str, query: Query) -> str: ...
def _parent_store_compute(self): ... def _parent_store_compute(self): ...
@@ -185,7 +193,7 @@ class BaseModel(metaclass=MetaModel):
def _setup_fields(self) -> None: ... def _setup_fields(self) -> None: ...
def _setup_complete(self) -> None: ... def _setup_complete(self) -> None: ...
def fields_get(self, allfields: list[str] | None = ..., attributes: list[str] | None = ...) -> dict[str, dict[str, Any]]: ... def fields_get(self, allfields: list[str] | None = ..., attributes: list[str] | None = ...) -> dict[str, dict[str, Any]]: ...
def check_field_access_rights(self, operation: str, fields: Collection[str]): ... def check_field_access_rights(self, operation: str, field_names: Collection[str]): ...
def read(self, fields: Collection[str] | None = ..., load: str = ...) -> list[dict[str, Any]]: ... def read(self, fields: Collection[str] | None = ..., load: str = ...) -> list[dict[str, Any]]: ...
def update_field_translations(self, field_name: str, translations: dict[str, Any]) -> bool: ... def update_field_translations(self, field_name: str, translations: dict[str, Any]) -> bool: ...
def _update_field_translations(self, field_name: str, translations: dict[str, Any], digest: Callable | None = ...) ->bool: ... def _update_field_translations(self, field_name: str, translations: dict[str, Any], digest: Callable | None = ...) ->bool: ...

View File

@@ -85,8 +85,6 @@ class BaseCase(case.TestCase, metaclass=MetaCase):
def debug_mode(self) -> Generator[None, None, None]: ... def debug_mode(self) -> Generator[None, None, None]: ...
def _assertRaises(self, exception, *, msg: Any | None = ...) -> Generator[Any, None, None]: ... def _assertRaises(self, exception, *, msg: Any | None = ...) -> Generator[Any, None, None]: ...
def assertRaises(self, exception, func: Any | None = ..., *args, **kwargs) -> Generator[Any, None, None] | None: ... def assertRaises(self, exception, func: Any | None = ..., *args, **kwargs) -> Generator[Any, None, None] | None: ...
if sys.version_info < (3, 10):
def assertNoLogs(self, logger: str, level: str): ...
def assertQueries(self, expected, flush: bool = ...) -> Generator[list, None, None]: ... def assertQueries(self, expected, flush: bool = ...) -> Generator[list, None, None]: ...
def assertQueryCount(self, default: int = ..., flush: bool = ..., **counters) -> Generator[None, None, None]: ... def assertQueryCount(self, default: int = ..., flush: bool = ..., **counters) -> Generator[None, None, None]: ...
def assertRecordValues(self, records: BaseModel, expected_values: list[dict[str, Any]]) -> None: ... def assertRecordValues(self, records: BaseModel, expected_values: list[dict[str, Any]]) -> None: ...

View File

@@ -238,10 +238,10 @@ def format_amount(env: Environment, amount: float, currency: 'odoo.model.res_cur
def format_duration(value: float) -> str: ... def format_duration(value: float) -> str: ...
consteq: Callable[[str, str], bool] consteq: Callable[[str, str], bool]
_PICKLE_SAFE_NAMES: dict
class Unpickler(pickle_.Unpickler): class Unpickler(pickle_.Unpickler):
find_global: Any def find_class(self, module_name: str, name: str): ...
find_class: Any
def _pickle_load(stream: pickle_._ReadableFileobj, encoding: str = ..., errors: bool = ...): ... def _pickle_load(stream: pickle_._ReadableFileobj, encoding: str = ..., errors: bool = ...): ...

View File

@@ -15,7 +15,7 @@ def create_xml_node_chain(first_parent_node: _Element, nodes_list: Iterable[str]
def create_xml_node(parent_node: _Element, node_name: str, node_value: str | None = ...) -> _Element: ... def create_xml_node(parent_node: _Element, node_name: str, node_value: str | None = ...) -> _Element: ...
def cleanup_xml_node(xml_node_or_string: _Element | str, remove_blank_text: bool = ..., remove_blank_nodes: bool = ..., def cleanup_xml_node(xml_node_or_string: _Element | str, remove_blank_text: bool = ..., remove_blank_nodes: bool = ...,
indent_level: int = ..., indent_space: str = ...) -> _Element: ... indent_level: int = ..., indent_space: str = ...) -> _Element: ...
def load_xsd_files_from_url(env: Environment, url: str, file_name: str, force_reload: bool = ..., request_max_timeout: int = ..., def load_xsd_files_from_url(env: Environment, url: str, file_name: str | None = ..., force_reload: bool = ..., request_max_timeout: int = ...,
xsd_name_prefix: str = ..., xsd_names_filter: str | list[str] | None = ..., xsd_name_prefix: str = ..., xsd_names_filter: str | list[str] | None = ...,
modify_xsd_content: Callable[[bytes], bytes] | None = ...) -> 'odoo.model.ir_attachment | Literal[False]': ... modify_xsd_content: Callable[[bytes], bytes] | None = ...) -> 'odoo.model.ir_attachment | Literal[False]': ...
def validate_xml_from_attachment(env: Environment, xml_content, xsd_name: str, reload_files_function: Callable | None = ..., def validate_xml_from_attachment(env: Environment, xml_content, xsd_name: str, reload_files_function: Callable | None = ...,