mirror of
https://github.com/odoo-ide/odoo-stubs.git
synced 2025-05-08 16:52:26 +03:00
Update stubs
This commit is contained in:
@@ -452,6 +452,7 @@ class Properties(Field):
|
||||
column_type: tuple[str, str]
|
||||
copy: bool
|
||||
prefetch: bool
|
||||
unaccent: bool
|
||||
write_sequence: int
|
||||
store: bool
|
||||
readonly: bool
|
||||
@@ -469,9 +470,10 @@ class Properties(Field):
|
||||
def convert_to_cache(self, value, record: BaseModel, validate: bool = ...): ...
|
||||
def convert_to_record(self, value, record: BaseModel): ...
|
||||
def convert_to_read(self, value, record: BaseModel, use_name_get: bool = ...): ...
|
||||
def convert_to_read_multi(self, values, records: BaseModel, use_name_get: bool = ...): ...
|
||||
def convert_to_write(self, value, record: BaseModel): ...
|
||||
def convert_to_onchange(self, value, record: BaseModel, names): ...
|
||||
def read(self, records: BaseModel) -> None: ...
|
||||
def _get_res_ids_per_model(self, records: BaseModel, values_list, use_name_get: bool = ...) -> dict[str, set[int]]: ...
|
||||
def write(self, records: _ModelT, value) -> None: ...
|
||||
def _compute(self, records: BaseModel) -> None: ...
|
||||
def _add_default_values(self, env: Environment, values: dict[str, Any]): ...
|
||||
@@ -483,7 +485,7 @@ class Properties(Field):
|
||||
@classmethod
|
||||
def _add_missing_names(cls, values_list: list[dict]) -> None: ...
|
||||
@classmethod
|
||||
def _parse_json_types(cls, values_list: list[dict], env: Environment) -> None: ...
|
||||
def _parse_json_types(cls, values_list: list[dict], env: Environment, res_ids_per_model: dict[str, set[int]]) -> None: ...
|
||||
@classmethod
|
||||
def _list_to_dict(cls, values_list: list[dict]) -> dict: ...
|
||||
@classmethod
|
||||
|
||||
@@ -15,6 +15,7 @@ _T = TypeVar('_T')
|
||||
_ModelT = TypeVar('_ModelT', bound=BaseModel)
|
||||
_Domain = list
|
||||
|
||||
regex_alphanumeric: Pattern[str]
|
||||
regex_order: Pattern[str]
|
||||
regex_object_name: Pattern[str]
|
||||
regex_pg_name: Pattern[str]
|
||||
@@ -30,6 +31,7 @@ def check_pg_name(name: str) -> None: ...
|
||||
regex_private: Pattern[str]
|
||||
|
||||
def check_method_name(name: str) -> None: ...
|
||||
def check_property_field_value_name(property_name) -> None: ...
|
||||
def fix_import_export_id_paths(fieldname: str) -> list[str]: ...
|
||||
|
||||
class MetaModel(api.Meta):
|
||||
@@ -59,7 +61,7 @@ class OriginIds:
|
||||
|
||||
def expand_ids(id0: _T, ids: Iterable) -> Iterator[_T]: ...
|
||||
|
||||
IdType: tuple[type[int], type[str], type[NewId]]
|
||||
IdType: tuple[type[int], type[NewId]]
|
||||
PREFETCH_MAX: int
|
||||
LOG_ACCESS_COLUMNS: list[str]
|
||||
MAGIC_COLUMNS: list[str]
|
||||
@@ -145,12 +147,13 @@ class BaseModel(metaclass=MetaModel):
|
||||
def _rec_name_fallback(self) -> str: ...
|
||||
def user_has_groups(self, groups: str) -> bool: ...
|
||||
def search_count(self, domain: _Domain, limit: int | None = ...) -> int: ...
|
||||
def search(self: _ModelT, domain: _Domain, offset: int = ..., limit: int | None = ..., order: str | None = ..., count: bool = ...) -> _ModelT | int: ...
|
||||
def search(self: _ModelT, domain: _Domain, offset: int = ..., limit: int | None = ..., order: str | None = ...) -> _ModelT: ...
|
||||
def search_fetch(self: _ModelT, domain: _Domain, field_names: Collection[str], offset: int = ..., limit: int | None = ..., order: str | None = ...) -> _ModelT: ...
|
||||
def _compute_display_name(self) -> None: ...
|
||||
def name_get(self) -> list[tuple[int, str]]: ...
|
||||
def name_create(self, name: str) -> tuple[int, str]: ...
|
||||
def name_search(self, name: str = ..., args: _Domain | None = ..., operator: str = ..., limit: int = ...) -> list[tuple[int, str]]: ...
|
||||
def _name_search(self, name: str = ..., args: _Domain | None = ..., operator: str = ..., limit: int = ..., name_get_uid: int | None = ...) -> list[int]: ...
|
||||
def _name_search(self, name: str = ..., domain: _Domain | None = ..., operator: str = ..., limit: int = ..., order: str | None = ..., name_get_uid: int | None = ...) -> Query: ...
|
||||
def _add_missing_default_values(self, values: dict[str, Any]) -> dict[str, Any]: ...
|
||||
@classmethod
|
||||
def clear_caches(cls) -> None: ...
|
||||
@@ -189,7 +192,8 @@ class BaseModel(metaclass=MetaModel):
|
||||
def get_field_translations(self, field_name: str, langs: list[str] | None = ...) -> tuple[list[dict[str, Any]], dict[str, Any]]: ...
|
||||
def _read_format(self, fnames: Collection[str], load: str = ...) -> list[dict[str, Any]]: ...
|
||||
def _fetch_field(self, field: Field) -> None: ...
|
||||
def _read(self, field_names: Collection[str]): ...
|
||||
def fetch(self, field_names: Collection[str]) -> None: ...
|
||||
def _fetch_query(self: _ModelT, query: Query, fields: Iterable[Field]) -> _ModelT: ...
|
||||
def get_metadata(self) -> list[dict[str, Any]]: ...
|
||||
def get_base_url(self) -> str: ...
|
||||
def _check_company(self, fnames: Collection[str] | None = ...) -> None: ...
|
||||
@@ -218,7 +222,8 @@ class BaseModel(metaclass=MetaModel):
|
||||
def _generate_order_by_inner(self, alias: str, order_spec: str, query: Query, reverse_direction: bool = ..., seen: set | None = ...) -> list[str]: ...
|
||||
def _generate_order_by(self, order_spec: str | None, query: Query) -> str: ...
|
||||
def _flush_search(self, domain: _Domain, fields: Sequence[str] | None = ..., order: str | None = ..., seen: set | None = ...) -> None: ...
|
||||
def _search(self: _ModelT, domain: _Domain, offset: int = ..., limit: int | None = ..., order: str | None = ..., count: bool = ..., access_rights_uid: int | None = ...) -> Query | int: ...
|
||||
def _search(self: _ModelT, domain: _Domain, offset: int = ..., limit: int | None = ..., order: str | None = ..., access_rights_uid: int | None = ...) -> Query: ...
|
||||
def _as_query(self, ordered: bool = ...) -> Query: ...
|
||||
def copy_data(self, default: dict[str, Any] | None = ...) -> list[dict[str, Any]]: ...
|
||||
def copy_translations(self: _ModelT, new: _ModelT, excluded: Container[str] = ...) -> None: ...
|
||||
def copy(self: _ModelT, default: dict[str, Any] | None = ...) -> _ModelT: ...
|
||||
|
||||
@@ -114,6 +114,7 @@ class TriggerTree(dict):
|
||||
root: Any
|
||||
def __init__(self, root: Any = ..., *args, **kwargs) -> None: ...
|
||||
def __bool__(self) -> bool: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def increase(self, key) -> TriggerTree: ...
|
||||
def depth_first(self) -> Iterator[TriggerTree]: ...
|
||||
@classmethod
|
||||
|
||||
@@ -12,7 +12,6 @@ from watchdog.observers import Observer
|
||||
|
||||
from ..modules.registry import Registry
|
||||
from ..sql_db import Cursor
|
||||
from ..tests import runner as runner
|
||||
|
||||
_WorkerT = TypeVar('_WorkerT', bound=Worker)
|
||||
|
||||
|
||||
@@ -116,12 +116,18 @@ class ConnectionPool:
|
||||
def borrow(self, connection_info: dict) -> PsycoConnection: ...
|
||||
def give_back(self, connection: PsycoConnection, keep_in_pool: bool = ...) -> 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:
|
||||
dbname: str
|
||||
dsn: dict
|
||||
__dbname: str
|
||||
__dsn: dict
|
||||
__pool: ConnectionPool
|
||||
def __init__(self, pool: ConnectionPool, dbname: str, dsn: dict) -> None: ...
|
||||
@property
|
||||
def dsn(self) -> dict: ...
|
||||
@property
|
||||
def dbname(self) -> str: ...
|
||||
def cursor(self) -> Cursor: ...
|
||||
def __bool__(self) -> NoReturn: ...
|
||||
|
||||
|
||||
51
odoo-stubs/tests/case.pyi
Normal file
51
odoo-stubs/tests/case.pyi
Normal file
@@ -0,0 +1,51 @@
|
||||
from collections.abc import Generator
|
||||
from typing import Any
|
||||
from unittest import TestCase as _TestCase
|
||||
|
||||
__unittest: bool
|
||||
_subtest_msg_sentinel: object
|
||||
|
||||
class _Outcome:
|
||||
result: Any
|
||||
success: bool
|
||||
test: Any
|
||||
def __init__(self, test, result) -> None: ...
|
||||
def testPartExecutor(self, test_case, isTest: bool = ...) -> Generator[None, None, None]: ...
|
||||
def _complete_traceback(self, initial_tb): ...
|
||||
|
||||
class TestCase(_TestCase):
|
||||
_class_cleanups: list
|
||||
__unittest_skip__: bool
|
||||
__unittest_skip_why__: str
|
||||
_moduleSetUpFailed: bool
|
||||
_testMethodName: str
|
||||
_outcome: Any
|
||||
_cleanups: list
|
||||
_subtest: Any
|
||||
_type_equality_funcs: dict
|
||||
def __init__(self, methodName: str = ...) -> None: ...
|
||||
def addCleanup(self, function, *args, **kwargs) -> None: ...
|
||||
@classmethod
|
||||
def addClassCleanup(cls, function, *args, **kwargs) -> None: ...
|
||||
def shortDescription(self) -> None: ...
|
||||
def subTest(self, msg=..., **params) -> Generator[None, None, None]: ...
|
||||
def _addError(self, result, test, exc_info) -> None: ...
|
||||
def _callSetUp(self) -> None: ...
|
||||
def _callTestMethod(self, method) -> None: ...
|
||||
def _callTearDown(self) -> None: ...
|
||||
def _callCleanup(self, function, *args, **kwargs) -> None: ...
|
||||
def run(self, result): ...
|
||||
def doCleanups(self) -> None: ...
|
||||
@classmethod
|
||||
def doClassCleanups(cls) -> None: ...
|
||||
|
||||
class _SubTest(TestCase):
|
||||
_message: Any
|
||||
test_case: Any
|
||||
params: Any
|
||||
failureException: Any
|
||||
def __init__(self, test_case, message, params) -> None: ...
|
||||
def runTest(self) -> None: ...
|
||||
def _subDescription(self) -> str: ...
|
||||
def id(self) -> str: ...
|
||||
def __str__(self) -> str: ...
|
||||
@@ -1,22 +1,18 @@
|
||||
import collections
|
||||
import logging
|
||||
import sys
|
||||
import unittest
|
||||
from concurrent.futures import Future
|
||||
from re import Pattern
|
||||
from types import TracebackType
|
||||
|
||||
from itertools import count
|
||||
from subprocess import Popen
|
||||
from threading import Thread
|
||||
from typing import Any, Callable, Generator, Generic, Iterator, Mapping, Match, TypeVar
|
||||
from unittest import TestCase, TestSuite
|
||||
from xmlrpc import client as xmlrpclib
|
||||
|
||||
import requests
|
||||
from lxml.etree import _Element
|
||||
from websocket import WebSocket
|
||||
|
||||
from . import case
|
||||
from .runner import OdooTestResult
|
||||
from ..api import Environment
|
||||
from ..http import Session
|
||||
@@ -61,34 +57,20 @@ class RecordCapturer:
|
||||
@property
|
||||
def records(self) -> BaseModel: ...
|
||||
|
||||
BackportSuite: type[TestSuite]
|
||||
|
||||
class OdooSuite(BackportSuite):
|
||||
def _handleClassSetUp(self, test, result) -> None: ...
|
||||
def _tearDownPreviousClass(self, test, result) -> None: ...
|
||||
def has_http_case(self) -> bool: ...
|
||||
|
||||
class MetaCase(type):
|
||||
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):
|
||||
_python_version: tuple
|
||||
_class_cleanups: list
|
||||
tearDown_exceptions: list
|
||||
class BaseCase(case.TestCase, metaclass=MetaCase):
|
||||
registry: Registry
|
||||
env: Environment
|
||||
cr: Cursor
|
||||
@classmethod
|
||||
def addClassCleanup(cls, function, *args, **kwargs) -> None: ...
|
||||
@classmethod
|
||||
def doClassCleanups(cls) -> None: ...
|
||||
longMessage: bool
|
||||
warm: bool
|
||||
_python_version: tuple
|
||||
def __init__(self, methodName: str = ...) -> None: ...
|
||||
def run(self, result: OdooTestResult) -> None: ...
|
||||
def shortDescription(self) -> None: ...
|
||||
def cursor(self) -> Cursor: ...
|
||||
@property
|
||||
def uid(self) -> int: ...
|
||||
@@ -118,14 +100,6 @@ class BaseCase(unittest.TestCase, metaclass=MetaCase):
|
||||
def assertHTMLEqual(self, original: str, expected: str) -> None: ...
|
||||
profile_session: str
|
||||
def profile(self, description: str = ..., **kwargs) -> Profiler: ...
|
||||
def _callSetUp(self) -> None: ...
|
||||
|
||||
class _ErrorCatcher(list):
|
||||
__slots__ = ['test']
|
||||
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]
|
||||
|
||||
@@ -335,10 +309,3 @@ 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]: ...
|
||||
|
||||
class TagsSelector:
|
||||
filter_spec_re: Pattern
|
||||
exclude: set
|
||||
include: set
|
||||
def __init__(self, spec: str) -> None: ...
|
||||
def check(self, test) -> bool: ...
|
||||
|
||||
53
odoo-stubs/tests/result.pyi
Normal file
53
odoo-stubs/tests/result.pyi
Normal file
@@ -0,0 +1,53 @@
|
||||
from collections.abc import Generator
|
||||
from logging import Logger
|
||||
from re import Pattern
|
||||
from typing import Any, NamedTuple
|
||||
|
||||
__unittest: bool
|
||||
STDOUT_LINE: str
|
||||
STDERR_LINE: str
|
||||
stats_logger: Logger
|
||||
|
||||
class Stat(NamedTuple):
|
||||
time: float
|
||||
queries: int
|
||||
def __add__(self, other: Stat) -> Stat: ...
|
||||
|
||||
_TEST_ID: Pattern
|
||||
|
||||
class OdooTestResult:
|
||||
_previousTestClass: Any
|
||||
_moduleSetUpFailed: bool
|
||||
failures_count: int
|
||||
errors_count: int
|
||||
testsRun: int
|
||||
skipped: int
|
||||
tb_locals: bool
|
||||
time_start: float | None
|
||||
queries_start: int | None
|
||||
_soft_fail: bool
|
||||
had_failure: bool
|
||||
stats: dict[str, Stat]
|
||||
def __init__(self, stream: Any | None = ..., descriptions: Any | None = ..., verbosity: Any | None = ...) -> None: ...
|
||||
def printErrors(self) -> None: ...
|
||||
def startTest(self, test) -> None: ...
|
||||
def stopTest(self, test) -> None: ...
|
||||
def addError(self, test, err) -> None: ...
|
||||
def addFailure(self, test, err) -> None: ...
|
||||
def addSubTest(self, test, subtest, err) -> None: ...
|
||||
def addSuccess(self, test) -> None: ...
|
||||
def addSkip(self, test, reason) -> None: ...
|
||||
def wasSuccessful(self) -> bool: ...
|
||||
def _exc_info_to_string(self, err, test) -> str: ...
|
||||
def _is_relevant_tb_level(self, tb) -> bool: ...
|
||||
def _count_relevant_tb_levels(self, tb) -> int: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __str__(self) -> str: ...
|
||||
def soft_fail(self) -> Generator[None, None, None]: ...
|
||||
def update(self, other) -> None: ...
|
||||
def log(self, level, msg, *args, test: Any | None = ..., exc_info: Any | None = ..., extra: Any | None = ..., stack_info: bool = ..., caller_infos: Any | None = ...) -> None: ...
|
||||
def log_stats(self) -> None: ...
|
||||
def getDescription(self, test) -> str: ...
|
||||
def collectStats(self, test_id) -> Generator[None, None, None]: ...
|
||||
def logError(self, flavour, test, error) -> None: ...
|
||||
def getErrorCallerInfo(self, error, test) -> tuple | None: ...
|
||||
@@ -1,40 +0,0 @@
|
||||
import unittest
|
||||
from collections import defaultdict
|
||||
from logging import Logger
|
||||
from re import Pattern
|
||||
from typing import Any, Generator, NamedTuple
|
||||
|
||||
stats_logger: Logger
|
||||
|
||||
class Stat(NamedTuple):
|
||||
time: float
|
||||
queries: int
|
||||
def __add__(self, other: Stat) -> Stat: ...
|
||||
|
||||
_TEST_ID: Pattern
|
||||
|
||||
class OdooTestResult(unittest.result.TestResult):
|
||||
time_start: float | None
|
||||
queries_start: int | None
|
||||
_soft_fail: bool
|
||||
had_failure: bool
|
||||
stats: defaultdict[Any, Stat]
|
||||
def __init__(self) -> None: ...
|
||||
def __str__(self) -> str: ...
|
||||
def soft_fail(self) -> Generator[None, None, None]: ...
|
||||
shouldStop: Any
|
||||
def update(self, other) -> None: ...
|
||||
def log(self, level, msg, *args, test: Any | None = ..., exc_info: Any | None = ..., extra: Any | None = ...,
|
||||
stack_info: bool = ..., caller_infos: Any | None = ...) -> None: ...
|
||||
def log_stats(self) -> None: ...
|
||||
def getDescription(self, test): ...
|
||||
def startTest(self, test) -> None: ...
|
||||
def stopTest(self, test) -> None: ...
|
||||
def collectStats(self, test_id) -> Generator[None, None, None]: ...
|
||||
def addError(self, test, err) -> None: ...
|
||||
def addFailure(self, test, err) -> None: ...
|
||||
def addSubTest(self, test, subtest, err) -> None: ...
|
||||
def addSkip(self, test, reason) -> None: ...
|
||||
def addUnexpectedSuccess(self, test) -> None: ...
|
||||
def logError(self, flavour, test, error) -> None: ...
|
||||
def getErrorCallerInfo(self, error, test): ...
|
||||
27
odoo-stubs/tests/suite.pyi
Normal file
27
odoo-stubs/tests/suite.pyi
Normal file
@@ -0,0 +1,27 @@
|
||||
from typing import Any
|
||||
from unittest import BaseTestSuite
|
||||
|
||||
__unittest: bool
|
||||
|
||||
class TestSuite(BaseTestSuite):
|
||||
def run(self, result, debug: bool = ...): ...
|
||||
def _handleClassSetUp(self, test, result) -> None: ...
|
||||
def _createClassOrModuleLevelException(self, result, exception, method_name, parent, info: Any | None = ...) -> None: ...
|
||||
def _tearDownPreviousClass(self, test, result) -> None: ...
|
||||
|
||||
class _ErrorHolder:
|
||||
failureException: Any
|
||||
description: str
|
||||
def __init__(self, description: str) -> None: ...
|
||||
def id(self) -> str: ...
|
||||
def shortDescription(self) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __str__(self) -> str: ...
|
||||
def run(self, result) -> None: ...
|
||||
def __call__(self, result) -> None: ...
|
||||
def countTestCases(self) -> int: ...
|
||||
|
||||
class OdooSuite(TestSuite):
|
||||
def _handleClassSetUp(self, test, result) -> None: ...
|
||||
def _tearDownPreviousClass(self, test, result) -> None: ...
|
||||
def has_http_case(self) -> bool: ...
|
||||
8
odoo-stubs/tests/tag_selector.pyi
Normal file
8
odoo-stubs/tests/tag_selector.pyi
Normal file
@@ -0,0 +1,8 @@
|
||||
from re import Pattern
|
||||
|
||||
class TagsSelector:
|
||||
filter_spec_re: Pattern
|
||||
exclude: set
|
||||
include: set
|
||||
def __init__(self, spec: str) -> None: ...
|
||||
def check(self, test) -> bool: ...
|
||||
@@ -17,6 +17,7 @@ class Query:
|
||||
order: str | None
|
||||
limit: int | None
|
||||
offset: int | None
|
||||
_ids: tuple[int, ...] | None
|
||||
def __init__(self, cr: Cursor, alias: str, table: str | None = ...) -> None: ...
|
||||
def add_table(self, alias: str, table: str | None = ...) -> None: ...
|
||||
def add_where(self, where_clause: str, where_params: Iterable = ...) -> None: ...
|
||||
@@ -25,17 +26,15 @@ class Query:
|
||||
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 subselect(self, *args) -> tuple[str, list]: ...
|
||||
def is_empty(self) -> bool: ...
|
||||
def get_sql(self) -> tuple[str, str, list]: ...
|
||||
@property
|
||||
def _result(self) -> list: ...
|
||||
def get_result_ids(self) -> tuple[int, ...]: ...
|
||||
def set_result_ids(self, ids, ordered: bool = ...) -> None: ...
|
||||
def __str__(self) -> str: ...
|
||||
def __bool__(self) -> bool: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __iter__(self) -> Iterator: ...
|
||||
@property
|
||||
def tables(self) -> tuple[str, ...]: ...
|
||||
def __iter__(self) -> Iterator[int]: ...
|
||||
@property
|
||||
def where_clause(self) -> tuple[str, ...]: ...
|
||||
@property
|
||||
def where_clause_params(self) -> tuple: ...
|
||||
def add_join(self, connection, implicit: bool = ..., outer: bool = ..., extra: str | None = ..., extra_params: tuple = ...) -> tuple[str, str]: ...
|
||||
|
||||
@@ -20,3 +20,4 @@ def load_xsd_files_from_url(env: Environment, url: str, file_name: str, force_re
|
||||
modify_xsd_content: Callable[[bytes], bytes] | None = ...) -> 'odoo.model.ir_attachment | Literal[False]': ...
|
||||
def validate_xml_from_attachment(env: Environment, xml_content, xsd_name: str, reload_files_function: Callable | None = ...,
|
||||
prefix: str | None = ...) -> None: ...
|
||||
def find_xml_value(xpath, xml_element: _Element, namespaces = ...) -> str | None: ...
|
||||
|
||||
Reference in New Issue
Block a user