Update stubs

This commit is contained in:
Trinh Anh Ngoc
2025-03-26 11:25:08 +07:00
parent 65b60bc3bd
commit 6255b4de08
16 changed files with 43 additions and 17 deletions

View File

@@ -61,6 +61,8 @@ def returns(
def downgrade(method: Callable, value, self, args, kwargs): ... def downgrade(method: Callable, value, self, args, kwargs): ...
def autovacuum(method: _CallableT) -> _CallableT: ... def autovacuum(method: _CallableT) -> _CallableT: ...
def model(method: _CallableT) -> _CallableT: ... def model(method: _CallableT) -> _CallableT: ...
def readonly(method: _CallableT) -> _CallableT: ...
def private(method: _CallableT) -> _CallableT: ...
def model_create_single(method: _CallableT) -> _CallableT: ... def model_create_single(method: _CallableT) -> _CallableT: ...
def model_create_multi(method: _CallableT) -> _CallableT: ... def model_create_multi(method: _CallableT) -> _CallableT: ...
def call_kw(model: BaseModel, name: str, args, kwargs): ... def call_kw(model: BaseModel, name: str, args, kwargs): ...

View File

@@ -269,10 +269,10 @@ class Html(_String):
class Date(Field[datetime.date]): class Date(Field[datetime.date]):
type: str type: str
start_of = date_utils.start_of start_of = staticmethod(date_utils.start_of)
end_of = date_utils.end_of end_of = staticmethod(date_utils.end_of)
add = date_utils.add add = staticmethod(date_utils.add)
subtract = date_utils.subtract subtract = staticmethod(date_utils.subtract)
@staticmethod @staticmethod
def today(*args) -> datetime.date: ... def today(*args) -> datetime.date: ...
@staticmethod @staticmethod
@@ -293,10 +293,10 @@ class Date(Field[datetime.date]):
class Datetime(Field[datetime.datetime]): class Datetime(Field[datetime.datetime]):
type: str type: str
start_of = date_utils.start_of start_of = staticmethod(date_utils.start_of)
end_of = date_utils.end_of end_of = staticmethod(date_utils.end_of)
add = date_utils.add add = staticmethod(date_utils.add)
subtract = date_utils.subtract subtract = staticmethod(date_utils.subtract)
@staticmethod @staticmethod
def now(*args) -> datetime.datetime: ... def now(*args) -> datetime.datetime: ...
@staticmethod @staticmethod

View File

@@ -6,14 +6,15 @@ from typing import Any, Callable, Generator, Iterable, Literal, Mapping, TypeVar
import geoip2.database import geoip2.database
import geoip2.models import geoip2.models
import werkzeug import werkzeug
from odoo.addons.base.models.res_lang import Lang
from odoo.addons.website.models.website import Website
from werkzeug.datastructures import Headers from werkzeug.datastructures import Headers
from werkzeug.exceptions import NotFound from werkzeug.exceptions import NotFound
from werkzeug.middleware.proxy_fix import ProxyFix as ProxyFix_ from werkzeug.middleware.proxy_fix import ProxyFix as ProxyFix_
from werkzeug.routing import Map, Rule from werkzeug.routing import Map, Rule
from werkzeug.urls import URL from werkzeug.urls import URL
from odoo.addons.base.models.res_lang import Lang
from odoo.addons.website.models.website import Website
from .api import Environment from .api import Environment
from .models import BaseModel from .models import BaseModel
from .modules.registry import Registry from .modules.registry import Registry

View File

@@ -15,6 +15,7 @@ from typing import (
import dateutil.relativedelta import dateutil.relativedelta
import psycopg2 import psycopg2
from odoo.addons.base.models.res_company import Company from odoo.addons.base.models.res_company import Company
from odoo.addons.base.models.res_users import Users from odoo.addons.base.models.res_users import Users

View File

@@ -35,7 +35,7 @@ def get_modules() -> list[str]: ...
def get_modules_with_version() -> dict[str, Any]: ... def get_modules_with_version() -> dict[str, Any]: ...
def adapt_version(version: str) -> str: ... def adapt_version(version: str) -> str: ...
current_test: Any current_test: bool
def check_python_external_dependency(pydep) -> None: ... def check_python_external_dependency(pydep) -> None: ...
def check_manifest_dependencies(manifest) -> None: ... def check_manifest_dependencies(manifest) -> None: ...

View File

@@ -1,6 +1,7 @@
from typing import Any, Callable, TypeVar from typing import Any, Callable, TypeVar
from ..api import Environment from ..api import Environment
from ..models import BaseModel
from ..sql_db import Cursor from ..sql_db import Cursor
_CallableT = TypeVar("_CallableT", bound=Callable) _CallableT = TypeVar("_CallableT", bound=Callable)
@@ -9,6 +10,7 @@ PG_CONCURRENCY_ERRORS_TO_RETRY: tuple[str, str, str]
PG_CONCURRENCY_EXCEPTIONS_TO_RETRY: tuple[Exception, ...] PG_CONCURRENCY_EXCEPTIONS_TO_RETRY: tuple[Exception, ...]
MAX_TRIES_ON_CONCURRENCY_FAILURE: int MAX_TRIES_ON_CONCURRENCY_FAILURE: int
def get_public_method(model: BaseModel, name: str): ...
def dispatch(method: str, params): ... def dispatch(method: str, params): ...
def execute_cr(cr: Cursor, uid: int, obj: str, method: str, *args, **kw): ... def execute_cr(cr: Cursor, uid: int, obj: str, method: str, *args, **kw): ...
def execute_kw( def execute_kw(

View File

@@ -14,3 +14,6 @@ class TestCase(_TestCase):
def doCleanups(self) -> None: ... def doCleanups(self) -> None: ...
@classmethod @classmethod
def doClassCleanups(cls) -> None: ... def doClassCleanups(cls) -> None: ...
@property
def canonical_tag(self) -> str: ...
def get_log_metadata(self) -> dict: ...

View File

@@ -8,11 +8,12 @@ from xmlrpc import client as xmlrpclib
import requests import requests
from freezegun.api import _freeze_time from freezegun.api import _freeze_time
from odoo.addons.base.models.res_currency import Currency
from odoo.addons.base.models.res_users import Users
from urllib3.util import Url from urllib3.util import Url
from websocket import WebSocket from websocket import WebSocket
from odoo.addons.base.models.res_currency import Currency
from odoo.addons.base.models.res_users import Users
from ..api import Environment from ..api import Environment
from ..http import Session from ..http import Session
from ..models import BaseModel from ..models import BaseModel
@@ -262,6 +263,7 @@ class HttpCase(TransactionCase):
watch: bool = ..., watch: bool = ...,
success_signal: str = ..., success_signal: str = ...,
debug: bool = ..., debug: bool = ...,
cpu_throttling: int | None = ...,
**kw **kw
) -> None: ... ) -> None: ...
def start_tour( def start_tour(

View File

@@ -6,4 +6,6 @@ from .suite import OdooSuite
def get_module_test_cases(module) -> Iterator: ... def get_module_test_cases(module) -> Iterator: ...
def get_test_modules(module: str) -> list: ... def get_test_modules(module: str) -> list: ...
def make_suite(module_names: list[str], position: str = ...) -> OdooSuite: ... def make_suite(module_names: list[str], position: str = ...) -> OdooSuite: ...
def run_suite(suite: OdooSuite) -> OdooTestResult: ... def run_suite(
suite: OdooSuite, global_report: OdooTestResult | None = ...
) -> OdooTestResult: ...

View File

@@ -4,6 +4,7 @@ from typing import Any, NamedTuple
STDOUT_LINE: str STDOUT_LINE: str
STDERR_LINE: str STDERR_LINE: str
ODOO_TEST_MAX_FAILED_TESTS: int
stats_logger: Logger stats_logger: Logger
class Stat(NamedTuple): class Stat(NamedTuple):
@@ -21,12 +22,16 @@ class OdooTestResult:
queries_start: int | None queries_start: int | None
had_failure: bool had_failure: bool
stats: dict[str, Stat] stats: dict[str, Stat]
global_report: OdooTestResult | None
shouldStop: bool
def __init__( def __init__(
self, self,
stream: Any | None = ..., stream: Any | None = ...,
descriptions: Any | None = ..., descriptions: Any | None = ...,
verbosity: Any | None = ..., verbosity: Any | None = ...,
global_report: OdooTestResult | None = ...,
) -> None: ... ) -> None: ...
def total_errors_count(self) -> int: ...
def printErrors(self) -> None: ... def printErrors(self) -> None: ...
def startTest(self, test) -> None: ... def startTest(self, test) -> None: ...
def stopTest(self, test) -> None: ... def stopTest(self, test) -> None: ...

View File

@@ -1,8 +1,11 @@
from re import Pattern from re import Pattern
from ..tools import OrderedSet
class TagsSelector: class TagsSelector:
filter_spec_re: Pattern filter_spec_re: Pattern
exclude: set exclude: set
include: set include: set
parameters: OrderedSet
def __init__(self, spec: str) -> None: ... def __init__(self, spec: str) -> None: ...
def check(self, test) -> bool: ... def check(self, test) -> bool: ...

View File

@@ -67,6 +67,7 @@ def email_split_and_format(text: str) -> list[str]: ...
def email_split_and_format_normalize(text: str) -> list[str]: ... def email_split_and_format_normalize(text: str) -> list[str]: ...
def email_normalize(text: str, strict: bool = ...) -> str | Literal[False]: ... def email_normalize(text: str, strict: bool = ...) -> str | Literal[False]: ...
def email_normalize_all(text: str) -> list[str]: ... def email_normalize_all(text: str) -> list[str]: ...
def email_anonymize(normalized_email: str, *, redact_domain: bool = ...) -> str: ...
def email_domain_extract(email: str) -> str | Literal[False]: ... def email_domain_extract(email: str) -> str | Literal[False]: ...
def email_domain_normalize(domain: str) -> str | Literal[False]: ... def email_domain_normalize(domain: str) -> str | Literal[False]: ...
def url_domain_extract(url: str) -> str | Literal[False]: ... def url_domain_extract(url: str) -> str | Literal[False]: ...

View File

@@ -23,9 +23,10 @@ import markupsafe
import xlsxwriter import xlsxwriter
import xlwt import xlwt
from babel.core import Locale from babel.core import Locale
from xlwt import Worksheet
from odoo.addons.base.models.res_currency import Currency from odoo.addons.base.models.res_currency import Currency
from odoo.addons.base.models.res_lang import LangData from odoo.addons.base.models.res_lang import LangData
from xlwt import Worksheet
from ..api import Environment from ..api import Environment
from ..loglevels import exception_to_unicode as exception_to_unicode from ..loglevels import exception_to_unicode as exception_to_unicode

View File

@@ -2,9 +2,10 @@ from io import BytesIO
from re import Pattern from re import Pattern
from typing import Any, BinaryIO, Iterable from typing import Any, BinaryIO, Iterable
from odoo.addons.base.models.ir_attachment import IrAttachment
from PyPDF2 import PdfFileReader, PdfFileWriter from PyPDF2 import PdfFileReader, PdfFileWriter
from odoo.addons.base.models.ir_attachment import IrAttachment
DEFAULT_PDF_DATETIME_FORMAT: str DEFAULT_PDF_DATETIME_FORMAT: str
REGEX_SUBTYPE_UNFORMATED: Pattern REGEX_SUBTYPE_UNFORMATED: Pattern
REGEX_SUBTYPE_FORMATED: Pattern REGEX_SUBTYPE_FORMATED: Pattern

View File

@@ -11,7 +11,8 @@ class Query:
def __init__( def __init__(
self, env: Environment, alias: str, table: SQL | None = ... self, env: Environment, alias: str, table: SQL | None = ...
) -> None: ... ) -> None: ...
def make_alias(self, alias: str, link: str) -> str: ... @staticmethod
def make_alias(alias: str, link: str) -> str: ...
def add_table(self, alias: str, table: SQL | None = ...) -> None: ... def add_table(self, alias: str, table: SQL | None = ...) -> None: ...
def add_join( def add_join(
self, kind: str, alias: str, table: str | SQL | None, condition: SQL self, kind: str, alias: str, table: str | SQL | None, condition: SQL

View File

@@ -2,6 +2,7 @@ from typing import Callable, Iterable, Literal
from lxml import etree from lxml import etree
from lxml.etree import _Element from lxml.etree import _Element
from odoo.addons.base.models.ir_attachment import IrAttachment from odoo.addons.base.models.ir_attachment import IrAttachment
from ..api import Environment from ..api import Environment