Update stubs

This commit is contained in:
Trinh Anh Ngoc
2024-10-09 17:05:04 +07:00
parent 9ccd5280cb
commit 28277a4182
24 changed files with 219 additions and 200 deletions

View File

@@ -22,6 +22,7 @@ from .models import BaseModel
from .modules.registry import Registry from .modules.registry import Registry
from .sql_db import Cursor from .sql_db import Cursor
from .tools import SQL, StackMap, frozendict from .tools import SQL, StackMap, frozendict
from .tools.translate import LazyGettext
_T = TypeVar("_T") _T = TypeVar("_T")
_ModelT = TypeVar("_ModelT", bound=BaseModel) _ModelT = TypeVar("_ModelT", bound=BaseModel)
@@ -110,6 +111,7 @@ class Environment(Mapping[str, BaseModel]):
def companies(self) -> Company: ... def companies(self) -> Company: ...
@property @property
def lang(self) -> str: ... def lang(self) -> str: ...
def _(self, source: str | LazyGettext, *args, **kwargs) -> str: ...
def clear(self) -> None: ... def clear(self) -> None: ...
def invalidate_all(self, flush: bool = ...) -> None: ... def invalidate_all(self, flush: bool = ...) -> None: ...
def flush_all(self) -> None: ... def flush_all(self) -> None: ...
@@ -198,6 +200,10 @@ class Cache:
def clear(self) -> None: ... def clear(self) -> None: ...
def check(self, env: Environment) -> None: ... def check(self, env: Environment) -> None: ...
class GroupedCompanyDependentFieldCache:
def __init__(self, company_field_cache) -> None: ...
def __getitem__(self, id_): ...
class Starred: class Starred:
value: Any value: Any
def __init__(self, value) -> None: ... def __init__(self, value) -> None: ...

View File

@@ -12,8 +12,6 @@ class RedirectWarning(Exception):
button_text: str, button_text: str,
additional_context: dict | None = ..., additional_context: dict | None = ...,
) -> None: ... ) -> None: ...
@property
def name(self): ...
class AccessDenied(UserError): class AccessDenied(UserError):
traceback: tuple[str, str, str] traceback: tuple[str, str, str]

View File

@@ -17,8 +17,9 @@ import psycopg2
from markupsafe import Markup from markupsafe import Markup
from . import SUPERUSER_ID as SUPERUSER_ID from . import SUPERUSER_ID as SUPERUSER_ID
from .api import Environment, Registry from .api import Environment
from .models import BaseModel from .models import BaseModel
from .modules.registry import Registry
from .tools import date_utils, float_utils from .tools import date_utils, float_utils
_FieldT = TypeVar("_FieldT", bound=Field) _FieldT = TypeVar("_FieldT", bound=Field)
@@ -30,6 +31,7 @@ DATE_LENGTH: int
DATETIME_LENGTH: int DATETIME_LENGTH: int
NO_ACCESS: str NO_ACCESS: str
IR_MODELS: tuple[str, ...] IR_MODELS: tuple[str, ...]
COMPANY_DEPENDENT_FIELDS: tuple[str, ...]
NoneType: type[None] NoneType: type[None]
Default: object Default: object
@@ -45,7 +47,6 @@ class Field(Generic[_FieldValueT], metaclass=MetaField):
type: str type: str
relational: bool relational: bool
translate: bool translate: bool
column_type: tuple[str, str] | None
write_sequence: int write_sequence: int
args: dict[str, Any] | None args: dict[str, Any] | None
automatic: bool automatic: bool
@@ -91,7 +92,10 @@ class Field(Generic[_FieldValueT], metaclass=MetaField):
def setup_related(self, model: BaseModel) -> None: ... def setup_related(self, model: BaseModel) -> None: ...
def traverse_related(self, record: _ModelT) -> tuple[_ModelT, Field]: ... def traverse_related(self, record: _ModelT) -> tuple[_ModelT, Field]: ...
@property @property
def column_type(self) -> tuple[str, str] | None: ...
@property
def base_field(self) -> Field: ... def base_field(self) -> Field: ...
def get_company_dependent_fallback(self, records: BaseModel): ...
def resolve_depends(self, registry: Registry) -> Iterator[tuple]: ... def resolve_depends(self, registry: Registry) -> Iterator[tuple]: ...
def get_description( def get_description(
self, env: Environment, attributes: Container[str] | None = ... self, env: Environment, attributes: Container[str] | None = ...
@@ -101,6 +105,10 @@ class Field(Generic[_FieldValueT], metaclass=MetaField):
def convert_to_column( def convert_to_column(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ... self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
): ... ): ...
def convert_to_column_insert(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
): ...
def convert_to_column_update(self, value, record: BaseModel): ...
def convert_to_cache(self, value, record: BaseModel, validate: bool = ...): ... def convert_to_cache(self, value, record: BaseModel, validate: bool = ...): ...
def convert_to_record(self, value, record: BaseModel): ... def convert_to_record(self, value, record: BaseModel): ...
def convert_to_record_multi(self, values, records: BaseModel): ... def convert_to_record_multi(self, values, records: BaseModel): ...
@@ -133,7 +141,6 @@ class Field(Generic[_FieldValueT], metaclass=MetaField):
class Boolean(Field[bool]): class Boolean(Field[bool]):
type: str type: str
column_type: tuple[str, str]
def convert_to_column( def convert_to_column(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ... self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
) -> bool: ... ) -> bool: ...
@@ -144,7 +151,6 @@ class Boolean(Field[bool]):
class Integer(Field[int]): class Integer(Field[int]):
type: str type: str
column_type: tuple[str, str]
aggregator: str aggregator: str
def convert_to_column( def convert_to_column(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ... self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
@@ -164,8 +170,6 @@ class Float(Field[float]):
def __init__( def __init__(
self, string: str = ..., digits: tuple[int, int] | str | None = ..., **kwargs self, string: str = ..., digits: tuple[int, int] | str | None = ..., **kwargs
) -> None: ... ) -> None: ...
@property
def column_type(self): ...
def get_digits(self, env: Environment) -> tuple[int, int]: ... def get_digits(self, env: Environment) -> tuple[int, int]: ...
def convert_to_column( def convert_to_column(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ... self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
@@ -182,7 +186,6 @@ class Float(Field[float]):
class Monetary(Field[float]): class Monetary(Field[float]):
type: str type: str
write_sequence: int write_sequence: int
column_type: tuple[str, str]
currency_field: str | None currency_field: str | None
aggregator: str aggregator: str
def __init__( def __init__(
@@ -191,7 +194,7 @@ class Monetary(Field[float]):
def get_currency_field(self, model: BaseModel) -> str: ... def get_currency_field(self, model: BaseModel) -> str: ...
def setup_nonrelated(self, model: BaseModel) -> None: ... def setup_nonrelated(self, model: BaseModel) -> None: ...
def setup_related(self, model: BaseModel) -> None: ... def setup_related(self, model: BaseModel) -> None: ...
def convert_to_column( def convert_to_column_insert(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ... self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
) -> float: ... ) -> float: ...
def convert_to_cache( def convert_to_cache(
@@ -202,6 +205,7 @@ class Monetary(Field[float]):
self, value, record: BaseModel, use_display_name: bool = ... self, value, record: BaseModel, use_display_name: bool = ...
): ... ): ...
def convert_to_write(self, value, record: BaseModel): ... def convert_to_write(self, value, record: BaseModel): ...
def convert_to_export(self, value, record: BaseModel): ...
class _String(Field[str]): class _String(Field[str]):
translate: Callable | bool translate: Callable | bool
@@ -212,6 +216,10 @@ class _String(Field[str]):
def convert_to_column( def convert_to_column(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ... self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
): ... ): ...
def convert_to_column_insert(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
): ...
def convert_to_column_update(self, value, record: BaseModel): ...
def convert_to_cache(self, value, record: BaseModel, validate: bool = ...): ... def convert_to_cache(self, value, record: BaseModel, validate: bool = ...): ...
def convert_to_record(self, value, record: BaseModel): ... def convert_to_record(self, value, record: BaseModel): ...
def convert_to_write(self, value, record: BaseModel): ... def convert_to_write(self, value, record: BaseModel): ...
@@ -224,8 +232,6 @@ class _String(Field[str]):
class Char(_String): class Char(_String):
type: str type: str
trim: bool trim: bool
@property
def column_type(self) -> tuple[str, str]: ...
def update_db_column(self, model: BaseModel, column: dict | None) -> None: ... def update_db_column(self, model: BaseModel, column: dict | None) -> None: ...
def convert_to_column( def convert_to_column(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ... self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
@@ -233,8 +239,6 @@ class Char(_String):
class Text(_String): class Text(_String):
type: str type: str
@property
def column_type(self) -> tuple[str, str]: ...
class Html(_String): class Html(_String):
type: str type: str
@@ -246,8 +250,6 @@ class Html(_String):
sanitize_form: bool sanitize_form: bool
strip_style: bool strip_style: bool
strip_classes: bool strip_classes: bool
@property
def column_type(self) -> tuple[str, str]: ...
def convert_to_column( def convert_to_column(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ... self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
) -> Markup | None: ... ) -> Markup | None: ...
@@ -262,7 +264,6 @@ class Html(_String):
class Date(Field[datetime.date]): class Date(Field[datetime.date]):
type: str type: str
column_type: tuple[str, str]
start_of = date_utils.start_of start_of = date_utils.start_of
end_of = date_utils.end_of end_of = date_utils.end_of
add = date_utils.add add = date_utils.add
@@ -278,6 +279,7 @@ class Date(Field[datetime.date]):
from_string = to_date from_string = to_date
@staticmethod @staticmethod
def to_string(value: datetime.datetime | datetime.date) -> str: ... def to_string(value: datetime.datetime | datetime.date) -> str: ...
def convert_to_column_update(self, value, record: BaseModel): ...
def convert_to_cache( def convert_to_cache(
self, value, record: BaseModel, validate: bool = ... self, value, record: BaseModel, validate: bool = ...
) -> datetime.date | None: ... ) -> datetime.date | None: ...
@@ -286,7 +288,6 @@ class Date(Field[datetime.date]):
class Datetime(Field[datetime.datetime]): class Datetime(Field[datetime.datetime]):
type: str type: str
column_type: tuple[str, str]
start_of = date_utils.start_of start_of = date_utils.start_of
end_of = date_utils.end_of end_of = date_utils.end_of
add = date_utils.add add = date_utils.add
@@ -304,6 +305,7 @@ class Datetime(Field[datetime.datetime]):
from_string = to_datetime from_string = to_datetime
@staticmethod @staticmethod
def to_string(value: datetime.datetime | datetime.date) -> str: ... def to_string(value: datetime.datetime | datetime.date) -> str: ...
def convert_to_column_update(self, value, record: BaseModel): ...
def convert_to_cache( def convert_to_cache(
self, value, record: BaseModel, validate: bool = ... self, value, record: BaseModel, validate: bool = ...
) -> datetime.datetime | None: ... ) -> datetime.datetime | None: ...
@@ -338,7 +340,6 @@ class Image(Binary):
class Selection(Field[str]): class Selection(Field[str]):
type: str type: str
column_type: tuple[str, str]
selection: list | Callable | str selection: list | Callable | str
validate: bool validate: bool
ondelete: dict[str, Any] | None ondelete: dict[str, Any] | None
@@ -357,8 +358,6 @@ class Selection(Field[str]):
class Reference(Selection): class Reference(Selection):
type: str type: str
@property
def column_type(self) -> tuple[str, str]: ...
def convert_to_column( def convert_to_column(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ... self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
) -> str | None: ... ) -> str | None: ...
@@ -383,7 +382,6 @@ class _Relational(Field[BaseModel]):
class Many2one(_Relational): class Many2one(_Relational):
type: str type: str
column_type: tuple[str, str]
ondelete: str | None ondelete: str | None
auto_join: bool auto_join: bool
delegate: bool delegate: bool
@@ -416,7 +414,6 @@ class Many2oneReference(Integer):
class Json(Field): class Json(Field):
type: str type: str
column_type: tuple[str, str]
def convert_to_record(self, value, record: BaseModel): ... def convert_to_record(self, value, record: BaseModel): ...
def convert_to_cache(self, value, record: BaseModel, validate: bool = ...): ... def convert_to_cache(self, value, record: BaseModel, validate: bool = ...): ...
def convert_to_column( def convert_to_column(
@@ -426,7 +423,6 @@ class Json(Field):
class Properties(Field): class Properties(Field):
type: str type: str
column_type: tuple[str, str]
copy: bool copy: bool
prefetch: bool prefetch: bool
write_sequence: int write_sequence: int
@@ -453,7 +449,6 @@ class Properties(Field):
class PropertiesDefinition(Field): class PropertiesDefinition(Field):
type: str type: str
column_type: tuple[str, str]
copy: bool copy: bool
readonly: bool readonly: bool
prefetch: bool prefetch: bool

View File

@@ -50,16 +50,6 @@ def dispatch_rpc(service_name: str, method: str, params: Mapping): ...
def get_session_max_inactivity(env: Environment) -> int: ... def get_session_max_inactivity(env: Environment) -> int: ...
def is_cors_preflight(request: Request, endpoint) -> bool: ... def is_cors_preflight(request: Request, endpoint) -> bool: ...
def serialize_exception(exception: Exception): ... def serialize_exception(exception: Exception): ...
def send_file(
filepath_or_fp,
mimetype: str | None = ...,
as_attachment: bool = ...,
filename: str | None = ...,
mtime: str | None = ...,
add_etags: bool = ...,
cache_timeout: int = ...,
conditional: bool = ...,
) -> werkzeug.Response: ...
class Stream: class Stream:
type: str type: str

View File

@@ -156,12 +156,9 @@ class BaseModel(metaclass=MetaModel):
) -> list[list]: ... ) -> list[list]: ...
def export_data(self, fields_to_export: list[str]) -> dict[str, list[list]]: ... def export_data(self, fields_to_export: list[str]) -> dict[str, list[list]]: ...
def load(self, fields: list[str], data: list[list[str]]) -> dict[str, Any]: ... def load(self, fields: list[str], data: list[list[str]]) -> dict[str, Any]: ...
def _add_fake_fields(
self, fields: dict[str | None, Field]
) -> dict[str | None, Field]: ...
def _extract_records( def _extract_records(
self, self,
fields_: Iterable[Sequence[str]], field_paths: Iterable[Sequence[str]],
data, data,
log: Callable = ..., log: Callable = ...,
limit: float = ..., limit: float = ...,
@@ -341,6 +338,12 @@ class BaseModel(metaclass=MetaModel):
def get_base_url(self) -> str: ... def get_base_url(self) -> str: ...
def _check_company_domain(self, companies) -> list: ... def _check_company_domain(self, companies) -> list: ...
def _check_company(self, fnames: Collection[str] | None = ...) -> None: ... def _check_company(self, fnames: Collection[str] | None = ...) -> None: ...
def check_access(self, operation: str) -> None: ...
def has_access(self, operation: str) -> bool: ...
def _filtered_access(self, operation: str): ...
def _check_access(
self: _ModelT, operation: str
) -> tuple[_ModelT, Callable] | None: ...
def check_access_rights( def check_access_rights(
self, operation: str, raise_exception: bool = ... self, operation: str, raise_exception: bool = ...
) -> bool: ... ) -> bool: ...
@@ -364,8 +367,9 @@ class BaseModel(metaclass=MetaModel):
def _parent_store_create(self) -> None: ... def _parent_store_create(self) -> None: ...
def _parent_store_update_prepare(self: _ModelT, vals_list) -> _ModelT: ... def _parent_store_update_prepare(self: _ModelT, vals_list) -> _ModelT: ...
def _parent_store_update(self) -> None: ... def _parent_store_update(self) -> None: ...
def _clean_properties(self) -> None: ...
def _load_records_write(self, values: dict[str, Any]) -> None: ... def _load_records_write(self, values: dict[str, Any]) -> None: ...
def _load_records_create(self, values: list[dict[str, Any]]): ... def _load_records_create(self, vals_list: list[dict[str, Any]]): ...
def _load_records( def _load_records(
self, data_list: list[dict], update: bool = ..., ignore_duplicates: bool = ... self, data_list: list[dict], update: bool = ..., ignore_duplicates: bool = ...
) -> BaseModel: ... ) -> BaseModel: ...
@@ -541,12 +545,6 @@ class BaseModel(metaclass=MetaModel):
fields_spec: dict, fields_spec: dict,
) -> dict: ... ) -> dict: ...
def _get_placeholder_filename(self, field: str) -> str | bool: ... def _get_placeholder_filename(self, field: str) -> str | bool: ...
def _populate_factories(self) -> list[tuple[str, Callable[..., Iterator]]]: ...
@property
def _populate_sizes(self) -> dict[str, int]: ...
@property
def _populate_dependencies(self) -> list[str]: ...
def _populate(self: _ModelT, size: str) -> _ModelT: ...
class RecordCache(MutableMapping): class RecordCache(MutableMapping):
def __init__(self, record: BaseModel) -> None: ... def __init__(self, record: BaseModel) -> None: ...

View File

@@ -30,9 +30,6 @@ def module_manifest(path: str) -> str | None: ...
def get_module_root(path: str) -> str | None: ... def get_module_root(path: str) -> str | None: ...
def load_manifest(module: str, mod_path: str | None = ...) -> dict[str, Any]: ... def load_manifest(module: str, mod_path: str | None = ...) -> dict[str, Any]: ...
def get_manifest(module: str, mod_path: str | None = ...) -> dict[str, Any]: ... def get_manifest(module: str, mod_path: str | None = ...) -> dict[str, Any]: ...
def load_information_from_description_file(
module: str, mod_path: str | None = ...
) -> dict: ...
def load_openerp_module(module_name: str) -> None: ... def load_openerp_module(module_name: str) -> None: ...
def get_modules() -> list[str]: ... def get_modules() -> list[str]: ...
def get_modules_with_version() -> dict[str, Any]: ... def get_modules_with_version() -> dict[str, Any]: ...

View File

@@ -31,6 +31,7 @@ class Registry(Mapping[str, type[BaseModel]]):
field_depends: Collector field_depends: Collector
field_depends_context: Collector field_depends_context: Collector
field_inverses: Collector field_inverses: Collector
many2one_company_dependents: Collector
registry_sequence: int | None registry_sequence: int | None
cache_sequences: dict cache_sequences: dict
has_unaccent: bool has_unaccent: bool

View File

@@ -1,5 +1,4 @@
import logging.handlers import logging.handlers
import warnings
from logging import Logger, LogRecord from logging import Logger, LogRecord
from typing import TextIO from typing import TextIO
@@ -52,7 +51,6 @@ def init_logger(): ...
DEFAULT_LOG_CONFIGURATION: list[str] DEFAULT_LOG_CONFIGURATION: list[str]
PSEUDOCONFIG_MAPPER: dict[str, list[str]] PSEUDOCONFIG_MAPPER: dict[str, list[str]]
showwarning = warnings.showwarning
IGNORE: set[str] IGNORE: set[str]
def showwarning_with_traceback( def showwarning_with_traceback(

View File

@@ -2,4 +2,3 @@ from . import common as common
from . import db as db from . import db as db
from . import model as model from . import model as model
from . import server as server from . import server as server
from . import wsgi_server as wsgi_server

View File

@@ -1 +0,0 @@
def application(environ, start_response): ...

View File

@@ -75,8 +75,8 @@ class Cursor(BaseCursor):
fetch: bool = ..., fetch: bool = ...,
): ... ): ...
def split_for_in_conditions( def split_for_in_conditions(
self, ids: Iterable, size: int | None = ... self, ids: Iterable[_T], size: int = ...
) -> Iterator[tuple]: ... ) -> Iterator[tuple[_T, ...]]: ...
def print_log(self): ... def print_log(self): ...
def close(self): ... def close(self): ...
def commit(self): ... def commit(self): ...

View File

@@ -99,6 +99,10 @@ class BaseCase(case.TestCase, metaclass=MetaCase):
self, expected, flush: bool = ... self, expected, flush: bool = ...
) -> Generator[list, None, None]: ... ) -> Generator[list, None, None]: ...
@contextmanager @contextmanager
def assertQueriesContain(
self, expected, flush: bool = ...
) -> Generator[list, None, None]: ...
@contextmanager
def assertQueryCount( def assertQueryCount(
self, default: int = ..., flush: bool = ..., **counters self, default: int = ..., flush: bool = ..., **counters
) -> Generator[None, None, None]: ... ) -> Generator[None, None, None]: ...
@@ -123,8 +127,11 @@ class Like:
class Approx: class Approx:
value: float value: float
decorate: bool
cmp: Callable cmp: Callable
def __init__(self, value: float, rounding: int | float | Currency) -> None: ... def __init__(
self, value: float, rounding: int | float | Currency, decorate: bool
) -> None: ...
def __repr__(self) -> str: ... def __repr__(self) -> str: ...
def __eq__(self, other: object) -> bool | NotImplemented: ... def __eq__(self, other: object) -> bool | NotImplemented: ...
@@ -217,6 +224,10 @@ class HttpCase(TransactionCase):
allow_end_on_form: bool allow_end_on_form: bool
@classmethod @classmethod
def setUpClass(cls) -> None: ... def setUpClass(cls) -> None: ...
@classmethod
def base_url(cls) -> str: ...
@classmethod
def http_port(cls) -> int | None: ...
xmlrpc_common: xmlrpclib.ServerProxy xmlrpc_common: xmlrpclib.ServerProxy
xmlrpc_db: xmlrpclib.ServerProxy xmlrpc_db: xmlrpclib.ServerProxy
xmlrpc_object: xmlrpclib.ServerProxy xmlrpc_object: xmlrpclib.ServerProxy
@@ -253,8 +264,6 @@ class HttpCase(TransactionCase):
debug: bool = ..., debug: bool = ...,
**kw **kw
) -> None: ... ) -> None: ...
@classmethod
def base_url(cls) -> str: ...
def start_tour( def start_tour(
self, url_path: str, tour_name: str, step_delay: float | None = ..., **kwargs self, url_path: str, tour_name: str, step_delay: float | None = ..., **kwargs
) -> None: ... ) -> None: ...

View File

@@ -1,6 +1,7 @@
import collections import collections
from typing import Any, Generic, Iterable, Iterator, TypeVar from typing import Any, Generic, Iterable, Iterator, TypeVar
from ..api import Environment
from ..models import BaseModel from ..models import BaseModel
_ModelT = TypeVar("_ModelT", bound=BaseModel) _ModelT = TypeVar("_ModelT", bound=BaseModel)
@@ -10,6 +11,8 @@ MODIFIER_ALIASES: dict
class Form(Generic[_ModelT]): class Form(Generic[_ModelT]):
def __init__(self, record: _ModelT, view: Any | None = ...) -> None: ... def __init__(self, record: _ModelT, view: Any | None = ...) -> None: ...
@classmethod
def from_action(cls, env: Environment, action: dict) -> Form: ...
def __getattr__(self, field_name: str): ... def __getattr__(self, field_name: str): ...
def __getitem__(self, field_name: str): ... def __getitem__(self, field_name: str): ...
def __setattr__(self, field_name: str, value) -> None: ... def __setattr__(self, field_name: str, value) -> None: ...

View File

@@ -30,8 +30,8 @@ from .query import Query as Query
from .set_expression import SetDefinitions as SetDefinitions from .set_expression import SetDefinitions as SetDefinitions
from .sourcemap_generator import SourceMapGenerator as SourceMapGenerator from .sourcemap_generator import SourceMapGenerator as SourceMapGenerator
from .sql import * from .sql import *
from .translate import LazyTranslate as LazyTranslate
from .translate import _ as _ from .translate import _ as _
from .translate import _lt as _lt
from .translate import html_translate as html_translate from .translate import html_translate as html_translate
from .translate import xml_translate as xml_translate from .translate import xml_translate as xml_translate
from .xml_utils import cleanup_xml_node as cleanup_xml_node from .xml_utils import cleanup_xml_node as cleanup_xml_node

View File

@@ -19,7 +19,9 @@ class configmanager:
config_file: str config_file: str
parser: OptionParser parser: OptionParser
def __init__(self, fname: str | None = ...) -> None: ... def __init__(self, fname: str | None = ...) -> None: ...
def parse_config(self, args: list | None = ...): ... def parse_config(
self, args: list[str] | None = ..., *, setup_logging: bool | None = ...
) -> None: ...
def load(self) -> None: ... def load(self) -> None: ...
def save(self, keys: Any | None = ...) -> None: ... def save(self, keys: Any | None = ...) -> None: ...
def get(self, key, default: Any | None = ...): ... def get(self, key, default: Any | None = ...): ...

View File

@@ -1,31 +1,36 @@
from typing import Callable, Generic, TypeVar from typing import Any, Callable, Generic, TypeVar, overload
_T = TypeVar("_T") _T = TypeVar("_T")
class lazy_property(Generic[_T]): class lazy_property(Generic[_T]):
fget: Callable[..., _T] fget: Callable[[Any], _T]
def __init__(self, fget: Callable[..., _T]) -> None: ... def __init__(self, fget: Callable[[Any], _T]) -> None: ...
def __get__(self, obj, cls) -> _T: ... @overload
def __get__(self, obj: None, cls: Any) -> Any: ...
@overload
def __get__(self, obj: object, cls: Any) -> _T: ...
@property @property
def __doc__(self): ... def __doc__(self): ...
@staticmethod @staticmethod
def reset_all(obj) -> None: ... def reset_all(obj) -> None: ...
class lazy_classproperty(lazy_property[_T]):
def __get__(self, obj, cls) -> _T: ...
def conditional(condition, decorator): ... def conditional(condition, decorator): ...
def filter_kwargs(func, kwargs) -> dict: ... def filter_kwargs(func: Callable, kwargs: dict[str, Any]) -> dict[str, Any]: ...
def synchronized(lock_attr: str = ...) -> Callable[[_T], _T]: ... def synchronized(lock_attr: str = ...) -> Callable[[_T], _T]: ...
locked: Callable[[_T], _T] locked: Callable[[_T], _T]
def frame_codeinfo(fframe, back: int = ...) -> tuple[str | None, str | None]: ... def frame_codeinfo(fframe, back: int = ...) -> tuple[str | None, str | None]: ...
class _ClassProperty(property, Generic[_T]): class classproperty(Generic[_T]):
def __get__(self, cls, owner) -> _T: ... fget: ...
def __init__(self, fget: Callable[[Any], _T]) -> None: ...
def __get__(self, cls, owner: type | None = ...) -> _T: ...
@property
def __doc__(self): ...
def classproperty(func: Callable[..., _T]) -> _ClassProperty[_T]: ... class lazy_classproperty(classproperty[_T], Generic[_T]):
def __get__(self, cls, owner: type | None = ...) -> _T: ...
class lazy: class lazy:
def __init__(self, func, *args, **kwargs) -> None: ... def __init__(self, func, *args, **kwargs) -> None: ...

View File

@@ -1,7 +1,10 @@
from re import Pattern
from typing import Literal, Sequence from typing import Literal, Sequence
from ..api import Environment from ..api import Environment
XPG_LOCALE_RE: Pattern
def format_list( def format_list(
env: Environment, env: Environment,
lst: Sequence[str], lst: Sequence[str],
@@ -16,3 +19,4 @@ def format_list(
] = ..., ] = ...,
lang_code: str | None = ..., lang_code: str | None = ...,
) -> str: ... ) -> str: ...
def py_to_js_locale(locale: str) -> str: ...

View File

@@ -1,15 +1,18 @@
from collections import OrderedDict from collections import OrderedDict
from typing import Any from typing import Generic, Iterable, Iterator, MutableMapping, TypeVar
class LRU: _K = TypeVar("_K")
_V = TypeVar("_V")
class LRU(MutableMapping[_K, _V], Generic[_K, _V]):
count: int count: int
d: OrderedDict d: OrderedDict
def __init__(self, count: int, pairs: tuple[Any, Any] = ...) -> None: ... def __init__(self, count: int, pairs: Iterable[tuple[_K, _V]] = ...) -> None: ...
def __contains__(self, obj) -> bool: ... def __contains__(self, obj: _K) -> bool: ...
def get(self, obj, val: Any | None = ...): ... def __getitem__(self, obj: _K) -> _V: ...
def __getitem__(self, obj): ... def __setitem__(self, obj: _K, val: _V): ...
def __setitem__(self, obj, val) -> None: ... def __delitem__(self, obj: _K): ...
def __delitem__(self, obj) -> None: ...
def __len__(self) -> int: ... def __len__(self) -> int: ...
def pop(self, key): ... def __iter__(self) -> Iterator[_K]: ...
def pop(self, key: _K) -> _V: ...
def clear(self) -> None: ... def clear(self) -> None: ...

View File

@@ -10,11 +10,13 @@ from typing import (
Callable, Callable,
Collection, Collection,
Generic, Generic,
ItemsView,
Iterable, Iterable,
Iterator, Iterator,
NoReturn, NoReturn,
Reversible,
Sequence,
TypeVar, TypeVar,
overload,
) )
import markupsafe import markupsafe
@@ -54,11 +56,11 @@ def file_open(
) -> IO: ... ) -> IO: ...
def file_open_temporary_directory(env: Environment) -> Iterator[str]: ... def file_open_temporary_directory(env: Environment) -> Iterator[str]: ...
def flatten(list) -> list: ... def flatten(list) -> list: ...
def reverse_enumerate(l): ... def reverse_enumerate(lst: Sequence[_T]) -> Iterator[tuple[int, _T]]: ...
def partition( def partition(
pred: Callable[[_T], bool], elems: Iterable[_T] pred: Callable[[_T], bool], elems: Iterable[_T]
) -> tuple[list[_T], list[_T]]: ... ) -> tuple[list[_T], list[_T]]: ...
def topological_sort(elems: dict[_T, Any]) -> list[_T]: ... def topological_sort(elems: Mapping[_T, Collection[_T]]) -> list[_T]: ...
def merge_sequences(*iterables: Iterable[_T]) -> list[_T]: ... def merge_sequences(*iterables: Iterable[_T]) -> list[_T]: ...
class PatchedWorkbook(xlwt.Workbook): class PatchedWorkbook(xlwt.Workbook):
@@ -81,8 +83,15 @@ DATETIME_FORMATS_MAP: dict[str, str]
POSIX_TO_LDML: dict[str, str] POSIX_TO_LDML: dict[str, str]
def posix_to_ldml(fmt: str, locale: Locale) -> str: ... def posix_to_ldml(fmt: str, locale: Locale) -> str: ...
@overload
def split_every(n: int, iterable: Iterable[_T]) -> Iterator[tuple[_T, ...]]: ...
@overload
def split_every( def split_every(
n: int, iterable: Iterable[_T], piece_maker: Callable[[Iterable[_T]], _T1] = ... n: int, iterable: Iterable[_T], piece_maker: type[Collection[_T]]
) -> Iterator[Collection[_T]]: ...
@overload
def split_every(
n: int, iterable: Iterable[_T], piece_maker: Callable[[Iterable[_T]], _T1]
) -> Iterator[_T1]: ... ) -> Iterator[_T1]: ...
def discardattr(obj, key: str) -> None: ... def discardattr(obj, key: str) -> None: ...
def remove_accents(input_str: str) -> str: ... def remove_accents(input_str: str) -> str: ...
@@ -119,18 +128,9 @@ class lower_logging(Handler):
) -> None: ... ) -> None: ...
def emit(self, record: LogRecord) -> None: ... def emit(self, record: LogRecord) -> None: ...
class CountingStream(Generic[_T]):
stream: Iterator[_T]
index: int
stopped: bool
def __init__(self, stream: Iterable[_T], start: int = ...) -> None: ...
def __iter__(self) -> CountingStream[_T]: ...
def next(self) -> _T: ...
__next__ = next
def stripped_sys_argv(*strip_args: str) -> list[str]: ... def stripped_sys_argv(*strip_args: str) -> list[str]: ...
class ConstantMapping(Mapping[_KT, _VT]): class ConstantMapping(Mapping[Any, _VT], Generic[_VT]):
def __init__(self, val: _VT) -> None: ... def __init__(self, val: _VT) -> None: ...
def __len__(self) -> int: ... def __len__(self) -> int: ...
def __iter__(self) -> Iterator: ... def __iter__(self) -> Iterator: ...
@@ -142,7 +142,7 @@ def dumpstacks(
def freehash(arg) -> int: ... def freehash(arg) -> int: ...
def clean_context(context: dict[str, Any]) -> dict[str, Any]: ... def clean_context(context: dict[str, Any]) -> dict[str, Any]: ...
class frozendict(dict): class frozendict(dict[_KT, _VT], Generic[_KT, _VT]):
def __delitem__(self, key) -> NoReturn: ... def __delitem__(self, key) -> NoReturn: ...
def __setitem__(self, key, val) -> NoReturn: ... def __setitem__(self, key, val) -> NoReturn: ...
def clear(self) -> NoReturn: ... def clear(self) -> NoReturn: ...
@@ -152,23 +152,24 @@ class frozendict(dict):
def update(self, *args, **kwargs) -> NoReturn: ... def update(self, *args, **kwargs) -> NoReturn: ...
def __hash__(self) -> int: ... def __hash__(self) -> int: ...
class Collector(dict[_KT, tuple[_T]]): class Collector(dict[_KT, tuple[_T, ...]], Generic[_KT, _T]):
def __getitem__(self, key: _KT) -> tuple[_T]: ... def __getitem__(self, key: _KT) -> tuple[_T, ...]: ...
def __setitem__(self, key: _KT, val: Iterable[_T]) -> None: ... def __setitem__(self, key: _KT, val: Iterable[_T]): ...
def add(self, key: _KT, val: _T) -> None: ... def add(self, key: _KT, val: _T): ...
def discard_keys_and_values(self, excludes: Collection): ... def discard_keys_and_values(self, excludes: Collection[_KT | _T]) -> None: ...
class StackMap(MutableMapping): class StackMap(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
def __init__(self, m: MutableMapping | None = ...) -> None: ... def __init__(self, m: MutableMapping[_KT, _VT] | None = ...) -> None: ...
def __getitem__(self, key): ... def __getitem__(self, key: _KT) -> _VT: ...
def __setitem__(self, key, val) -> None: ... def __setitem__(self, key: _KT, val: _VT): ...
def __delitem__(self, key) -> None: ... def __delitem__(self, key: _KT): ...
def __iter__(self) -> Iterator: ... def __iter__(self) -> Iterator[_KT]: ...
def __len__(self) -> int: ... def __len__(self) -> int: ...
def pushmap(self, m: MutableMapping | None = ...) -> None: ... def __str__(self) -> str: ...
def popmap(self) -> MutableMapping: ... def pushmap(self, m: MutableMapping[_KT, _VT] | None = ...): ...
def popmap(self) -> MutableMapping[_KT, _VT]: ...
class OrderedSet(MutableSet): class OrderedSet(MutableSet[_T], Generic[_T]):
def __init__(self, elems: Iterable = ...) -> None: ... def __init__(self, elems: Iterable = ...) -> None: ...
def __contains__(self, elem) -> bool: ... def __contains__(self, elem) -> bool: ...
def __iter__(self) -> Iterator: ... def __iter__(self) -> Iterator: ...
@@ -178,7 +179,7 @@ class OrderedSet(MutableSet):
def update(self, elems: Iterable) -> None: ... def update(self, elems: Iterable) -> None: ...
def difference_update(self, elems: Iterable) -> None: ... def difference_update(self, elems: Iterable) -> None: ...
class LastOrderedSet(OrderedSet): class LastOrderedSet(OrderedSet[_T], Generic[_T]):
def add(self, elem) -> None: ... def add(self, elem) -> None: ...
class Callbacks: class Callbacks:
@@ -188,17 +189,17 @@ class Callbacks:
def run(self) -> None: ... def run(self) -> None: ...
def clear(self) -> None: ... def clear(self) -> None: ...
class ReversedIterable(Generic[_T]): class ReversedIterable(Reversible[_T], Generic[_T]):
iterable: Iterable[_T] iterable: Reversible[_T]
def __init__(self, iterable: Iterable[_T]) -> None: ... def __init__(self, iterable: Reversible[_T]) -> None: ...
def __iter__(self) -> Iterator[_T]: ... def __iter__(self) -> Iterator[_T]: ...
def __reversed__(self) -> Iterator[_T]: ... def __reversed__(self) -> Iterator[_T]: ...
def groupby( def groupby(
iterable: Iterable[_T], key: Callable[..., _T1] | None = ... iterable: Iterable[_T], key: Callable[[_T], _T1] = ...
) -> ItemsView[_T1, _T]: ... ) -> Iterable[tuple[_T1, list[_T]]]: ...
def unique(it: Iterable[_T]) -> Iterator[_T]: ... def unique(it: Iterable[_T]) -> Iterator[_T]: ...
def submap(mapping: Mapping[_KT, _VT], keys: Iterable[_KT]) -> dict[_KT, _VT]: ... def submap(mapping: Mapping[_KT, _VT], keys: Iterable[_KT]) -> Mapping[_KT, _VT]: ...
class Reverse: class Reverse:
val: Any val: Any
@@ -265,7 +266,7 @@ def format_duration(value: float) -> str: ...
consteq: Callable[[str, str], bool] consteq: Callable[[str, str], bool]
class ReadonlyDict(Mapping): ... class ReadonlyDict(Mapping[_KT, _VT], Generic[_KT, _VT]): ...
class DotDict(dict): class DotDict(dict):
def __getattr__(self, attrib): ... def __getattr__(self, attrib): ...

View File

@@ -4,4 +4,4 @@ from typing import Callable
component_re: Pattern component_re: Pattern
replace: Callable replace: Callable
def parse_version(s: str) -> tuple[str]: ... def parse_version(s: str) -> tuple[str, ...]: ...

View File

@@ -1,54 +1,50 @@
import datetime import datetime
import random
from typing import Any, Callable, Iterable, Iterator, Sequence, TypeVar
from dateutil.relativedelta import relativedelta from ..api import Environment
from ..fields import Field, Many2one
from ..models import Model
from . import SQL
_T = TypeVar("_T") MIN_DATETIME: datetime.datetime
MAX_DATETIME: datetime.datetime
def Random(seed) -> random.Random: ... def get_field_variation_date(
def format_str(val: _T, counter, values) -> _T: ... model: Model, field: Field, factor: int, series_alias: str
def chain_factories( ) -> SQL: ...
field_factories: Iterable[tuple[str, Callable[..., Iterator]]], model_name: str def get_field_variation_char(field: Field, postfix: str | SQL | None = ...) -> SQL: ...
) -> Iterator: ... def ignore_indexes(model: Model): ...
def root_factory() -> Iterator[dict]: ... def ignore_fkey_constraints(model: Model): ...
def randomize( def field_needs_variation(model: Model, field: Field) -> bool: ...
vals: Sequence, def get_field_variation(
weights: Sequence | None = ..., model: Model, field: Field, factor: int, series_alias: str
seed: Any = ..., ) -> SQL: ...
formatter: Callable[[Any, Any, Any], Any] = ..., def fetch_last_id(model: Model) -> int: ...
counter_offset: int = ..., def populate_field(
) -> Callable[[Iterable, str, str], dict]: ... model: Model,
def cartesian( field: Field,
vals: Sequence, populated: dict[Model, int],
weights: Sequence | None = ..., factors: dict[Model, int],
seed: Any = ..., table_alias: str = ...,
formatter: Callable[[Any, Any, Any], Any] = ..., series_alias: str = ...,
then: Callable[[Iterable, str, str], dict] | None = ..., ) -> SQL | None: ...
) -> Callable[[Iterable, str, str], Iterator[dict]]: ... def populate_model(
def iterate( model: Model,
vals: Sequence, populated: dict[Model, int],
weights: Sequence | None = ..., factors: dict[Model, int],
seed: Any = ..., separator_code: str,
formatter: Callable[[Any, Any, Any], Any] = ..., ) -> None: ...
then: Callable[[Iterable, str, str], dict] | None = ...,
) -> Callable[[Iterable, str, str], Iterator[dict]]: ... class Many2oneFieldWrapper(Many2one):
def constant( def __init__(self, model, field_name, comodel_name) -> None: ...
val: Sequence, formatter: Callable[[Any, Any, Any], Any] = ...
) -> Callable[[Iterable, str, str], Iterator[dict]]: ... class Many2manyModelWrapper:
def compute( env: Environment
function: Callable[[Any, Any, Any], Any], seed: Any | None = ... def __init__(self, env, field) -> None: ...
) -> Callable[[Iterable, str, str], Iterator[dict]]: ... def __repr__(self) -> str: ...
def randint( def __eq__(self, other): ...
a: int, b: int, seed: Any | None = ... def __hash__(self): ...
) -> Callable[[Iterable, str, str], Iterator[dict]]: ...
def randfloat( def infer_many2many_model(
a: float, b: float, seed: Any | None = ... env: Environment, field: Field
) -> Callable[[Iterable, str, str], Iterator[dict]]: ... ) -> Model | Many2manyModelWrapper: ...
def randdatetime( def populate_models(model_factors: dict[Model, int], separator_code: int) -> None: ...
*,
base_date: datetime.datetime | None = ...,
relative_before: datetime.timedelta | relativedelta | None = ...,
relative_after: datetime.timedelta | relativedelta | None = ...,
seed: Any | None = ...
) -> Callable[[Iterable, str, str], Iterator[dict]]: ...

View File

@@ -47,7 +47,7 @@ class Query:
def select(self, *args: str | SQL) -> SQL: ... def select(self, *args: str | SQL) -> SQL: ...
def subselect(self, *args: str | SQL) -> SQL: ... def subselect(self, *args: str | SQL) -> SQL: ...
def get_result_ids(self) -> tuple[int, ...]: ... def get_result_ids(self) -> tuple[int, ...]: ...
def set_result_ids(self, ids, ordered: bool = ...) -> None: ... def set_result_ids(self, ids: Iterable[int], ordered: bool = ...) -> None: ...
def __bool__(self) -> bool: ... def __bool__(self) -> bool: ...
def __len__(self) -> int: ... def __len__(self) -> int: ...
def __iter__(self) -> Iterator[int]: ... def __iter__(self) -> Iterator[int]: ...

View File

@@ -1,6 +1,6 @@
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from collections.abc import Iterable from collections.abc import Iterable
from typing import Any from typing import Any, Collection, Literal
class SetDefinitions: class SetDefinitions:
def __init__(self, definitions: dict[int, dict]) -> None: ... def __init__(self, definitions: dict[int, dict]) -> None: ...
@@ -9,9 +9,11 @@ class SetDefinitions:
@property @property
def universe(self) -> SetExpression: ... def universe(self) -> SetExpression: ...
def parse(self, refs: str, raise_if_not_found: bool = ...) -> SetExpression: ... def parse(self, refs: str, raise_if_not_found: bool = ...) -> SetExpression: ...
def from_ids(self, ids, keep_subsets: bool = ...) -> SetExpression: ... def from_ids(
self, ids: Iterable[int], keep_subsets: bool = ...
) -> SetExpression: ...
def from_key(self, key: str) -> SetExpression: ... def from_key(self, key: str) -> SetExpression: ...
def get_id(self, ref): ... def get_id(self, ref: LeafIdType) -> LeafIdType | None: ...
class SetExpression(ABC): class SetExpression(ABC):
@abstractmethod @abstractmethod
@@ -19,7 +21,7 @@ class SetExpression(ABC):
@abstractmethod @abstractmethod
def is_universal(self) -> bool: ... def is_universal(self) -> bool: ...
@abstractmethod @abstractmethod
def invert_intersect(self, factor: SetExpression) -> SetExpression: ... def invert_intersect(self, factor: SetExpression) -> SetExpression | None: ...
@abstractmethod @abstractmethod
def matches(self, user_group_ids: Iterable[int]) -> bool: ... def matches(self, user_group_ids: Iterable[int]) -> bool: ...
@property @property
@@ -32,7 +34,7 @@ class SetExpression(ABC):
@abstractmethod @abstractmethod
def __invert__(self) -> SetExpression: ... def __invert__(self) -> SetExpression: ...
@abstractmethod @abstractmethod
def __eq__(self, other: SetExpression) -> bool: ... def __eq__(self, other) -> bool: ...
@abstractmethod @abstractmethod
def __le__(self, other: SetExpression) -> bool: ... def __le__(self, other: SetExpression) -> bool: ...
@abstractmethod @abstractmethod
@@ -46,15 +48,15 @@ class Union(SetExpression):
def key(self) -> str: ... def key(self) -> str: ...
def is_empty(self) -> bool: ... def is_empty(self) -> bool: ...
def is_universal(self) -> bool: ... def is_universal(self) -> bool: ...
def invert_intersect(self, factor: Union) -> SetExpression: ... def invert_intersect(self, factor: SetExpression) -> Union | None: ...
def __and__(self, other: Union) -> SetExpression: ... def __and__(self, other: SetExpression) -> Union: ...
def __or__(self, other: Union) -> SetExpression: ... def __or__(self, other: SetExpression) -> Union: ...
def __invert__(self) -> Union: ... def __invert__(self) -> Union: ...
def matches(self, user_group_ids) -> bool: ... def matches(self, user_group_ids) -> bool: ...
def __bool__(self) -> bool: ... def __bool__(self) -> bool: ...
def __eq__(self, other: Union) -> bool: ... def __eq__(self, other) -> bool: ...
def __le__(self, other: Union) -> bool: ... def __le__(self, other: SetExpression) -> bool: ...
def __lt__(self, other: Union) -> bool: ... def __lt__(self, other: SetExpression) -> bool: ...
def __str__(self) -> str: ... def __str__(self) -> str: ...
def __repr__(self) -> str: ... def __repr__(self) -> str: ...
def __hash__(self): ... def __hash__(self): ...
@@ -67,29 +69,29 @@ class Inter:
def is_universal(self) -> bool: ... def is_universal(self) -> bool: ...
def matches(self, user_group_ids) -> bool: ... def matches(self, user_group_ids) -> bool: ...
def __and__(self, other: Inter) -> Inter: ... def __and__(self, other: Inter) -> Inter: ...
def __eq__(self, other: Inter) -> bool: ... def __eq__(self, other) -> bool: ...
def __le__(self, other: Inter) -> bool: ... def __le__(self, other: Inter) -> bool: ...
def __lt__(self, other: Inter) -> bool: ... def __lt__(self, other: Inter) -> bool: ...
def __hash__(self): ... def __hash__(self): ...
class Leaf: class Leaf:
id: ... id: LeafIdType
ref: ... ref: str | int
negative: bool negative: bool
key: ... key: tuple[LeafIdType, bool]
subsets: set subsets: set[LeafIdType]
supersets: set supersets: set[LeafIdType]
disjoints: set disjoints: set[LeafIdType]
inverse: Leaf | None inverse: Leaf | None
def __init__( def __init__(
self, leaf_id, ref: Any | None = ..., negative: bool = ... self, leaf_id: LeafIdType, ref: str | int | None = ..., negative: bool = ...
) -> None: ... ) -> None: ...
def __invert__(self): ... def __invert__(self) -> Leaf: ...
def is_empty(self) -> bool: ... def is_empty(self) -> bool: ...
def is_universal(self) -> bool: ... def is_universal(self) -> bool: ...
def isdisjoint(self, other: Leaf) -> bool: ... def isdisjoint(self, other: Leaf) -> bool: ...
def matches(self, user_group_ids): ... def matches(self, user_group_ids: Collection[int]) -> bool: ...
def __eq__(self, other: Leaf) -> bool: ... def __eq__(self, other) -> bool: ...
def __le__(self, other: Leaf) -> bool: ... def __le__(self, other: Leaf) -> bool: ...
def __lt__(self, other: Leaf) -> bool: ... def __lt__(self, other: Leaf) -> bool: ...
def __hash__(self): ... def __hash__(self): ...
@@ -98,6 +100,7 @@ class UnknownId(str):
def __lt__(self, other) -> bool: ... def __lt__(self, other) -> bool: ...
def __gt__(self, other) -> bool: ... def __gt__(self, other) -> bool: ...
LeafIdType: int | Literal["*"] | UnknownId
UNIVERSAL_LEAF: Leaf UNIVERSAL_LEAF: Leaf
EMPTY_LEAF: Leaf EMPTY_LEAF: Leaf
EMPTY_INTER: Inter EMPTY_INTER: Inter

View File

@@ -47,18 +47,30 @@ def html_term_converter(value: str) -> str: ...
def get_text_content(term: str) -> str: ... def get_text_content(term: str) -> str: ...
def is_text(term: str) -> bool: ... def is_text(term: str) -> bool: ...
def translate_sql_constraint(cr: Cursor, key: str, lang: str) -> str: ... def translate_sql_constraint(cr: Cursor, key: str, lang: str) -> str: ...
def get_translation(module: str, lang: str, source: str, args: tuple | dict) -> str: ...
def get_translated_module(arg) -> str: ...
def get_text_alias(source: str, *args, **kwargs): ...
class GettextAlias: class LazyGettext:
def __call__(self, source: str, *args, **kwargs) -> str: ... def __init__(
self, source, *args, _module: str = ..., _default_lang: str = ..., **kwargs
) -> None: ...
def __repr__(self) -> str: ...
def __str__(self) -> str: ...
def __eq__(self, other): ...
def __hash__(self): ...
def __lt__(self, other): ...
def __add__(self, other): ...
def __radd__(self, other): ...
class _lt: class LazyTranslate:
def __init__(self, source: str, *args, **kwargs) -> None: ... module: str
def __eq__(self, other) -> NoReturn: ... default_lang: str
def __lt__(self, other) -> NoReturn: ... def __init__(self, module: str, *, default_lang: str = ...) -> None: ...
def __add__(self, other: str | _lt) -> str: ... def __call__(self, source: str, *args, **kwargs) -> LazyGettext: ...
def __radd__(self, other: str) -> str: ...
_: GettextAlias _ = get_text_alias
_lt = LazyGettext
def quote(s: str) -> str: ... def quote(s: str) -> str: ...