Update stubs

This commit is contained in:
Trinh Anh Ngoc
2022-11-05 13:22:17 +07:00
parent c86a0fa0db
commit 179c54545c
4 changed files with 215 additions and 189 deletions

View File

@@ -1,240 +1,267 @@
import collections
import logging
import unittest
from typing import Any, Optional
from xmlrpc.client import ServerProxy
from re import Pattern
from itertools import count
from typing import Any, Callable, Generator, Generic, Iterator, Literal, Mapping, Match, TypeVar
from xmlrpc import client as xmlrpclib
import requests
from lxml.etree import _Element
from websocket import WebSocket
from ..api import Environment
from ..http import OpenERPSession
from ..models import BaseModel
from ..modules.registry import Registry
from ..sql_db import Cursor
_logger: Any
ADDONS_PATH: Any
_T = TypeVar('_T')
_CallableT = TypeVar('_CallableT', bound=Callable)
_ModelT = TypeVar('_ModelT', bound=BaseModel)
_FormT = TypeVar('_FormT', bound=Form)
ADDONS_PATH: str
HOST: str
ADMIN_USER_ID: Any
ADMIN_USER_ID: int
def get_db_name(): ...
def get_db_name() -> str: ...
standalone_tests: Any
standalone_tests: collections.defaultdict[str, list]
def standalone(*tags: Any): ...
def standalone(*tags: str) -> Callable[[_CallableT], _CallableT]: ...
DB: Any
DB: str
def new_test_user(env: Any, login: str = ..., groups: str = ..., context: Optional[Any] = ..., **kwargs: Any): ...
def new_test_user(env: Environment, login: str = ..., groups: str = ..., context: dict | None = ..., **kwargs) -> 'odoo.model.res_users': ...
class OdooSuite(unittest.suite.TestSuite):
def _handleClassSetUp(self, test: Any, result: Any) -> None: ...
def _createClassOrModuleLevelException(self, result: Any, exc: Any, method_name: Any, parent: Any, info: Optional[Any] = ...) -> None: ...
def _addClassOrModuleLevelException(self, result: Any, exception: Any, errorName: Any, info: Optional[Any] = ...) -> None: ...
def _tearDownPreviousClass(self, test: Any, result: Any) -> None: ...
def _handleClassSetUp(self, test, result) -> None: ...
def _createClassOrModuleLevelException(self, result, exc, method_name, parent, info: Any | None = ...) -> None: ...
def _addClassOrModuleLevelException(self, result, exception, errorName, info: Any | None = ...) -> None: ...
def _tearDownPreviousClass(self, test, result) -> None: ...
class TreeCase(unittest.TestCase):
_class_cleanups: Any = ...
_class_cleanups: list
@classmethod
def addClassCleanup(cls, function: Any, *args: Any, **kwargs: Any) -> None: ...
def addClassCleanup(cls, function, *args, **kwargs) -> None: ...
@classmethod
def doClassCleanups(cls) -> None: ...
def __init__(self, methodName: str = ...) -> None: ...
def assertTreesEqual(self, n1: Any, n2: Any, msg: Optional[Any] = ...) -> None: ...
def assertTreesEqual(self, n1, n2, msg: Any | None = ...) -> None: ...
class MetaCase(type):
def __init__(cls, name: Any, bases: Any, attrs: Any) -> None: ...
def __init__(cls, name, bases, attrs) -> None: ...
class BaseCase(TreeCase):
longMessage: bool = ...
warm: bool = ...
registry: Registry = ...
cr: Cursor = ...
env: Environment = ...
def cursor(self): ...
_class_cleanups: list
tearDown_exceptions: list
registry: Registry
env: Environment
cr: Cursor
@classmethod
def addClassCleanup(cls, function, *args, **kwargs) -> None: ...
@classmethod
def doClassCleanups(cls) -> None: ...
longMessage: bool
warm: bool
def cursor(self) -> Cursor: ...
@property
def uid(self): ...
def uid(self) -> int: ...
@uid.setter
def uid(self, user: Any) -> None: ...
def ref(self, xid: Any): ...
def browse_ref(self, xid: Any): ...
def with_user(self, login: Any) -> None: ...
def _assertRaises(self, exception: Any, *, msg: Optional[Any] = ...) -> None: ...
def assertRaises(self, exception: Any, func: Optional[Any] = ..., *args: Any, **kwargs: Any): ...
def assertQueries(self, expected: Any, flush: bool = ...): ...
def assertQueryCount(self, default: int = ..., flush: bool = ..., **counters: Any): ...
def assertRecordValues(self, records: Any, expected_values: Any): ...
def uid(self, user) -> None: ...
def ref(self, xid: str) -> int: ...
def browse_ref(self, xid: str) -> BaseModel | None: ...
def with_user(self, login: str) -> 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 assertQueries(self, expected, flush: bool = ...) -> Generator[list, 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 shortDescription(self) -> None: ...
def assertItemsEqual(self, a: Any, b: Any, msg: Optional[Any] = ...) -> None: ...
def assertItemsEqual(self, a, b, msg: str | None = ...) -> None: ...
class TransactionCase(BaseCase):
registry: Registry
env: Environment
cr: Cursor
def setUp(self): ...
def patch(self, obj: Any, key: Any, val: Any) -> None: ...
def patch_order(self, model: Any, order: Any) -> None: ...
def patch(self, obj, key, val) -> None: ...
def patch_order(self, model, order) -> None: ...
class SingleTransactionCase(BaseCase):
@classmethod
def setUpClass(cls) -> None: ...
def setUp(self) -> None: ...
savepoint_seq: Any
savepoint_seq: count[int]
class SavepointCase(SingleTransactionCase):
_savepoint_id: Any = ...
class SavepointCase(TransactionCase):
_savepoint_id: int
def setUp(self) -> None: ...
class ChromeBrowserException(Exception): ...
class ChromeBrowser:
_logger: Any = ...
test_class: Any = ...
devtools_port: Any = ...
ws_url: str = ...
ws: Any = ...
request_id: int = ...
user_data_dir: Any = ...
chrome_pid: Any = ...
screenshots_dir: Any = ...
screencasts_dir: Any = ...
screencast_frames: Any = ...
window_size: Any = ...
sigxcpu_handler: Any = ...
def __init__(self, logger: Any, window_size: Any, test_class: Any) -> None: ...
def signal_handler(self, sig: Any, frame: Any) -> None: ...
test_class: str
devtools_port: int | None
ws_url: str
ws: WebSocket | None
request_id: int
user_data_dir: str
chrome_pid: int | None
screenshots_dir: str
screencasts_dir: str | None
screencast_frames: list
window_size: str
sigxcpu_handler: Any
def __init__(self, logger: logging.Logger, window_size: str, test_class: str) -> None: ...
def signal_handler(self, sig, frame) -> None: ...
def stop(self) -> None: ...
@property
def executable(self): ...
def _spawn_chrome(self, cmd: Any): ...
def executable(self) -> str | None: ...
def _spawn_chrome(self, cmd: list[str]) -> int | None: ...
def _chrome_start(self) -> None: ...
def _find_websocket(self) -> None: ...
def _json_command(self, command: Any, timeout: int = ..., get_key: Optional[Any] = ...): ...
def _json_command(self, command: str, timeout: int = ..., get_key: Any | None = ...): ...
def _open_websocket(self) -> None: ...
def _websocket_send(self, method: Any, params: Optional[Any] = ...): ...
def _get_message(self, raise_log_error: bool = ...): ...
_TO_LEVEL: Any = ...
def _websocket_wait_id(self, awaited_id: Any, timeout: int = ...): ...
def _websocket_wait_event(self, method: Any, params: Optional[Any] = ..., timeout: int = ...): ...
def take_screenshot(self, prefix: str = ..., suffix: Optional[Any] = ...) -> None: ...
def _websocket_send(self, method: str, params: Any | None = ...) -> int | None: ...
def _get_message(self, raise_log_error: bool = ...) -> dict: ...
_TO_LEVEL: dict[str, int]
def _websocket_wait_id(self, awaited_id: int, timeout: int = ...) -> dict: ...
def _websocket_wait_event(self, method: str, params: dict | None = ..., timeout: int = ...) -> dict | None: ...
def take_screenshot(self, prefix: str = ..., suffix: str | None = ...) -> None: ...
def _save_screencast(self, prefix: str = ...) -> None: ...
screencasts_frames_dir: Any = ...
screencasts_frames_dir: str
def start_screencast(self) -> None: ...
def set_cookie(self, name: Any, value: Any, path: Any, domain: Any): ...
def delete_cookie(self, name: Any, **kwargs: Any): ...
def _wait_ready(self, ready_code: Any, timeout: int = ...): ...
def _wait_code_ok(self, code: Any, timeout: Any): ...
def navigate_to(self, url: Any, wait_stop: bool = ...) -> None: ...
def set_cookie(self, name: str, value, path, domain) -> dict: ...
def delete_cookie(self, name: str, **kwargs) -> dict: ...
def _wait_ready(self, ready_code, timeout: int = ...) -> bool: ...
def _wait_code_ok(self, code, timeout: float) -> Literal[True] | None: ...
def navigate_to(self, url: str, wait_stop: bool = ...) -> None: ...
def clear(self) -> None: ...
def _from_remoteobject(self, arg: Any): ...
LINE_PATTERN: str = ...
def _format_stack(self, logrecord: Any) -> None: ...
def console_formatter(self, args: Any): ...
def _from_remoteobject(self, arg: Mapping): ...
LINE_PATTERN: str
def _format_stack(self, logrecord: Mapping) -> None: ...
def console_formatter(self, args: list) -> Callable[[Match[str]], str]: ...
class HttpCaseCommon(BaseCase):
registry_test_mode: bool = ...
browser: ChromeBrowser = ...
browser_size: str = ...
xmlrpc_url: str = ...
xmlrpc_common: ServerProxy = ...
xmlrpc_db: ServerProxy = ...
xmlrpc_object: ServerProxy = ...
registry_test_mode: bool
browser: ChromeBrowser | None
browser_size: str
_logger: logging.Logger
xmlrpc_url: str
xmlrpc_common: xmlrpclib.ServerProxy
xmlrpc_db: xmlrpclib.ServerProxy
xmlrpc_object: xmlrpclib.ServerProxy
def __init__(self, methodName: str = ...) -> None: ...
opener: requests.Session = ...
opener: requests.Session
def setUp(self) -> None: ...
@classmethod
def start_browser(cls) -> None: ...
@classmethod
def terminate_browser(cls) -> None: ...
def url_open(self, url: Any, data: Optional[Any] = ..., files: Optional[Any] = ..., timeout: int = ..., headers: Optional[Any] = ..., allow_redirects: bool = ...): ...
def _wait_remaining_requests(self, timeout: int = ...): ...
def url_open(self, url: str, data: Any | None = ..., files: Mapping | None = ..., timeout: int = ...,
headers: Mapping | None = ..., allow_redirects: bool = ...) -> requests.Response: ...
def _wait_remaining_requests(self, timeout: int = ...) -> None: ...
def logout(self, keep_db: bool = ...) -> None: ...
session: OpenERPSession = ...
def authenticate(self, user: Any, password: Any): ...
def browser_js(self, url_path: Any, code: Any, ready: str = ..., login: Optional[Any] = ..., timeout: int = ..., **kw: Any) -> None: ...
def start_tour(self, url_path: Any, tour_name: Any, step_delay: Optional[Any] = ..., **kwargs: Any): ...
session: OpenERPSession
def authenticate(self, user, password) -> OpenERPSession: ...
def browser_js(self, url_path: str, code: str, ready: str = ..., login: str | None = ..., timeout: int = ..., **kw) -> None: ...
def start_tour(self, url_path: str, tour_name: str, step_delay: float | None = ..., **kwargs) -> None: ...
class HttpCase(HttpCaseCommon, TransactionCase): ...
class HttpSavepointCase(HttpCaseCommon, SavepointCase): ...
def users(*logins: Any): ...
def warmup(func: Any, *args: Any, **kwargs: Any) -> None: ...
def can_import(module: Any): ...
def users(*logins: str) -> Callable[[_CallableT], _CallableT]: ...
def warmup(func: _CallableT, *args, **kwargs) -> _CallableT: ...
def can_import(module: str) -> bool: ...
ref_re: Any
ref_re: Pattern
class Form:
def __init__(self, recordp: Any, view: Optional[Any] = ...) -> None: ...
def _o2m_set_edition_view(self, descr: Any, node: Any, level: Any) -> None: ...
def __str__(self): ...
def _process_fvg(self, model: Any, fvg: Any, level: int = ...) -> None: ...
def _init_from_defaults(self, model: Any) -> None: ...
def _init_from_values(self, values: Any) -> None: ...
def __getattr__(self, field: Any): ...
def _get_modifier(self, field: Any, modifier: Any, default: bool = ..., modmap: Optional[Any] = ..., vals: Optional[Any] = ...): ...
_OPS: Any = ...
def _get_context(self, field: Any): ...
def __setattr__(self, field: Any, value: Any) -> None: ...
def __enter__(self) -> Form: ...
def __exit__(self, etype: Any, _evalue: Any, _etb: Any) -> None: ...
def save(self): ...
def _values_to_save(self, all_fields: bool = ...): ...
def _values_to_save_(self, record_values: Any, fields: Any, view: Any, changed: Any, all_fields: bool = ..., modifiers_values: Optional[Any] = ..., parent_link: Optional[Any] = ...): ...
def _perform_onchange(self, fields: Any) -> None: ...
def _onchange_values(self): ...
def _onchange_values_(self, fields: Any, record: Any): ...
def _cleanup_onchange(self, descr: Any, value: Any, current: Any): ...
class Form(Generic[_ModelT]):
_env: Environment
_model: _ModelT
_view: dict
_values: dict
_changed: set
def __init__(self, recordp: _ModelT, view: _ModelT | str | None = ...) -> None: ...
def _o2m_set_edition_view(self, descr: dict, node: _Element, level: int) -> None: ...
def __str__(self) -> str: ...
def _process_fvg(self, model: BaseModel, fvg: dict, level: int = ...) -> None: ...
def _init_from_defaults(self, model: BaseModel) -> None: ...
def _init_from_values(self, values: BaseModel) -> None: ...
def __getattr__(self, field: str): ...
def _get_modifier(self, field: str, modifier: str, *, default: Any = ..., view: Any = ..., modmap: Any | None = ...,
vals: Any | None = ...): ...
_OPS: dict[str, Callable[..., bool]]
def _get_context(self, field: str): ...
def __setattr__(self, field: str, value) -> None: ...
def __enter__(self: _FormT) -> _FormT: ...
def __exit__(self, etype, _evalue, _etb) -> None: ...
def save(self) -> _ModelT: ...
def _values_to_save(self, all_fields: bool = ...) -> dict: ...
def _values_to_save_(self, record_values: dict, fields: dict, view: Any, changed: set, all_fields: bool = ...,
modifiers_values: dict | None = ..., parent_link: Any | None = ...) -> dict: ...
def _perform_onchange(self, fields: list[str]) -> dict: ...
def _onchange_values(self) -> dict: ...
def _onchange_values_(self, fields, record: dict) -> dict: ...
def _cleanup_onchange(self, descr: dict, value, current): ...
class O2MForm(Form):
def __init__(self, proxy: Any, index: Optional[Any] = ...) -> None: ...
def _get_modifier(self, field: Any, modifier: Any, default: bool = ..., modmap: Optional[Any] = ..., vals: Optional[Any] = ...): ...
def _onchange_values(self): ...
_proxy: O2MProxy
_index: int | None
def __init__(self, proxy: O2MProxy, index: int | None = ...) -> None: ...
def _get_modifier(self, field: str, modifier: str, *, default: Any = ..., view: Any = ..., modmap: Any | None = ...,
vals: Any | None = ...): ...
def _onchange_values(self) -> dict: ...
def save(self) -> None: ...
def _values_to_save(self, all_fields: bool = ...): ...
def _values_to_save(self, all_fields: bool = ...) -> UpdateDict: ...
class UpdateDict(dict):
_changed: Any = ...
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def changed_items(self): ...
def update(self, *args: Any, **kw: Any) -> None: ...
_changed: set
def __init__(self, *args, **kwargs) -> None: ...
def changed_items(self) -> Iterator[tuple[Any, Any]]: ...
def update(self, *args, **kw) -> None: ...
class X2MProxy:
_parent: Any = ...
_field: Any = ...
_parent: Form
_field: str
def _assert_editable(self) -> None: ...
class O2MProxy(X2MProxy):
_parent: Any = ...
_field: Any = ...
_records: Any = ...
def __init__(self, parent: Any, field: Any) -> None: ...
def __len__(self): ...
_records: list[dict]
def __init__(self, parent: Form, field: str) -> None: ...
def __len__(self) -> int: ...
@property
def _model(self): ...
def _model(self) -> BaseModel: ...
@property
def _descr(self): ...
def _command_index(self, for_record: Any): ...
def new(self): ...
def edit(self, index: Any): ...
def remove(self, index: Any) -> None: ...
def _descr(self) -> dict: ...
def _command_index(self, for_record: int) -> int: ...
def new(self) -> O2MForm: ...
def edit(self, index: int): ...
def remove(self, index: int) -> None: ...
class M2MProxy(X2MProxy, collections.Sequence):
_parent: Any = ...
_field: Any = ...
def __init__(self, parent: Any, field: Any) -> None: ...
def __getitem__(self, it: Any): ...
def __len__(self): ...
def __iter__(self) -> Any: ...
def __contains__(self, record: Any): ...
def add(self, record: Any) -> None: ...
def _get_ids(self): ...
def remove(self, id: Optional[Any] = ..., index: Optional[Any] = ...) -> None: ...
def __init__(self, parent: Form, field: str) -> None: ...
def __getitem__(self, it) -> BaseModel: ...
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[BaseModel]: ...
def __contains__(self, record: BaseModel) -> bool: ...
def add(self, record: BaseModel) -> None: ...
def _get_ids(self) -> list[int]: ...
def remove(self, id: int | None = ..., index: int | None = ...) -> None: ...
def clear(self) -> None: ...
def record_to_values(fields: Any, record: Any): ...
def _cleanup_from_default(type_: Any, value: Any): ...
def _get_node(view: Any, f: Any, *arg: Any): ...
def tagged(*tags: Any): ...
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: Any = ...
exclude: Any = ...
include: Any = ...
def __init__(self, spec: Any) -> None: ...
def check(self, test: Any): ...
filter_spec_re: Pattern
exclude: set
include: set
def __init__(self, spec: str) -> None: ...
def check(self, test) -> bool: ...

View File

@@ -1,9 +1,10 @@
from typing import Any
from typing import Iterator
_logger: Any
from .runner import OdooTestResult
from ..tests import OdooSuite
def get_test_modules(module: Any): ...
def _get_tests_modules(path: Any, module: Any): ...
def make_suite(module_name: Any, position: str = ...): ...
def run_suite(suite: Any, module_name: Any): ...
def unwrap_suite(test: Any) -> None: ...
def get_test_modules(module: str) -> list: ...
def _get_tests_modules(path: str, module: str) -> list: ...
def make_suite(module_name: str, position: str = ...) -> OdooSuite: ...
def run_suite(suite: OdooSuite, module_name: str) -> OdooTestResult: ...
def unwrap_suite(test) -> Iterator: ...

View File

@@ -1,22 +1,21 @@
import unittest
from typing import Any, Optional
_logger: Any
from typing import Any
class OdooTestResult(unittest.result.TestResult):
time_start: Any = ...
queries_start: Any = ...
time_start: float | None
queries_start: int | None
def __init__(self) -> None: ...
def __str__(self): ...
shouldStop: Any = ...
def update(self, other: Any) -> None: ...
def log(self, level: Any, msg: Any, *args: Any, test: Optional[Any] = ..., exc_info: Optional[Any] = ..., extra: Optional[Any] = ..., stack_info: bool = ..., caller_infos: Optional[Any] = ...) -> None: ...
def getDescription(self, test: Any): ...
def startTest(self, test: Any) -> None: ...
def addError(self, test: Any, err: Any) -> None: ...
def addFailure(self, test: Any, err: Any) -> None: ...
def addSubTest(self, test: Any, subtest: Any, err: Any) -> None: ...
def addSkip(self, test: Any, reason: Any) -> None: ...
def addUnexpectedSuccess(self, test: Any) -> None: ...
def logError(self, flavour: Any, test: Any, error: Any) -> None: ...
def getErrorCallerInfo(self, error: Any, test: Any): ...
def __str__(self) -> str: ...
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 getDescription(self, test): ...
def startTest(self, test) -> 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): ...

View File

@@ -1,13 +1,12 @@
from typing import Any
from argparse import Namespace
_logger: Any
BLACKLIST: Any
IGNORE: Any
BLACKLIST: set[str]
IGNORE: tuple[str, ...]
def install(db_name: Any, module_id: Any, module_name: Any) -> None: ...
def uninstall(db_name: Any, module_id: Any, module_name: Any) -> None: ...
def cycle(db_name: Any, module_id: Any, module_name: Any) -> None: ...
def parse_args(): ...
def test_full(args: Any): ...
def test_uninstall(args: Any) -> None: ...
def test_scripts(args: Any) -> None: ...
def install(db_name: str, module_id: int, module_name: str) -> None: ...
def uninstall(db_name: str, module_id: int, module_name: str) -> None: ...
def cycle(db_name: str, module_id: int, module_name: str) -> None: ...
def parse_args() -> Namespace: ...
def test_full(args: Namespace) -> None: ...
def test_uninstall(args: Namespace) -> None: ...
def test_scripts(args: Namespace) -> None: ...