From ef8fa28c7ad1983a041ec5078dabb2332a52cfc0 Mon Sep 17 00:00:00 2001 From: Trinh Anh Ngoc Date: Thu, 18 May 2023 21:37:13 +0700 Subject: [PATCH] isort + black --- odoo-stubs/__init__.pyi | 17 +++- odoo-stubs/api.pyi | 9 +- odoo-stubs/exceptions.pyi | 1 + odoo-stubs/fields.pyi | 19 +++- odoo-stubs/http.pyi | 48 ++++++++-- odoo-stubs/models.pyi | 152 +++++++++++++++++++++++++----- odoo-stubs/modules/__init__.pyi | 24 ++++- odoo-stubs/modules/loading.pyi | 26 ++++- odoo-stubs/modules/module.pyi | 5 +- odoo-stubs/modules/registry.pyi | 13 ++- odoo-stubs/osv/expression.pyi | 15 ++- odoo-stubs/osv/orm.pyi | 22 ++++- odoo-stubs/osv/query.pyi | 18 +++- odoo-stubs/service/__init__.pyi | 6 +- odoo-stubs/service/db.pyi | 19 +++- odoo-stubs/service/server.pyi | 7 +- odoo-stubs/sql_db.pyi | 4 +- odoo-stubs/tests/__init__.pyi | 2 +- odoo-stubs/tests/common.pyi | 10 +- odoo-stubs/tools/__init__.pyi | 26 ++--- odoo-stubs/tools/appdirs.pyi | 51 ++++++++-- odoo-stubs/tools/cache.pyi | 1 + odoo-stubs/tools/convert.pyi | 75 ++++++++++++--- odoo-stubs/tools/float_utils.pyi | 25 ++++- odoo-stubs/tools/graph.pyi | 8 +- odoo-stubs/tools/image.pyi | 61 ++++++++++-- odoo-stubs/tools/mail.pyi | 45 ++++++++- odoo-stubs/tools/mimetypes.pyi | 2 +- odoo-stubs/tools/misc.pyi | 28 ++++-- odoo-stubs/tools/osutil.pyi | 8 +- odoo-stubs/tools/profiler.pyi | 17 +++- odoo-stubs/tools/pycompat.pyi | 2 +- odoo-stubs/tools/safe_eval.pyi | 9 +- odoo-stubs/tools/sql.pyi | 4 +- odoo-stubs/tools/test_reports.pyi | 26 ++++- odoo-stubs/tools/translate.pyi | 24 ++++- odoo-stubs/tools/which.pyi | 7 +- odoo-stubs/tools/xml_utils.pyi | 7 +- odoo-stubs/tools/yaml_import.pyi | 61 ++++++++++-- odoo-stubs/tools/yaml_tag.pyi | 8 +- 40 files changed, 759 insertions(+), 153 deletions(-) diff --git a/odoo-stubs/__init__.pyi b/odoo-stubs/__init__.pyi index 9317c34..2da1ded 100644 --- a/odoo-stubs/__init__.pyi +++ b/odoo-stubs/__init__.pyi @@ -1,7 +1,20 @@ -from . import addons as addons, api as api, conf as conf, fields as fields, http as http, loglevels as loglevels, models as models, netsvc as netsvc, osv as osv, release as release, service as service, sql_db as sql_db, tools as tools -from .tools.translate import _ as _ from typing import Any +from . import addons as addons +from . import api as api +from . import conf as conf +from . import fields as fields +from . import http as http +from . import loglevels as loglevels +from . import models as models +from . import netsvc as netsvc +from . import osv as osv +from . import release as release +from . import service as service +from . import sql_db as sql_db +from . import tools as tools +from .tools.translate import _ as _ + __path__: Any evented: bool diff --git a/odoo-stubs/api.pyi b/odoo-stubs/api.pyi index 822aac3..a8aab3a 100644 --- a/odoo-stubs/api.pyi +++ b/odoo-stubs/api.pyi @@ -74,11 +74,16 @@ class Environment(Mapping): def __eq__(self, other) -> bool: ... def __ne__(self, other) -> bool: ... def __hash__(self) -> int: ... - def __call__(self, cr: Optional[Cursor] = ..., user: Optional[Any] = ..., context: Optional[Any] = ...) -> Environment: ... + def __call__( + self, + cr: Optional[Cursor] = ..., + user: Optional[Any] = ..., + context: Optional[Any] = ..., + ) -> Environment: ... def ref(self, xml_id, raise_if_not_found: bool = ...): ... @property def user(self): - return self['res.users'] + return self["res.users"] @property def lang(self) -> str: ... def _do_in_mode(self, mode) -> None: ... diff --git a/odoo-stubs/exceptions.pyi b/odoo-stubs/exceptions.pyi index 895c3b5..d137c8d 100644 --- a/odoo-stubs/exceptions.pyi +++ b/odoo-stubs/exceptions.pyi @@ -10,6 +10,7 @@ class except_orm(Exception): class UserError(except_orm): def __init__(self, msg) -> None: ... + Warning = UserError class RedirectWarning(Exception): diff --git a/odoo-stubs/fields.pyi b/odoo-stubs/fields.pyi index f1d05b1..a55337e 100644 --- a/odoo-stubs/fields.pyi +++ b/odoo-stubs/fields.pyi @@ -3,8 +3,8 @@ from typing import Any, Generic, Optional, TypeVar, overload from .models import BaseModel -_FieldT = TypeVar('_FieldT', bound=Field) -_FieldValueT = TypeVar('_FieldValueT') +_FieldT = TypeVar("_FieldT", bound=Field) +_FieldValueT = TypeVar("_FieldValueT") DATE_LENGTH: Any DATETIME_LENGTH: Any @@ -261,6 +261,7 @@ class Datetime(Field[datetime.datetime]): def convert_to_cache(self, value, record, validate: bool = ...): ... def convert_to_export(self, value, record): ... def convert_to_display_name(self, value, record): ... + _BINARY = memoryview class Binary(Field[bytes]): @@ -358,7 +359,9 @@ class _RelationalMulti(_Relational): class One2many(_RelationalMulti): type: str _slots: Any - def __init__(self, comodel_name=..., inverse_name=..., string=..., **kwargs) -> None: ... + def __init__( + self, comodel_name=..., inverse_name=..., string=..., **kwargs + ) -> None: ... def _setup_regular_full(self, model) -> None: ... _description_relation_field: Any def convert_to_onchange(self, value, record, names): ... @@ -369,7 +372,15 @@ class One2many(_RelationalMulti): class Many2many(_RelationalMulti): type: str _slots: Any - def __init__(self, comodel_name=..., relation=..., column1=..., column2=..., string=..., **kwargs) -> None: ... + def __init__( + self, + comodel_name=..., + relation=..., + column1=..., + column2=..., + string=..., + **kwargs + ) -> None: ... relation: Any column1: Any column2: Any diff --git a/odoo-stubs/http.pyi b/odoo-stubs/http.pyi index 7bc0a90..5af8853 100644 --- a/odoo-stubs/http.pyi +++ b/odoo-stubs/http.pyi @@ -18,7 +18,13 @@ def replace_request_password(args): ... NO_POSTMORTEM: Any def dispatch_rpc(service_name, method, params): ... -def local_redirect(path, query: Optional[Any] = ..., keep_hash: bool = ..., forward_debug: bool = ..., code: int = ...): ... +def local_redirect( + path, + query: Optional[Any] = ..., + keep_hash: bool = ..., + forward_debug: bool = ..., + code: int = ..., +): ... def redirect_with_hash(url, code: int = ...): ... class WebRequest: @@ -28,7 +34,7 @@ class WebRequest: endpoint: Any endpoint_arguments: Any auth_method: Any - website = Environment()['website'] + website = Environment()["website"] _cr: Cursor _uid: int _context: dict @@ -77,7 +83,9 @@ class JsonRequest(WebRequest): jsonrequest: Any context: Any def __init__(self, *args): ... - def _json_response(self, result: Optional[Any] = ..., error: Optional[Any] = ...): ... + def _json_response( + self, result: Optional[Any] = ..., error: Optional[Any] = ... + ): ... def _handle_exception(self, exception): ... def dispatch(self): ... @@ -89,8 +97,12 @@ class HttpRequest(WebRequest): def __init__(self, *args) -> None: ... def _handle_exception(self, exception): ... def dispatch(self): ... - def make_response(self, data, headers: Optional[Any] = ..., cookies: Optional[Any] = ...): ... - def render(self, template, qcontext: Optional[Any] = ..., lazy: bool = ..., **kw): ... + def make_response( + self, data, headers: Optional[Any] = ..., cookies: Optional[Any] = ... + ): ... + def render( + self, template, qcontext: Optional[Any] = ..., lazy: bool = ..., **kw + ): ... def not_found(self, description: Optional[Any] = ...): ... addons_module: Any @@ -128,7 +140,13 @@ class OpenERPSession(werkzeug.contrib.sessions.Session): uid: Any login: Any session_token: Any - def authenticate(self, db, login: Optional[Any] = ..., password: Optional[Any] = ..., uid: Optional[Any] = ...): ... + def authenticate( + self, + db, + login: Optional[Any] = ..., + password: Optional[Any] = ..., + uid: Optional[Any] = ..., + ): ... def check_security(self) -> None: ... def logout(self, keep_db: bool = ...) -> None: ... def _default_values(self) -> None: ... @@ -148,7 +166,12 @@ class Response(werkzeug.wrappers.Response): template: Any qcontext: Any uid: Any - def set_default(self, template: Optional[Any] = ..., qcontext: Optional[Any] = ..., uid: Optional[Any] = ...) -> None: ... + def set_default( + self, + template: Optional[Any] = ..., + qcontext: Optional[Any] = ..., + uid: Optional[Any] = ..., + ) -> None: ... @property def is_qweb(self): ... def render(self): ... @@ -177,7 +200,16 @@ class Root: def db_list(force: bool = ..., httprequest: Optional[Any] = ...): ... def db_filter(dbs, httprequest: Optional[Any] = ...): ... def db_monodb(httprequest: Optional[Any] = ...): ... -def send_file(filepath_or_fp, mimetype: Optional[Any] = ..., as_attachment: bool = ..., filename: Optional[Any] = ..., mtime: Optional[Any] = ..., add_etags: bool = ..., cache_timeout=..., conditional: bool = ...): ... +def send_file( + filepath_or_fp, + mimetype: Optional[Any] = ..., + as_attachment: bool = ..., + filename: Optional[Any] = ..., + mtime: Optional[Any] = ..., + add_etags: bool = ..., + cache_timeout=..., + conditional: bool = ..., +): ... def content_disposition(filename): ... class CommonController(Controller): diff --git a/odoo-stubs/models.pyi b/odoo-stubs/models.pyi index d7cd97f..28b4370 100644 --- a/odoo-stubs/models.pyi +++ b/odoo-stubs/models.pyi @@ -1,12 +1,12 @@ from collections import MutableMapping -from typing import Any, Optional, List, Dict, Generator, TypeVar +from typing import Any, Dict, Generator, List, Optional, TypeVar from . import api, fields from .api import Environment from .modules.registry import Registry from .sql_db import Cursor -_ModelT = TypeVar('_ModelT', bound=BaseModel) +_ModelT = TypeVar("_ModelT", bound=BaseModel) _logger: Any _schema: Any @@ -79,9 +79,9 @@ class BaseModel(metaclass=MetaModel): pool: Registry id = fields.Id() display_name = fields.Char() - create_uid = fields.Many2one('res.users') + create_uid = fields.Many2one("res.users") create_date = fields.Datetime() - write_uid = fields.Many2one('res.users') + write_uid = fields.Many2one("res.users") write_date = fields.Datetime() CONCURRENCY_CHECK_FIELD: str def view_init(self, fields_list) -> None: ... @@ -130,32 +130,97 @@ class BaseModel(metaclass=MetaModel): def _get_default_graph_view(self): ... def _get_default_calendar_view(self): ... def load_views(self, views, options: Optional[Any] = ...): ... - def _fields_view_get(self, view_id: Optional[Any] = ..., view_type: str = ..., toolbar: bool = ..., submenu: bool = ...): ... - def fields_view_get(self, view_id: Optional[Any] = ..., view_type: str = ..., toolbar: bool = ..., submenu: bool = ...): ... + def _fields_view_get( + self, + view_id: Optional[Any] = ..., + view_type: str = ..., + toolbar: bool = ..., + submenu: bool = ..., + ): ... + def fields_view_get( + self, + view_id: Optional[Any] = ..., + view_type: str = ..., + toolbar: bool = ..., + submenu: bool = ..., + ): ... def get_formview_id(self, access_uid: Optional[Any] = ...): ... def get_formview_action(self, access_uid: Optional[Any] = ...): ... def get_access_action(self, access_uid: Optional[Any] = ...): ... def search_count(self, args) -> int: ... - def search(self: _ModelT, args, offset: int = ..., limit: Optional[Any] = ..., order: Optional[Any] = ..., count: bool = ...) -> _ModelT: ... + def search( + self: _ModelT, + args, + offset: int = ..., + limit: Optional[Any] = ..., + order: Optional[Any] = ..., + count: bool = ..., + ) -> _ModelT: ... def _compute_display_name(self) -> None: ... def name_get(self): ... def name_create(self, name): ... - def name_search(self, name: str = ..., args: Optional[Any] = ..., operator: str = ..., limit: int = ...): ... - def _name_search(self, name: str = ..., args: Optional[Any] = ..., operator: str = ..., limit: int = ..., name_get_uid: Optional[Any] = ...): ... + def name_search( + self, + name: str = ..., + args: Optional[Any] = ..., + operator: str = ..., + limit: int = ..., + ): ... + def _name_search( + self, + name: str = ..., + args: Optional[Any] = ..., + operator: str = ..., + limit: int = ..., + name_get_uid: Optional[Any] = ..., + ): ... def _add_missing_default_values(self, values): ... @classmethod def clear_caches(cls) -> None: ... - def _read_group_fill_results(self, domain, groupby, remaining_groupbys, aggregated_fields, count_field, read_group_result, read_group_order: Optional[Any] = ...): ... - def _read_group_fill_temporal(self, data, groupby, aggregated_fields, annotated_groupbys, interval=...): ... - def _read_group_prepare(self, orderby, aggregated_fields, annotated_groupbys, query): ... + def _read_group_fill_results( + self, + domain, + groupby, + remaining_groupbys, + aggregated_fields, + count_field, + read_group_result, + read_group_order: Optional[Any] = ..., + ): ... + def _read_group_fill_temporal( + self, data, groupby, aggregated_fields, annotated_groupbys, interval=... + ): ... + def _read_group_prepare( + self, orderby, aggregated_fields, annotated_groupbys, query + ): ... def _read_group_process_groupby(self, gb, query): ... def _read_group_prepare_data(self, key, value, groupby_dict): ... def _read_group_format_result(self, data, annotated_groupbys, groupby, domain): ... - def read_group(self, domain, fields, groupby, offset: int = ..., limit: Optional[Any] = ..., orderby: bool = ..., lazy: bool = ...): ... - def _read_group_raw(self, domain, fields, groupby, offset: int = ..., limit: Optional[Any] = ..., orderby: bool = ..., lazy: bool = ...): ... + def read_group( + self, + domain, + fields, + groupby, + offset: int = ..., + limit: Optional[Any] = ..., + orderby: bool = ..., + lazy: bool = ..., + ): ... + def _read_group_raw( + self, + domain, + fields, + groupby, + offset: int = ..., + limit: Optional[Any] = ..., + orderby: bool = ..., + lazy: bool = ..., + ): ... def _read_group_resolve_many2one_fields(self, data, fields) -> None: ... def _inherits_join_add(self, current_model, parent_model_name, query): ... - def _inherits_join_calc(self, alias, fname, query, implicit: bool = ..., outer: bool = ...): ... + def _inherits_join_calc( + self, alias, fname, query, implicit: bool = ..., outer: bool = ... + ): ... def _parent_store_compute(self): ... def _check_selection_field_value(self, field, value) -> None: ... def _check_removed_columns(self, log: bool = ...) -> None: ... @@ -172,7 +237,9 @@ class BaseModel(metaclass=MetaModel): def _setup_base(self): ... def _setup_fields(self) -> None: ... def _setup_complete(self) -> None: ... - def fields_get(self, allfields: Optional[Any] = ..., attributes: Optional[Any] = ...): ... + def fields_get( + self, allfields: Optional[Any] = ..., attributes: Optional[Any] = ... + ): ... def get_empty_list_help(self, help): ... def check_field_access_rights(self, operation, fields): ... def read(self, fields: Optional[Any] = ..., load: str = ...): ... @@ -192,10 +259,27 @@ class BaseModel(metaclass=MetaModel): def _check_qorder(self, word): ... def _apply_ir_rules(self, query, mode: str = ...) -> None: ... def _generate_translated_field(self, table_alias, field, query): ... - def _generate_m2o_order_by(self, alias, order_field, query, reverse_direction, seen): ... - def _generate_order_by_inner(self, alias, order_spec, query, reverse_direction: bool = ..., seen: Optional[Any] = ...): ... + def _generate_m2o_order_by( + self, alias, order_field, query, reverse_direction, seen + ): ... + def _generate_order_by_inner( + self, + alias, + order_spec, + query, + reverse_direction: bool = ..., + seen: Optional[Any] = ..., + ): ... def _generate_order_by(self, order_spec, query): ... - def _search(self, args, offset: int = ..., limit: Optional[Any] = ..., order: Optional[Any] = ..., count: bool = ..., access_rights_uid: Optional[Any] = ...): ... + def _search( + self, + args, + offset: int = ..., + limit: Optional[Any] = ..., + order: Optional[Any] = ..., + count: bool = ..., + access_rights_uid: Optional[Any] = ..., + ): ... def copy_data(self, default: Optional[Any] = ...): ... def copy_translations(old, new, excluded=...): ... def copy(self: _ModelT, default: Optional[Any] = ...) -> _ModelT: ... @@ -211,9 +295,18 @@ class BaseModel(metaclass=MetaModel): def _transient_clean_rows_older_than(self, seconds) -> None: ... def _transient_clean_old_rows(self, max_count) -> None: ... def _transient_vacuum(self, force: bool = ...): ... - def resolve_2many_commands(self, field_name, commands, fields: Optional[Any] = ...): ... + def resolve_2many_commands( + self, field_name, commands, fields: Optional[Any] = ... + ): ... resolve_o2m_commands_to_record_dicts: Any - def search_read(self, domain: Optional[Any] = ..., fields: Optional[Any] = ..., offset: int = ..., limit: Optional[Any] = ..., order: Optional[Any] = ...): ... + def search_read( + self, + domain: Optional[Any] = ..., + fields: Optional[Any] = ..., + offset: int = ..., + limit: Optional[Any] = ..., + order: Optional[Any] = ..., + ): ... def toggle_active(self) -> None: ... def _register_hook(self) -> None: ... @classmethod @@ -221,8 +314,12 @@ class BaseModel(metaclass=MetaModel): @classmethod def _revert_method(cls, name) -> None: ... @classmethod - def _browse(cls, ids, env, prefetch: Optional[Any] = ..., add_prefetch: bool = ...): ... - def browse(self: _ModelT, arg: Optional[Any] = ..., prefetch: Optional[Any] = ...) -> _ModelT: ... + def _browse( + cls, ids, env, prefetch: Optional[Any] = ..., add_prefetch: bool = ... + ): ... + def browse( + self: _ModelT, arg: Optional[Any] = ..., prefetch: Optional[Any] = ... + ) -> _ModelT: ... @property def ids(self) -> List[int]: ... _cr: Cursor @@ -240,7 +337,9 @@ class BaseModel(metaclass=MetaModel): def mapped(self, func): ... def _mapped_cache(self, name_seq): ... def filtered(self: _ModelT, func) -> _ModelT: ... - def sorted(self: _ModelT, key: Optional[Any] = ..., reverse: bool = ...) -> _ModelT: ... + def sorted( + self: _ModelT, key: Optional[Any] = ..., reverse: bool = ... + ) -> _ModelT: ... def update(self, values) -> None: ... def new(self: _ModelT, values=..., ref: Optional[Any] = ...) -> _ModelT: ... def _is_dirty(self): ... @@ -272,7 +371,9 @@ class BaseModel(metaclass=MetaModel): def _cache(self): ... def _in_cache_without(self, field, limit=...): ... def refresh(self) -> None: ... - def invalidate_cache(self, fnames: Optional[Any] = ..., ids: Optional[Any] = ...): ... + def invalidate_cache( + self, fnames: Optional[Any] = ..., ids: Optional[Any] = ... + ): ... def modified(self, fnames) -> None: ... def _recompute_check(self, field): ... def _recompute_todo(self, field) -> None: ... @@ -296,6 +397,7 @@ class RecordCache(MutableMapping): def get_value(self, name, default: Optional[Any] = ...): ... def set_special(self, name, getter) -> None: ... def set_failed(self, names, exception) -> None: ... + AbstractModel = BaseModel class Model(AbstractModel): diff --git a/odoo-stubs/modules/__init__.pyi b/odoo-stubs/modules/__init__.pyi index 3e87be7..e772605 100644 --- a/odoo-stubs/modules/__init__.pyi +++ b/odoo-stubs/modules/__init__.pyi @@ -1,3 +1,21 @@ -from . import db as db, graph as graph, loading as loading, migration as migration, module as module, registry as registry -from odoo.modules.loading import load_modules as load_modules, reset_modules_state as reset_modules_state -from odoo.modules.module import adapt_version as adapt_version, get_module_path as get_module_path, get_module_resource as get_module_resource, get_modules as get_modules, get_modules_with_version as get_modules_with_version, get_resource_from_path as get_resource_from_path, get_resource_path as get_resource_path, initialize_sys_path as initialize_sys_path, load_information_from_description_file as load_information_from_description_file, load_openerp_module as load_openerp_module +from odoo.modules.loading import load_modules as load_modules +from odoo.modules.loading import reset_modules_state as reset_modules_state +from odoo.modules.module import adapt_version as adapt_version +from odoo.modules.module import get_module_path as get_module_path +from odoo.modules.module import get_module_resource as get_module_resource +from odoo.modules.module import get_modules as get_modules +from odoo.modules.module import get_modules_with_version as get_modules_with_version +from odoo.modules.module import get_resource_from_path as get_resource_from_path +from odoo.modules.module import get_resource_path as get_resource_path +from odoo.modules.module import initialize_sys_path as initialize_sys_path +from odoo.modules.module import ( + load_information_from_description_file as load_information_from_description_file, +) +from odoo.modules.module import load_openerp_module as load_openerp_module + +from . import db as db +from . import graph as graph +from . import loading as loading +from . import migration as migration +from . import module as module +from . import registry as registry diff --git a/odoo-stubs/modules/loading.pyi b/odoo-stubs/modules/loading.pyi index 9efcfca..f118339 100644 --- a/odoo-stubs/modules/loading.pyi +++ b/odoo-stubs/modules/loading.pyi @@ -3,8 +3,28 @@ from typing import Any, Optional _logger: Any _test_logger: Any -def load_module_graph(cr, graph, status: Optional[Any] = ..., perform_checks: bool = ..., skip_modules: Optional[Any] = ..., report: Optional[Any] = ..., models_to_check: Optional[Any] = ...): ... +def load_module_graph( + cr, + graph, + status: Optional[Any] = ..., + perform_checks: bool = ..., + skip_modules: Optional[Any] = ..., + report: Optional[Any] = ..., + models_to_check: Optional[Any] = ..., +): ... def _check_module_names(cr, module_names) -> None: ... -def load_marked_modules(cr, graph, states, force, progressdict, report, loaded_modules, perform_checks, models_to_check: Optional[Any] = ...): ... -def load_modules(db, force_demo: bool = ..., status: Optional[Any] = ..., update_module: bool = ...): ... +def load_marked_modules( + cr, + graph, + states, + force, + progressdict, + report, + loaded_modules, + perform_checks, + models_to_check: Optional[Any] = ..., +): ... +def load_modules( + db, force_demo: bool = ..., status: Optional[Any] = ..., update_module: bool = ... +): ... def reset_modules_state(db_name) -> None: ... diff --git a/odoo-stubs/modules/module.pyi b/odoo-stubs/modules/module.pyi index 9c84008..74769c4 100644 --- a/odoo-stubs/modules/module.pyi +++ b/odoo-stubs/modules/module.pyi @@ -1,7 +1,9 @@ -from odoo import SUPERUSER_ID as SUPERUSER_ID, api as api from operator import itemgetter as itemgetter from typing import Any, Optional +from odoo import SUPERUSER_ID as SUPERUSER_ID +from odoo import api as api + MANIFEST_NAMES: Any README: Any _logger: Any @@ -21,6 +23,7 @@ def initialize_sys_path() -> None: ... def get_module_path(module, downloaded: bool = ..., display_warning: bool = ...): ... def get_module_filetree(module, dir: str = ...): ... def get_resource_path(module, *args): ... + get_module_resource = get_resource_path def get_resource_from_path(path): ... diff --git a/odoo-stubs/modules/registry.pyi b/odoo-stubs/modules/registry.pyi index 823cd6a..8c122c9 100644 --- a/odoo-stubs/modules/registry.pyi +++ b/odoo-stubs/modules/registry.pyi @@ -1,8 +1,9 @@ -from collections import Mapping, defaultdict as defaultdict +from collections import Mapping +from collections import defaultdict as defaultdict +from typing import Any, Optional from odoo.sql_db import Cursor from odoo.tools import table_exists as table_exists -from typing import Any, Optional _logger: Any @@ -13,7 +14,13 @@ class Registry(Mapping): def registries(cls): ... def __new__(cls, db_name): ... @classmethod - def new(cls, db_name, force_demo: bool = ..., status: Optional[Any] = ..., update_module: bool = ...): ... + def new( + cls, + db_name, + force_demo: bool = ..., + status: Optional[Any] = ..., + update_module: bool = ..., + ): ... models: Any _sql_error: Any _init: bool diff --git a/odoo-stubs/osv/expression.pyi b/odoo-stubs/osv/expression.pyi index 20e3dee..286e96d 100644 --- a/odoo-stubs/osv/expression.pyi +++ b/odoo-stubs/osv/expression.pyi @@ -1,7 +1,8 @@ -from ..models import MAGIC_COLUMNS as MAGIC_COLUMNS from functools import partial as partial from typing import Any, Optional +from ..models import MAGIC_COLUMNS as MAGIC_COLUMNS + NOT_OPERATOR: str OR_OPERATOR: str AND_OPERATOR: str @@ -28,7 +29,9 @@ def get_alias_from_query(from_query): ... def normalize_leaf(element): ... def is_operator(element): ... def is_leaf(element, internal: bool = ...): ... -def select_from_where(cr, select_field, from_table, where_field, where_ids, where_operator): ... +def select_from_where( + cr, select_field, from_table, where_field, where_ids, where_operator +): ... def select_distinct_from_where_not_null(cr, select_field, from_table): ... def get_unaccent_wrapper(cr): ... @@ -37,7 +40,9 @@ class ExtendedLeaf: leaf: Any model: Any _models: Any - def __init__(self, leaf, model, join_context: Optional[Any] = ..., internal: bool = ...) -> None: ... + def __init__( + self, leaf, model, join_context: Optional[Any] = ..., internal: bool = ... + ) -> None: ... def __str__(self): ... def generate_alias(self): ... def add_join_context(self, model, lhs_col, table_col, link) -> None: ... @@ -51,7 +56,9 @@ class ExtendedLeaf: def is_leaf(self, internal: bool = ...): ... def normalize_leaf(self): ... -def create_substitution_leaf(leaf, new_elements, new_model: Optional[Any] = ..., internal: bool = ...): ... +def create_substitution_leaf( + leaf, new_elements, new_model: Optional[Any] = ..., internal: bool = ... +): ... class expression: _unaccent: Any diff --git a/odoo-stubs/osv/orm.pyi b/odoo-stubs/osv/orm.pyi index 12bc865..1530545 100644 --- a/odoo-stubs/osv/orm.pyi +++ b/odoo-stubs/osv/orm.pyi @@ -1,7 +1,14 @@ -from ..exceptions import except_orm as except_orm -from ..models import AbstractModel as AbstractModel, BaseModel, LOG_ACCESS_COLUMNS as LOG_ACCESS_COLUMNS, MAGIC_COLUMNS as MAGIC_COLUMNS, MetaModel as MetaModel, Model as Model, TransientModel as TransientModel from typing import Any, Optional +from ..exceptions import except_orm as except_orm +from ..models import LOG_ACCESS_COLUMNS as LOG_ACCESS_COLUMNS +from ..models import MAGIC_COLUMNS as MAGIC_COLUMNS +from ..models import AbstractModel as AbstractModel +from ..models import BaseModel +from ..models import MetaModel as MetaModel +from ..models import Model as Model +from ..models import TransientModel as TransientModel + browse_record_list = BaseModel class BRM(type): @@ -15,9 +22,16 @@ class NBM(type): browse_null: Any def transfer_field_to_modifiers(field, modifiers) -> None: ... -def transfer_node_to_modifiers(node, modifiers, context: Optional[Any] = ..., in_tree_view: bool = ...) -> None: ... +def transfer_node_to_modifiers( + node, modifiers, context: Optional[Any] = ..., in_tree_view: bool = ... +) -> None: ... def simplify_modifiers(modifiers) -> None: ... def transfer_modifiers_to_node(modifiers, node) -> None: ... -def setup_modifiers(node, field: Optional[Any] = ..., context: Optional[Any] = ..., in_tree_view: bool = ...) -> None: ... +def setup_modifiers( + node, + field: Optional[Any] = ..., + context: Optional[Any] = ..., + in_tree_view: bool = ..., +) -> None: ... def test_modifiers(what, expected) -> None: ... def modifiers_tests() -> None: ... diff --git a/odoo-stubs/osv/query.pyi b/odoo-stubs/osv/query.pyi index 8bc540b..773fd79 100644 --- a/odoo-stubs/osv/query.pyi +++ b/odoo-stubs/osv/query.pyi @@ -8,9 +8,23 @@ class Query: where_clause_params: Any joins: Any extras: Any - def __init__(self, tables: Optional[Any] = ..., where_clause: Optional[Any] = ..., where_clause_params: Optional[Any] = ..., joins: Optional[Any] = ..., extras: Optional[Any] = ...) -> None: ... + def __init__( + self, + tables: Optional[Any] = ..., + where_clause: Optional[Any] = ..., + where_clause_params: Optional[Any] = ..., + joins: Optional[Any] = ..., + extras: Optional[Any] = ..., + ) -> None: ... def _get_table_aliases(self): ... def _get_alias_mapping(self): ... - def add_join(self, connection, implicit: bool = ..., outer: bool = ..., extra: Optional[Any] = ..., extra_params=...): ... + def add_join( + self, + connection, + implicit: bool = ..., + outer: bool = ..., + extra: Optional[Any] = ..., + extra_params=..., + ): ... def get_sql(self): ... def __str__(self): ... diff --git a/odoo-stubs/service/__init__.pyi b/odoo-stubs/service/__init__.pyi index a2984f7..2d4b73d 100644 --- a/odoo-stubs/service/__init__.pyi +++ b/odoo-stubs/service/__init__.pyi @@ -1 +1,5 @@ -from . import common as common, db as db, model as model, server as server, wsgi_server as wsgi_server +from . import common as common +from . import db as db +from . import model as model +from . import server as server +from . import wsgi_server as wsgi_server diff --git a/odoo-stubs/service/db.pyi b/odoo-stubs/service/db.pyi index b12df12..bb05f3f 100644 --- a/odoo-stubs/service/db.pyi +++ b/odoo-stubs/service/db.pyi @@ -7,9 +7,24 @@ class DatabaseExists(Warning): ... def check_db_management_enabled(method): ... def check_super(passwd): ... -def _initialize_db(id, db_name, demo, lang, user_password, login: str = ..., country_code: Optional[Any] = ...) -> None: ... +def _initialize_db( + id, + db_name, + demo, + lang, + user_password, + login: str = ..., + country_code: Optional[Any] = ..., +) -> None: ... def _create_empty_database(name) -> None: ... -def exp_create_database(db_name, demo, lang, user_password: str = ..., login: str = ..., country_code: Optional[Any] = ...): ... +def exp_create_database( + db_name, + demo, + lang, + user_password: str = ..., + login: str = ..., + country_code: Optional[Any] = ..., +): ... def exp_duplicate_database(db_original_name, db_name): ... def _drop_conn(cr, db_name) -> None: ... def exp_drop(db_name): ... diff --git a/odoo-stubs/service/server.pyi b/odoo-stubs/service/server.pyi index 49d8bac..6d8ac77 100644 --- a/odoo-stubs/service/server.pyi +++ b/odoo-stubs/service/server.pyi @@ -1,6 +1,7 @@ -import werkzeug.serving from typing import Any, Optional +import werkzeug.serving + INOTIFY_LISTEN_EVENTS: Any _logger: Any SLEEP_INTERVAL: int @@ -18,7 +19,9 @@ class BaseWSGIServerNoBind(LoggingBaseWSGIServerMixIn, werkzeug.serving.BaseWSGI class RequestHandler(werkzeug.serving.WSGIRequestHandler): def setup(self) -> None: ... -class ThreadedWSGIServerReloadable(LoggingBaseWSGIServerMixIn, werkzeug.serving.ThreadedWSGIServer): +class ThreadedWSGIServerReloadable( + LoggingBaseWSGIServerMixIn, werkzeug.serving.ThreadedWSGIServer +): max_http_threads: Any http_threads_sem: Any def __init__(self, host, port, app) -> None: ... diff --git a/odoo-stubs/sql_db.pyi b/odoo-stubs/sql_db.pyi index 76ee963..1b99975 100644 --- a/odoo-stubs/sql_db.pyi +++ b/odoo-stubs/sql_db.pyi @@ -37,7 +37,9 @@ class Cursor: def dictfetchmany(self, size): ... def dictfetchall(self): ... def __del__(self) -> None: ... - def execute(self, query, params: Optional[Any] = ..., log_exceptions: Optional[Any] = ...): ... + def execute( + self, query, params: Optional[Any] = ..., log_exceptions: Optional[Any] = ... + ): ... def split_for_in_conditions(self, ids, size: Optional[Any] = ...): ... def print_log(self): ... def close(self): ... diff --git a/odoo-stubs/tests/__init__.pyi b/odoo-stubs/tests/__init__.pyi index fabbb63..94007b2 100644 --- a/odoo-stubs/tests/__init__.pyi +++ b/odoo-stubs/tests/__init__.pyi @@ -1,2 +1,2 @@ -from .common import * from . import common as common +from .common import * diff --git a/odoo-stubs/tests/common.pyi b/odoo-stubs/tests/common.pyi index b25960d..5778df3 100644 --- a/odoo-stubs/tests/common.pyi +++ b/odoo-stubs/tests/common.pyi @@ -73,6 +73,14 @@ class HttpCase(TransactionCase): def phantom_poll(self, phantom, timeout): ... def phantom_run(self, cmd, timeout) -> None: ... def _wait_remaining_requests(self) -> None: ... - def phantom_js(self, url_path, code, ready: str = ..., login: Optional[Any] = ..., timeout: int = ..., **kw) -> None: ... + def phantom_js( + self, + url_path, + code, + ready: str = ..., + login: Optional[Any] = ..., + timeout: int = ..., + **kw + ) -> None: ... def can_import(module): ... diff --git a/odoo-stubs/tools/__init__.pyi b/odoo-stubs/tools/__init__.pyi index 67ed8a6..b774c5f 100644 --- a/odoo-stubs/tools/__init__.pyi +++ b/odoo-stubs/tools/__init__.pyi @@ -1,14 +1,16 @@ -from .misc import * -from .convert import * -from .translate import * -from .image import * -from .yaml_import import * -from .sql import * -from .float_utils import * -from .mail import * -from .func import * -from .debugger import * -from .xml_utils import * -from . import appdirs as appdirs, pdf as pdf, pycompat as pycompat +from . import appdirs as appdirs +from . import pdf as pdf +from . import pycompat as pycompat from .config import config as config +from .convert import * +from .debugger import * +from .float_utils import * +from .func import * from .graph import graph as graph +from .image import * +from .mail import * +from .misc import * +from .sql import * +from .translate import * +from .xml_utils import * +from .yaml_import import * diff --git a/odoo-stubs/tools/appdirs.pyi b/odoo-stubs/tools/appdirs.pyi index 9671868..e526f73 100644 --- a/odoo-stubs/tools/appdirs.pyi +++ b/odoo-stubs/tools/appdirs.pyi @@ -3,12 +3,42 @@ from typing import Any, Optional __version_info__: Any __version__: Any -def user_data_dir(appname: Optional[Any] = ..., appauthor: Optional[Any] = ..., version: Optional[Any] = ..., roaming: bool = ...): ... -def site_data_dir(appname: Optional[Any] = ..., appauthor: Optional[Any] = ..., version: Optional[Any] = ..., multipath: bool = ...): ... -def user_config_dir(appname: Optional[Any] = ..., appauthor: Optional[Any] = ..., version: Optional[Any] = ..., roaming: bool = ...): ... -def site_config_dir(appname: Optional[Any] = ..., appauthor: Optional[Any] = ..., version: Optional[Any] = ..., multipath: bool = ...): ... -def user_cache_dir(appname: Optional[Any] = ..., appauthor: Optional[Any] = ..., version: Optional[Any] = ..., opinion: bool = ...): ... -def user_log_dir(appname: Optional[Any] = ..., appauthor: Optional[Any] = ..., version: Optional[Any] = ..., opinion: bool = ...): ... +def user_data_dir( + appname: Optional[Any] = ..., + appauthor: Optional[Any] = ..., + version: Optional[Any] = ..., + roaming: bool = ..., +): ... +def site_data_dir( + appname: Optional[Any] = ..., + appauthor: Optional[Any] = ..., + version: Optional[Any] = ..., + multipath: bool = ..., +): ... +def user_config_dir( + appname: Optional[Any] = ..., + appauthor: Optional[Any] = ..., + version: Optional[Any] = ..., + roaming: bool = ..., +): ... +def site_config_dir( + appname: Optional[Any] = ..., + appauthor: Optional[Any] = ..., + version: Optional[Any] = ..., + multipath: bool = ..., +): ... +def user_cache_dir( + appname: Optional[Any] = ..., + appauthor: Optional[Any] = ..., + version: Optional[Any] = ..., + opinion: bool = ..., +): ... +def user_log_dir( + appname: Optional[Any] = ..., + appauthor: Optional[Any] = ..., + version: Optional[Any] = ..., + opinion: bool = ..., +): ... class AppDirs: appname: Any @@ -16,7 +46,14 @@ class AppDirs: version: Any roaming: Any multipath: Any - def __init__(self, appname, appauthor: Optional[Any] = ..., version: Optional[Any] = ..., roaming: bool = ..., multipath: bool = ...) -> None: ... + def __init__( + self, + appname, + appauthor: Optional[Any] = ..., + version: Optional[Any] = ..., + roaming: bool = ..., + multipath: bool = ..., + ) -> None: ... @property def user_data_dir(self): ... @property diff --git a/odoo-stubs/tools/cache.pyi b/odoo-stubs/tools/cache.pyi index bbc91f8..d2d210e 100644 --- a/odoo-stubs/tools/cache.pyi +++ b/odoo-stubs/tools/cache.pyi @@ -47,4 +47,5 @@ class dummy_cache: def log_ormcache_stats(sig: Optional[Any] = ..., frame: Optional[Any] = ...): ... def get_cache_key_counter(bound_method, *args, **kwargs): ... + cache = ormcache diff --git a/odoo-stubs/tools/convert.pyi b/odoo-stubs/tools/convert.pyi index 25dc218..7efca5e 100644 --- a/odoo-stubs/tools/convert.pyi +++ b/odoo-stubs/tools/convert.pyi @@ -28,15 +28,31 @@ class xml_import: def get_context(self, data_node, node, eval_dict): ... def get_uid(self, data_node, node): ... def _test_xml_id(self, xml_id) -> None: ... - def _tag_delete(self, rec, data_node: Optional[Any] = ..., mode: Optional[Any] = ...) -> None: ... - def _tag_report(self, rec, data_node: Optional[Any] = ..., mode: Optional[Any] = ...): ... - def _tag_function(self, rec, data_node: Optional[Any] = ..., mode: Optional[Any] = ...) -> None: ... - def _tag_act_window(self, rec, data_node: Optional[Any] = ..., mode: Optional[Any] = ...) -> None: ... - def _tag_menuitem(self, rec, data_node: Optional[Any] = ..., mode: Optional[Any] = ...): ... + def _tag_delete( + self, rec, data_node: Optional[Any] = ..., mode: Optional[Any] = ... + ) -> None: ... + def _tag_report( + self, rec, data_node: Optional[Any] = ..., mode: Optional[Any] = ... + ): ... + def _tag_function( + self, rec, data_node: Optional[Any] = ..., mode: Optional[Any] = ... + ) -> None: ... + def _tag_act_window( + self, rec, data_node: Optional[Any] = ..., mode: Optional[Any] = ... + ) -> None: ... + def _tag_menuitem( + self, rec, data_node: Optional[Any] = ..., mode: Optional[Any] = ... + ): ... def _assert_equals(self, f1, f2, prec: int = ...): ... - def _tag_assert(self, rec, data_node: Optional[Any] = ..., mode: Optional[Any] = ...) -> None: ... - def _tag_record(self, rec, data_node: Optional[Any] = ..., mode: Optional[Any] = ...): ... - def _tag_template(self, el, data_node: Optional[Any] = ..., mode: Optional[Any] = ...): ... + def _tag_assert( + self, rec, data_node: Optional[Any] = ..., mode: Optional[Any] = ... + ) -> None: ... + def _tag_record( + self, rec, data_node: Optional[Any] = ..., mode: Optional[Any] = ... + ): ... + def _tag_template( + self, el, data_node: Optional[Any] = ..., mode: Optional[Any] = ... + ): ... def id_get(self, id_str, raise_if_not_found: bool = ...): ... def model_id_get(self, id_str, raise_if_not_found: bool = ...): ... def parse(self, de, mode: Optional[Any] = ...): ... @@ -50,9 +66,44 @@ class xml_import: noupdate: Any xml_filename: Any _tags: Any - def __init__(self, cr, module, idref, mode, report: Optional[Any] = ..., noupdate: bool = ..., xml_filename: Optional[Any] = ...) -> None: ... + def __init__( + self, + cr, + module, + idref, + mode, + report: Optional[Any] = ..., + noupdate: bool = ..., + xml_filename: Optional[Any] = ..., + ) -> None: ... -def convert_file(cr, module, filename, idref, mode: str = ..., noupdate: bool = ..., kind: Optional[Any] = ..., report: Optional[Any] = ..., pathname: Optional[Any] = ...) -> None: ... +def convert_file( + cr, + module, + filename, + idref, + mode: str = ..., + noupdate: bool = ..., + kind: Optional[Any] = ..., + report: Optional[Any] = ..., + pathname: Optional[Any] = ..., +) -> None: ... def convert_sql_import(cr, fp) -> None: ... -def convert_csv_import(cr, module, fname, csvcontent, idref: Optional[Any] = ..., mode: str = ..., noupdate: bool = ...) -> None: ... -def convert_xml_import(cr, module, xmlfile, idref: Optional[Any] = ..., mode: str = ..., noupdate: bool = ..., report: Optional[Any] = ...): ... +def convert_csv_import( + cr, + module, + fname, + csvcontent, + idref: Optional[Any] = ..., + mode: str = ..., + noupdate: bool = ..., +) -> None: ... +def convert_xml_import( + cr, + module, + xmlfile, + idref: Optional[Any] = ..., + mode: str = ..., + noupdate: bool = ..., + report: Optional[Any] = ..., +): ... diff --git a/odoo-stubs/tools/float_utils.pyi b/odoo-stubs/tools/float_utils.pyi index 78d787b..8f93439 100644 --- a/odoo-stubs/tools/float_utils.pyi +++ b/odoo-stubs/tools/float_utils.pyi @@ -1,11 +1,28 @@ from typing import Any, Optional def round(f): ... -def _float_check_precision(precision_digits: Optional[Any] = ..., precision_rounding: Optional[Any] = ...): ... -def float_round(value, precision_digits: Optional[Any] = ..., precision_rounding: Optional[Any] = ..., rounding_method: str = ...): ... -def float_is_zero(value, precision_digits: Optional[Any] = ..., precision_rounding: Optional[Any] = ...): ... -def float_compare(value1, value2, precision_digits: Optional[Any] = ..., precision_rounding: Optional[Any] = ...): ... +def _float_check_precision( + precision_digits: Optional[Any] = ..., precision_rounding: Optional[Any] = ... +): ... +def float_round( + value, + precision_digits: Optional[Any] = ..., + precision_rounding: Optional[Any] = ..., + rounding_method: str = ..., +): ... +def float_is_zero( + value, + precision_digits: Optional[Any] = ..., + precision_rounding: Optional[Any] = ..., +): ... +def float_compare( + value1, + value2, + precision_digits: Optional[Any] = ..., + precision_rounding: Optional[Any] = ..., +): ... def float_repr(value, precision_digits): ... + _float_repr = float_repr def float_split_str(value, precision_digits): ... diff --git a/odoo-stubs/tools/graph.pyi b/odoo-stubs/tools/graph.pyi index a0316a4..deaf997 100644 --- a/odoo-stubs/tools/graph.pyi +++ b/odoo-stubs/tools/graph.pyi @@ -6,7 +6,9 @@ class graph: no_ancester: Any transitions: Any result: Any - def __init__(self, nodes, transitions, no_ancester: Optional[Any] = ...) -> None: ... + def __init__( + self, nodes, transitions, no_ancester: Optional[Any] = ... + ) -> None: ... edge_wt: Any def init_rank(self) -> None: ... reachable_nodes: Any @@ -50,5 +52,7 @@ class graph: start: Any def process(self, starting_node) -> None: ... def __str__(self): ... - def scale(self, maxx, maxy, nwidth: int = ..., nheight: int = ..., margin: int = ...) -> None: ... + def scale( + self, maxx, maxy, nwidth: int = ..., nheight: int = ..., margin: int = ... + ) -> None: ... def result_get(self): ... diff --git a/odoo-stubs/tools/image.pyi b/odoo-stubs/tools/image.pyi index bcf7808..0f0571d 100644 --- a/odoo-stubs/tools/image.pyi +++ b/odoo-stubs/tools/image.pyi @@ -1,12 +1,57 @@ from typing import Any, Optional -def image_resize_image(base64_source, size=..., encoding: str = ..., filetype: Optional[Any] = ..., avoid_if_small: bool = ...): ... -def image_resize_and_sharpen(image, size, preserve_aspect_ratio: bool = ..., factor: float = ...): ... +def image_resize_image( + base64_source, + size=..., + encoding: str = ..., + filetype: Optional[Any] = ..., + avoid_if_small: bool = ..., +): ... +def image_resize_and_sharpen( + image, size, preserve_aspect_ratio: bool = ..., factor: float = ... +): ... def image_save_for_web(image, fp: Optional[Any] = ..., format: Optional[Any] = ...): ... -def image_resize_image_big(base64_source, size=..., encoding: str = ..., filetype: Optional[Any] = ..., avoid_if_small: bool = ...): ... -def image_resize_image_medium(base64_source, size=..., encoding: str = ..., filetype: Optional[Any] = ..., avoid_if_small: bool = ...): ... -def image_resize_image_small(base64_source, size=..., encoding: str = ..., filetype: Optional[Any] = ..., avoid_if_small: bool = ...): ... -def crop_image(data, type: str = ..., ratio: bool = ..., size: Optional[Any] = ..., image_format: Optional[Any] = ...): ... +def image_resize_image_big( + base64_source, + size=..., + encoding: str = ..., + filetype: Optional[Any] = ..., + avoid_if_small: bool = ..., +): ... +def image_resize_image_medium( + base64_source, + size=..., + encoding: str = ..., + filetype: Optional[Any] = ..., + avoid_if_small: bool = ..., +): ... +def image_resize_image_small( + base64_source, + size=..., + encoding: str = ..., + filetype: Optional[Any] = ..., + avoid_if_small: bool = ..., +): ... +def crop_image( + data, + type: str = ..., + ratio: bool = ..., + size: Optional[Any] = ..., + image_format: Optional[Any] = ..., +): ... def image_colorize(original, randomize: bool = ..., color=...): ... -def image_get_resized_images(base64_source, return_big: bool = ..., return_medium: bool = ..., return_small: bool = ..., big_name: str = ..., medium_name: str = ..., small_name: str = ..., avoid_resize_big: bool = ..., avoid_resize_medium: bool = ..., avoid_resize_small: bool = ...): ... -def image_resize_images(vals, big_name: str = ..., medium_name: str = ..., small_name: str = ...) -> None: ... +def image_get_resized_images( + base64_source, + return_big: bool = ..., + return_medium: bool = ..., + return_small: bool = ..., + big_name: str = ..., + medium_name: str = ..., + small_name: str = ..., + avoid_resize_big: bool = ..., + avoid_resize_medium: bool = ..., + avoid_resize_small: bool = ..., +): ... +def image_resize_images( + vals, big_name: str = ..., medium_name: str = ..., small_name: str = ... +) -> None: ... diff --git a/odoo-stubs/tools/mail.pyi b/odoo-stubs/tools/mail.pyi index ce0142b..66d9366 100644 --- a/odoo-stubs/tools/mail.pyi +++ b/odoo-stubs/tools/mail.pyi @@ -1,6 +1,7 @@ -from lxml.html import clean from typing import Any, Optional +from lxml.html import clean + _logger: Any tags_to_kill: Any tags_to_remove: Any @@ -17,11 +18,25 @@ class _Cleaner(clean.Cleaner): def strip_class(self, el) -> None: ... def parse_style(self, el) -> None: ... -def html_sanitize(src, silent: bool = ..., sanitize_tags: bool = ..., sanitize_attributes: bool = ..., sanitize_style: bool = ..., strip_style: bool = ..., strip_classes: bool = ...): ... +def html_sanitize( + src, + silent: bool = ..., + sanitize_tags: bool = ..., + sanitize_attributes: bool = ..., + sanitize_style: bool = ..., + strip_style: bool = ..., + strip_classes: bool = ..., +): ... def html_keep_url(text): ... def html2plaintext(html, body_id: Optional[Any] = ..., encoding: str = ...): ... def plaintext2html(text, container_tag: bool = ...): ... -def append_content_to_html(html, content, plaintext: bool = ..., preserve: bool = ..., container_tag: bool = ...): ... +def append_content_to_html( + html, + content, + plaintext: bool = ..., + preserve: bool = ..., + container_tag: bool = ..., +): ... email_re: Any single_email_re: Any @@ -32,7 +47,29 @@ mail_header_msgid_re: Any email_addr_escapes_re: Any def generate_tracking_message_id(res_id): ... -def email_send(email_from, email_to, subject, body, email_cc: Optional[Any] = ..., email_bcc: Optional[Any] = ..., reply_to: bool = ..., attachments: Optional[Any] = ..., message_id: Optional[Any] = ..., references: Optional[Any] = ..., openobject_id: bool = ..., debug: bool = ..., subtype: str = ..., headers: Optional[Any] = ..., smtp_server: Optional[Any] = ..., smtp_port: Optional[Any] = ..., ssl: bool = ..., smtp_user: Optional[Any] = ..., smtp_password: Optional[Any] = ..., cr: Optional[Any] = ..., uid: Optional[Any] = ...): ... +def email_send( + email_from, + email_to, + subject, + body, + email_cc: Optional[Any] = ..., + email_bcc: Optional[Any] = ..., + reply_to: bool = ..., + attachments: Optional[Any] = ..., + message_id: Optional[Any] = ..., + references: Optional[Any] = ..., + openobject_id: bool = ..., + debug: bool = ..., + subtype: str = ..., + headers: Optional[Any] = ..., + smtp_server: Optional[Any] = ..., + smtp_port: Optional[Any] = ..., + ssl: bool = ..., + smtp_user: Optional[Any] = ..., + smtp_password: Optional[Any] = ..., + cr: Optional[Any] = ..., + uid: Optional[Any] = ..., +): ... def email_split(text): ... def email_split_and_format(text): ... def email_references(references): ... diff --git a/odoo-stubs/tools/mimetypes.pyi b/odoo-stubs/tools/mimetypes.pyi index 9c77d9f..efc1a96 100644 --- a/odoo-stubs/tools/mimetypes.pyi +++ b/odoo-stubs/tools/mimetypes.pyi @@ -1,7 +1,7 @@ from collections import namedtuple from typing import Any -_Entry = namedtuple('_Entry', ['mimetype', 'signatures', 'discriminants']) +_Entry = namedtuple("_Entry", ["mimetype", "signatures", "discriminants"]) def guess_mimetype(bin_data, default: str = ...): ... diff --git a/odoo-stubs/tools/misc.pyi b/odoo-stubs/tools/misc.pyi index ec814e6..42ca980 100644 --- a/odoo-stubs/tools/misc.pyi +++ b/odoo-stubs/tools/misc.pyi @@ -1,12 +1,15 @@ -from .cache import * import pickle as pickle_ -import xlsxwriter -import xlwt from collections import Mapping, MutableMapping, MutableSet, defaultdict from itertools import repeat as repeat -from odoo.loglevels import exception_to_unicode as exception_to_unicode, get_encodings as get_encodings from typing import Any, Optional +import xlsxwriter +import xlwt +from odoo.loglevels import exception_to_unicode as exception_to_unicode +from odoo.loglevels import get_encodings as get_encodings + +from .cache import * + _logger: Any SKIPPED_ELEMENT_TYPES: Any @@ -72,7 +75,12 @@ class mute_logger: def __init__(self, *loggers) -> None: ... def filter(self, record): ... def __enter__(self) -> None: ... - def __exit__(self, exc_type: Optional[Any] = ..., exc_val: Optional[Any] = ..., exc_tb: Optional[Any] = ...) -> None: ... + def __exit__( + self, + exc_type: Optional[Any] = ..., + exc_val: Optional[Any] = ..., + exc_tb: Optional[Any] = ..., + ) -> None: ... def __call__(self, func): ... _ph: Any @@ -146,7 +154,15 @@ class Reverse: def ignore(*exc) -> None: ... def html_escape(text): ... -def formatLang(env, value, digits: Optional[Any] = ..., grouping: bool = ..., monetary: bool = ..., dp: bool = ..., currency_obj: bool = ...): ... +def formatLang( + env, + value, + digits: Optional[Any] = ..., + grouping: bool = ..., + monetary: bool = ..., + dp: bool = ..., + currency_obj: bool = ..., +): ... def format_date(env, value, lang_code: str = ..., date_format: bool = ...): ... def _consteq(str1, str2): ... diff --git a/odoo-stubs/tools/osutil.pyi b/odoo-stubs/tools/osutil.pyi index ebe7d31..045e264 100644 --- a/odoo-stubs/tools/osutil.pyi +++ b/odoo-stubs/tools/osutil.pyi @@ -1,12 +1,16 @@ import ctypes import os -from odoo.release import nt_service_name as nt_service_name from typing import Any, Optional +from odoo.release import nt_service_name as nt_service_name + def listdir(dir, recursive: bool = ...): ... def walksymlinks(top, topdown: bool = ..., onerror: Optional[Any] = ...) -> None: ... def tempdir() -> None: ... -def zip_dir(path, stream, include_dir: bool = ..., fnct_sort: Optional[Any] = ...) -> None: ... +def zip_dir( + path, stream, include_dir: bool = ..., fnct_sort: Optional[Any] = ... +) -> None: ... + getppid = os.getppid is_running_as_nt_service: Any _TH32CS_SNAPPROCESS: int diff --git a/odoo-stubs/tools/profiler.pyi b/odoo-stubs/tools/profiler.pyi index c920bc1..2c95c8a 100644 --- a/odoo-stubs/tools/profiler.pyi +++ b/odoo-stubs/tools/profiler.pyi @@ -9,7 +9,20 @@ class _LogTracer: files: Any deep: Any first_frame: Any - def __init__(self, whitelist: Optional[Any] = ..., blacklist: Optional[Any] = ..., files: Optional[Any] = ..., deep: bool = ...) -> None: ... + def __init__( + self, + whitelist: Optional[Any] = ..., + blacklist: Optional[Any] = ..., + files: Optional[Any] = ..., + deep: bool = ..., + ) -> None: ... def tracer(self, frame, event, arg): ... -def profile(method: Optional[Any] = ..., whitelist: Optional[Any] = ..., blacklist=..., files: Optional[Any] = ..., minimum_time: int = ..., minimum_queries: int = ...): ... +def profile( + method: Optional[Any] = ..., + whitelist: Optional[Any] = ..., + blacklist=..., + files: Optional[Any] = ..., + minimum_time: int = ..., + minimum_queries: int = ..., +): ... diff --git a/odoo-stubs/tools/pycompat.pyi b/odoo-stubs/tools/pycompat.pyi index 6dee2d2..6f5c57e 100644 --- a/odoo-stubs/tools/pycompat.pyi +++ b/odoo-stubs/tools/pycompat.pyi @@ -3,7 +3,7 @@ from typing import Any, Optional PY2: Any -_Writer = namedtuple('_Writer', 'writerow writerows') +_Writer = namedtuple("_Writer", "writerow writerows") unichr = chr text_type = str string_types: Any diff --git a/odoo-stubs/tools/safe_eval.pyi b/odoo-stubs/tools/safe_eval.pyi index 48e50e4..a4d1c52 100644 --- a/odoo-stubs/tools/safe_eval.pyi +++ b/odoo-stubs/tools/safe_eval.pyi @@ -4,4 +4,11 @@ unsafe_eval = eval def test_expr(expr, allowed_codes, mode: str = ...): ... def const_eval(expr): ... -def safe_eval(expr, globals_dict: Optional[Any] = ..., locals_dict: Optional[Any] = ..., mode: str = ..., nocopy: bool = ..., locals_builtins: bool = ...): ... +def safe_eval( + expr, + globals_dict: Optional[Any] = ..., + locals_dict: Optional[Any] = ..., + mode: str = ..., + nocopy: bool = ..., + locals_builtins: bool = ..., +): ... diff --git a/odoo-stubs/tools/sql.pyi b/odoo-stubs/tools/sql.pyi index d073cfe..6d72b95 100644 --- a/odoo-stubs/tools/sql.pyi +++ b/odoo-stubs/tools/sql.pyi @@ -9,7 +9,9 @@ def table_kind(cr, tablename): ... def create_model_table(cr, tablename, comment: Optional[Any] = ...) -> None: ... def table_columns(cr, tablename): ... def column_exists(cr, tablename, columnname): ... -def create_column(cr, tablename, columnname, columntype, comment: Optional[Any] = ...) -> None: ... +def create_column( + cr, tablename, columnname, columntype, comment: Optional[Any] = ... +) -> None: ... def rename_column(cr, tablename, columnname1, columnname2) -> None: ... def convert_column(cr, tablename, columnname, columntype) -> None: ... def set_not_null(cr, tablename, columnname): ... diff --git a/odoo-stubs/tools/test_reports.pyi b/odoo-stubs/tools/test_reports.pyi index 57e566b..5b91c53 100644 --- a/odoo-stubs/tools/test_reports.pyi +++ b/odoo-stubs/tools/test_reports.pyi @@ -1,8 +1,28 @@ -from . import config as config from typing import Any, Optional +from . import config as config + _logger: Any _test_logger: Any -def try_report(cr, uid, rname, ids, data: Optional[Any] = ..., context: Optional[Any] = ..., our_module: Optional[Any] = ..., report_type: Optional[Any] = ...): ... -def try_report_action(cr, uid, action_id, active_model: Optional[Any] = ..., active_ids: Optional[Any] = ..., wiz_data: Optional[Any] = ..., wiz_buttons: Optional[Any] = ..., context: Optional[Any] = ..., our_module: Optional[Any] = ...): ... +def try_report( + cr, + uid, + rname, + ids, + data: Optional[Any] = ..., + context: Optional[Any] = ..., + our_module: Optional[Any] = ..., + report_type: Optional[Any] = ..., +): ... +def try_report_action( + cr, + uid, + action_id, + active_model: Optional[Any] = ..., + active_ids: Optional[Any] = ..., + wiz_data: Optional[Any] = ..., + wiz_buttons: Optional[Any] = ..., + context: Optional[Any] = ..., + our_module: Optional[Any] = ..., +): ... diff --git a/odoo-stubs/tools/translate.pyi b/odoo-stubs/tools/translate.pyi index 7931305..f2cb0f8 100644 --- a/odoo-stubs/tools/translate.pyi +++ b/odoo-stubs/tools/translate.pyi @@ -59,7 +59,9 @@ class PoFile: def next(self): ... __next__: Any def write_infos(self, modules) -> None: ... - def write(self, modules, tnrs, source, trad, comments: Optional[Any] = ...) -> None: ... + def write( + self, modules, tnrs, source, trad, comments: Optional[Any] = ... + ) -> None: ... def trans_export(lang, modules, buffer, format, cr) -> None: ... def trans_parse_rml(de): ... @@ -68,8 +70,24 @@ def in_modules(object_name, modules): ... def _extract_translatable_qweb_terms(element, callback) -> None: ... def babel_extract_qweb(fileobj, keywords, comment_tags, options): ... def trans_generate(lang, modules, cr): ... -def trans_load(cr, filename, lang, verbose: bool = ..., module_name: Optional[Any] = ..., context: Optional[Any] = ...): ... -def trans_load_data(cr, fileobj, fileformat, lang, lang_name: Optional[Any] = ..., verbose: bool = ..., module_name: Optional[Any] = ..., context: Optional[Any] = ...) -> None: ... +def trans_load( + cr, + filename, + lang, + verbose: bool = ..., + module_name: Optional[Any] = ..., + context: Optional[Any] = ..., +): ... +def trans_load_data( + cr, + fileobj, + fileformat, + lang, + lang_name: Optional[Any] = ..., + verbose: bool = ..., + module_name: Optional[Any] = ..., + context: Optional[Any] = ..., +) -> None: ... def get_locales(lang: Optional[Any] = ...) -> None: ... def resetlocale(): ... def load_language(cr, lang) -> None: ... diff --git a/odoo-stubs/tools/which.pyi b/odoo-stubs/tools/which.pyi index 36bb156..be2317d 100644 --- a/odoo-stubs/tools/which.pyi +++ b/odoo-stubs/tools/which.pyi @@ -1,4 +1,5 @@ -from os import R_OK as R_OK, W_OK as W_OK +from os import R_OK as R_OK +from os import W_OK as W_OK from os.path import dirname as dirname from typing import Any, Optional @@ -9,5 +10,7 @@ windows: Any seen: Any defpathext: Any -def which_files(file, mode=..., path: Optional[Any] = ..., pathext: Optional[Any] = ...) -> None: ... +def which_files( + file, mode=..., path: Optional[Any] = ..., pathext: Optional[Any] = ... +) -> None: ... def which(file, mode=..., path: Optional[Any] = ..., pathext: Optional[Any] = ...): ... diff --git a/odoo-stubs/tools/xml_utils.pyi b/odoo-stubs/tools/xml_utils.pyi index 1188afe..9c3679e 100644 --- a/odoo-stubs/tools/xml_utils.pyi +++ b/odoo-stubs/tools/xml_utils.pyi @@ -1,7 +1,10 @@ -from odoo.tools.misc import file_open as file_open from typing import Any, Optional +from odoo.tools.misc import file_open as file_open + def check_with_xsd(tree_or_str, stream) -> None: ... def _check_with_xsd(tree_or_str, stream) -> None: ... -def create_xml_node_chain(first_parent_node, nodes_list, last_node_value: Optional[Any] = ...): ... +def create_xml_node_chain( + first_parent_node, nodes_list, last_node_value: Optional[Any] = ... +): ... def create_xml_node(parent_node, node_name, node_value: Optional[Any] = ...): ... diff --git a/odoo-stubs/tools/yaml_import.pyi b/odoo-stubs/tools/yaml_import.pyi index f7cc975..8c15054 100644 --- a/odoo-stubs/tools/yaml_import.pyi +++ b/odoo-stubs/tools/yaml_import.pyi @@ -1,10 +1,16 @@ -from . import assertion_report as assertion_report, pycompat as pycompat, yaml_tag as yaml_tag -from .config import config as config -from .misc import DEFAULT_SERVER_DATETIME_FORMAT as DEFAULT_SERVER_DATETIME_FORMAT, DEFAULT_SERVER_DATE_FORMAT as DEFAULT_SERVER_DATE_FORMAT, file_open as file_open -from .safe_eval import safe_eval as safe_eval -from odoo import SUPERUSER_ID as SUPERUSER_ID from typing import Any, Optional +from odoo import SUPERUSER_ID as SUPERUSER_ID + +from . import assertion_report as assertion_report +from . import pycompat as pycompat +from . import yaml_tag as yaml_tag +from .config import config as config +from .misc import DEFAULT_SERVER_DATE_FORMAT as DEFAULT_SERVER_DATE_FORMAT +from .misc import DEFAULT_SERVER_DATETIME_FORMAT as DEFAULT_SERVER_DATETIME_FORMAT +from .misc import file_open as file_open +from .safe_eval import safe_eval as safe_eval + unsafe_eval = eval _logger: Any @@ -46,7 +52,17 @@ class YamlInterpreter: eval_context: Any env: Any sudo_env: Any - def __init__(self, cr, module, id_map, mode, filename, report: Optional[Any] = ..., noupdate: bool = ..., loglevel=...) -> None: ... + def __init__( + self, + cr, + module, + id_map, + mode, + filename, + report: Optional[Any] = ..., + noupdate: bool = ..., + loglevel=..., + ) -> None: ... def _log(self, *args, **kwargs) -> None: ... def validate_xml_id(self, xml_id) -> None: ... def get_id(self, xml_id): ... @@ -62,10 +78,27 @@ class YamlInterpreter: def create_osv_memory_record(self, record, fields): ... def process_record(self, node) -> None: ... _dict: Any - def _create_record(self, model, fields, view_info: Optional[Any] = ..., parent=..., default: bool = ..., context: Optional[Any] = ...): ... + def _create_record( + self, + model, + fields, + view_info: Optional[Any] = ..., + parent=..., + default: bool = ..., + context: Optional[Any] = ..., + ): ... def process_ref(self, node, field: Optional[Any] = ...): ... def process_eval(self, node): ... - def _eval_field(self, model, field_name, expression, view_info: bool = ..., parent=..., default: bool = ..., context: Optional[Any] = ...): ... + def _eval_field( + self, + model, + field_name, + expression, + view_info: bool = ..., + parent=..., + default: bool = ..., + context: Optional[Any] = ..., + ): ... def process_context(self, node) -> None: ... def process_python(self, node) -> None: ... def _eval_params(self, model, params): ... @@ -81,5 +114,15 @@ class YamlInterpreter: def _process_node(self, node) -> None: ... def _log_node(self, node, is_preceded_by_comment): ... -def yaml_import(cr, module, yamlfile, kind, idref: Optional[Any] = ..., mode: str = ..., noupdate: bool = ..., report: Optional[Any] = ...) -> None: ... +def yaml_import( + cr, + module, + yamlfile, + kind, + idref: Optional[Any] = ..., + mode: str = ..., + noupdate: bool = ..., + report: Optional[Any] = ..., +) -> None: ... + convert_yaml_import = yaml_import diff --git a/odoo-stubs/tools/yaml_tag.pyi b/odoo-stubs/tools/yaml_tag.pyi index 01932cc..62ba6dc 100644 --- a/odoo-stubs/tools/yaml_tag.pyi +++ b/odoo-stubs/tools/yaml_tag.pyi @@ -11,13 +11,17 @@ class Assert(YamlTag): id: Any severity: Any string: Any - def __init__(self, model, id: Optional[Any] = ..., severity=..., string: str = ..., **kwargs) -> None: ... + def __init__( + self, model, id: Optional[Any] = ..., severity=..., string: str = ..., **kwargs + ) -> None: ... class Record(YamlTag): model: Any id: Any view: Any - def __init__(self, model, id, use: str = ..., view: bool = ..., **kwargs) -> None: ... + def __init__( + self, model, id, use: str = ..., view: bool = ..., **kwargs + ) -> None: ... def __str__(self): ... class Python(YamlTag):