Update stubs

This commit is contained in:
Trinh Anh Ngoc
2024-07-20 15:43:56 +07:00
parent e5eb1dd8c1
commit d50374d880
18 changed files with 43 additions and 32 deletions

View File

@@ -21,7 +21,6 @@ from .tools.translate import _lt as _lt
MIN_PY_VERSION: tuple[int, ...]
evented: bool
multi_process: bool
iso8859_8: CodecInfo
iso8859_8ie_re: Pattern
SUPERUSER_ID: int

View File

@@ -119,6 +119,7 @@ class Environment(Mapping[str, BaseModel]):
def cache_key(self, field: Field): ...
def flush_query(self, query: SQL): ...
def execute_query(self, query: SQL) -> list[tuple]: ...
def execute_query_dict(self, query: SQL) -> list[dict]: ...
class Transaction:
registry: Registry

View File

@@ -286,6 +286,7 @@ class Date(Field[datetime.date]):
self, value, record: BaseModel, validate: bool = ...
) -> datetime.date | None: ...
def convert_to_export(self, value, record: BaseModel): ...
def convert_to_display_name(self, value, record: BaseModel) -> str: ...
class Datetime(Field[datetime.datetime]):
type: str

View File

@@ -88,6 +88,7 @@ class Stream:
self,
as_attachment: bool | None = ...,
immutable: bool | None = ...,
content_security_policy: str = ...,
**send_file_kwargs
) -> werkzeug.Response: ...
@@ -112,6 +113,9 @@ class FilesystemSessionStore(sessions.FilesystemSessionStore):
def get(self, sid: str) -> Session: ...
def rotate(self, session: Session, env: Environment) -> None: ...
def vacuum(self, max_lifetime=...) -> None: ...
def generate_key(self, salt: Any | None = ...): ...
def is_valid_key(self, key): ...
def delete_from_identifiers(self, identifiers) -> None: ...
class Session(MutableMapping):
can_save: bool
@@ -131,12 +135,11 @@ class Session(MutableMapping):
uid: int | None
pre_login: str | None
pre_uid: int
def authenticate(
self, dbname: str, login: str | None = ..., password: str | None = ...
) -> int: ...
def authenticate(self, dbname: str, credential: dict) -> int: ...
def finalize(self, env: Environment) -> None: ...
def logout(self, keep_db: bool = ...) -> None: ...
def touch(self) -> None: ...
def update_trace(self, request: Request) -> dict: ...
class GeoIP(Mapping):
ip: str

View File

@@ -395,7 +395,6 @@ class BaseModel(metaclass=MetaModel):
offset: int = ...,
limit: int | None = ...,
order: str | None = ...,
access_rights_uid: int | None = ...,
) -> Query: ...
def _as_query(self, ordered: bool = ...) -> Query: ...
def copy_data(

View File

@@ -3,8 +3,6 @@ from typing import Any, Literal
from odoo.addons.base.models.ir_module import Module
from ..tools import pycompat as pycompat
MANIFEST_NAMES: tuple[str, ...]
README: list[str]

View File

@@ -1,10 +1,12 @@
from typing import Literal
from ..api import Environment
from ..http import Session
from ..http import Request, Session
def check(db: str, uid: int, passwd: str) -> None: ...
def compute_session_token(
session: Session, env: Environment
) -> str | Literal[False]: ...
def check_session(session: Session, env: Environment) -> bool: ...
def check_session(
session: Session, env: Environment, request: Request | None = ...
) -> bool: ...

View File

@@ -90,7 +90,6 @@ class ThreadedServer(CommonServer):
def process_limit(self) -> None: ...
def cron_thread(self, number) -> None: ...
def cron_spawn(self) -> None: ...
def http_thread(self) -> None: ...
def http_spawn(self) -> None: ...
def start(self, stop: bool = ...): ...
def stop(self) -> None: ...

View File

@@ -39,6 +39,7 @@ def get_db_name() -> str: ...
standalone_tests: collections.defaultdict[str, list]
def standalone(*tags: str) -> Callable[[_CallableT], _CallableT]: ...
def test_xsd(url: str | None = ..., path: str | None = ..., skip: bool = ...): ...
DB: str

View File

@@ -52,6 +52,7 @@ class O2MValue(X2MValue):
def to_commands(self, convert_values=...) -> list: ...
class M2MValue(X2MValue):
def __init__(self, iterable_of_vals: Iterable = ...) -> None: ...
def to_commands(self) -> list: ...
class X2MProxy:

View File

@@ -1,27 +1,38 @@
from . import appdirs as appdirs
from . import cloc as cloc
from . import constants as constants
from . import osutil as osutil
from . import pdf as pdf
from . import pycompat as pycompat
from .barcode import *
from . import template_inheritance as template_inheritance
from .barcode import check_barcode_encoding as check_barcode_encoding
from .cache import ormcache as ormcache
from .cache import ormcache_context as ormcache_context
from .config import config as config
from .convert import *
from .convert import convert_csv_import as convert_csv_import
from .convert import convert_file as convert_file
from .convert import convert_sql_import as convert_sql_import
from .convert import convert_xml_import as convert_xml_import
from .date_utils import *
from .float_utils import *
from .func import *
from .i18n import *
from .image import *
from .i18n import format_list as format_list
from .image import image_process as image_process
from .js_transpiler import ODOO_MODULE_RE as ODOO_MODULE_RE
from .js_transpiler import URL_RE as URL_RE
from .js_transpiler import is_odoo_module as is_odoo_module
from .js_transpiler import transpile_javascript as transpile_javascript
from .mail import *
from .misc import *
from .parse_version import parse_version as parse_version
from .query import Query as Query
from .query import _generate_table_alias as _generate_table_alias
from .set_expression import SetDefinitions as SetDefinitions
from .sourcemap_generator import SourceMapGenerator as SourceMapGenerator
from .sql import *
from .template_inheritance import *
from .translate import *
from .xml_utils import *
from .translate import _ as _
from .translate import _lt as _lt
from .translate import html_translate as html_translate
from .translate import xml_translate as xml_translate
from .xml_utils import cleanup_xml_node as cleanup_xml_node
from .xml_utils import load_xsd_files_from_url as load_xsd_files_from_url
from .xml_utils import validate_xml_from_attachment as validate_xml_from_attachment

View File

@@ -1,5 +1,5 @@
import datetime
from typing import Iterator, Tuple, TypeVar
from typing import Iterator, Literal, Tuple, TypeVar
import babel
from dateutil.relativedelta import relativedelta
@@ -13,9 +13,14 @@ def get_quarter(date: _DateTimeT) -> Tuple[_DateTimeT, _DateTimeT]: ...
def get_fiscal_year(
date: _DateTimeT, day: int = ..., month: int = ...
) -> Tuple[_DateTimeT, _DateTimeT]: ...
def get_timedelta(qty: int, granularity: str) -> relativedelta: ...
def start_of(value: _DateTimeT, granularity: str) -> _DateTimeT: ...
def end_of(value: _DateTimeT, granularity: str) -> _DateTimeT: ...
def get_timedelta(
qty: int, granularity: Literal["hour", "day", "week", "month", "year"]
) -> relativedelta: ...
Granularity = Literal["year", "quarter", "month", "week", "day", "hour"]
def start_of(value: _DateTimeT, granularity: Granularity) -> _DateTimeT: ...
def end_of(value: _DateTimeT, granularity: Granularity) -> _DateTimeT: ...
def add(value: _DateTimeT, *args, **kwargs) -> _DateTimeT: ...
def subtract(value: _DateTimeT, *args, **kwargs) -> _DateTimeT: ...
def json_default(obj) -> str: ...

View File

@@ -1,5 +1,3 @@
from functools import wraps as wraps
from json import JSONEncoder as JSONEncoder
from typing import Callable, Generic, TypeVar
_T = TypeVar("_T")

View File

@@ -28,8 +28,6 @@ from xlwt import Worksheet
from ..api import Environment
from ..loglevels import exception_to_unicode as exception_to_unicode
from ..loglevels import get_encodings as get_encodings
from .cache import *
from .parse_version import parse_version as parse_version
_T = TypeVar("_T")
_T1 = TypeVar("_T1")

View File

@@ -4,8 +4,6 @@ from typing import Any, Callable, Iterable, Iterator, Sequence, TypeVar
from dateutil.relativedelta import relativedelta
from ..tools import pycompat as pycompat
_T = TypeVar("_T")
def Random(seed) -> random.Random: ...

View File

@@ -46,7 +46,6 @@ class Query:
def is_empty(self) -> bool: ...
def select(self, *args: str | SQL) -> SQL: ...
def subselect(self, *args: str | SQL) -> SQL: ...
def get_sql(self) -> tuple[str, str, list]: ...
def get_result_ids(self) -> tuple[int, ...]: ...
def set_result_ids(self, ids, ordered: bool = ...) -> None: ...
def __bool__(self) -> bool: ...

View File

@@ -1,8 +1,6 @@
from types import CodeType
from typing import Iterable, Iterator, Literal
from opcode import HAVE_ARGUMENT as HAVE_ARGUMENT
unsafe_eval = eval
def to_opcodes(

View File

@@ -168,7 +168,7 @@ def trans_load_data(
def get_locales(lang: str | None = ...) -> None: ...
def resetlocale() -> str: ...
def load_language(cr: Cursor, lang: str) -> None: ...
def get_po_paths(module_name: str, lang: str) -> list[str]: ...
def get_po_paths(module_name: str, lang: str) -> Iterator[str]: ...
class CodeTranslations:
python_translations: dict[tuple[str, str], dict]