Update stubs

This commit is contained in:
Trinh Anh Ngoc
2024-03-17 21:32:52 +07:00
parent c1be38892a
commit 5a1a35bdaa
10 changed files with 38 additions and 17 deletions

View File

@@ -97,6 +97,7 @@ class Field(Generic[_FieldValueT], metaclass=MetaField):
self, env: Environment, attributes: Container[str] | None = ...
) -> dict[str, Any]: ...
def is_editable(self) -> bool: ...
def is_accessible(self, env: Environment) -> bool: ...
def convert_to_column(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
): ...

View File

@@ -179,7 +179,6 @@ class BaseModel(metaclass=MetaModel):
) -> None: ...
def default_get(self, fields_list: list[str]) -> dict[str, Any]: ...
def _rec_name_fallback(self) -> str: ...
def user_has_groups(self, groups: str) -> bool: ...
def search_count(self, domain: list, limit: int | None = ...) -> int: ...
def search(
self: _ModelT,

View File

@@ -31,6 +31,7 @@ ADMIN_USER_ID: int
CHECK_BROWSER_SLEEP: float
CHECK_BROWSER_ITERATIONS: int
BROWSER_WAIT: float
DEFAULT_SUCCESS_SIGNAL: str
def get_db_name() -> str: ...
@@ -141,7 +142,7 @@ def save_test_file(
class ChromeBrowser:
remote_debugging_port: int
test_case: HttpCase
success_signal: Callable[[str], bool]
success_signal: str
chrome: Popen
devtools_port: int | None
ws: WebSocket | None
@@ -154,7 +155,7 @@ class ChromeBrowser:
def __init__(
self,
test_case: HttpCase,
success_signal: Callable[[str], bool],
success_signal: str,
headless: bool = ...,
debug: bool = ...,
) -> None: ...
@@ -166,6 +167,7 @@ class ChromeBrowser:
def executable(self) -> str | None: ...
def take_screenshot(self, prefix: str = ...) -> Future: ...
def start_screencast(self) -> None: ...
def stop_screencast(self) -> None: ...
def set_cookie(self, name: str, value, path, domain) -> None: ...
def delete_cookie(self, name: str, **kwargs) -> None: ...
def navigate_to(self, url: str, wait_stop: bool = ...) -> None: ...
@@ -222,7 +224,7 @@ class HttpCase(TransactionCase):
cookies: Any | None = ...,
error_checker: Any | None = ...,
watch: bool = ...,
success_signal: Callable[[str], bool] | None = ...,
success_signal: str = ...,
debug: bool = ...,
**kw
) -> None: ...

View File

@@ -3,7 +3,7 @@ from typing import Iterator
from .result import OdooTestResult
from .suite import OdooSuite
def get_module_test_cases(module) -> Iterator: ...
def get_test_modules(module: str) -> list: ...
def make_suite(module_names: list[str], position: str = ...) -> OdooSuite: ...
def run_suite(suite: OdooSuite, module_name: str | None = ...) -> OdooTestResult: ...
def unwrap_suite(test) -> Iterator: ...
def run_suite(suite: OdooSuite) -> OdooTestResult: ...

View File

@@ -9,6 +9,7 @@ from .convert import *
from .date_utils import *
from .float_utils import *
from .func import *
from .i18n import *
from .image import *
from .js_transpiler import ODOO_MODULE_RE as ODOO_MODULE_RE
from .js_transpiler import URL_RE as URL_RE

View File

@@ -12,6 +12,8 @@ class ormcache_counter:
hit: int
miss: int
err: int
gen_time: int
cache_name: Any
def __init__(self) -> None: ...
@property
def ratio(self) -> float: ...

18
odoo-stubs/tools/i18n.pyi Normal file
View File

@@ -0,0 +1,18 @@
from typing import Literal, Sequence
from ..api import Environment
def format_list(
env: Environment,
lst: Sequence[str],
style: Literal[
"standard",
"standard-short",
"or",
"or-short",
"unit",
"unit-short",
"unit-narrow",
] = ...,
lang_code: str | None = ...,
) -> str: ...

View File

@@ -23,6 +23,7 @@ def html_sanitize(
strip_classes: bool = ...,
) -> Markup: ...
URL_SKIP_PROTOCOL_REGEX: str
URL_REGEX: str
TEXT_URL_REGEX: str
HTML_TAG_URL_REGEX: str

View File

@@ -1,10 +1,9 @@
import datetime
import pickle as pickle_
from collections.abc import Mapping, MutableMapping, MutableSet
from contextlib import ContextDecorator, suppress
from logging import Handler, LogRecord
from re import Pattern
from types import FrameType, ModuleType
from types import FrameType
from typing import (
IO,
Any,
@@ -23,7 +22,7 @@ import xlsxwriter
import xlwt
from babel.core import Locale
from odoo.addons.base.models.res_currency import Currency
from odoo.addons.base.models.res_lang import Lang
from odoo.addons.base.models.res_lang import LangData
from xlwt import Worksheet
from ..api import Environment
@@ -224,16 +223,18 @@ class replace_exceptions(ContextDecorator):
html_escape = markupsafe.escape
def get_lang(env: Environment, lang_code: str = ...) -> Lang: ...
def get_lang(env: Environment, lang_code: str = ...) -> LangData: ...
def babel_locale_parse(lang_code: str) -> Locale: ...
def formatLang(
env: Environment,
value,
digits: int | None = ...,
digits: int = ...,
grouping: bool = ...,
monetary: bool = ...,
dp: bool = ...,
dp: str = ...,
currency_obj: Currency = ...,
rounding_method: str = ...,
rounding_unit: str = ...,
) -> str: ...
def format_date(
env: Environment,
@@ -266,11 +267,6 @@ def format_duration(value: float) -> str: ...
consteq: Callable[[str, str], bool]
class Unpickler(pickle_.Unpickler):
def find_class(self, module_name: str, name: str): ...
pickle: ModuleType
class ReadonlyDict(Mapping): ...
class DotDict(dict):

View File

@@ -34,6 +34,7 @@ class OdooPdfFileWriter(PdfFileWriter):
is_pdfa: bool
def __init__(self, *args, **kwargs):
None
def addAttachment(self, fname: str, fdata, subtype: str | None = ...) -> None: ...
def embed_odoo_attachment(
self, attachment: IrAttachment, subtype: str | None = ...