mirror of
https://github.com/odoo-ide/odoo-stubs.git
synced 2025-05-08 16:52:26 +03:00
Update stubs
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import datetime
|
import datetime
|
||||||
import enum
|
import enum
|
||||||
from typing import Any, Callable, Container, Collection, Iterable, Iterator, Sequence, TypeVar, Union
|
from typing import Any, Callable, Container, Collection, Iterator, Sequence, TypeVar, Union
|
||||||
|
|
||||||
import psycopg2
|
import psycopg2
|
||||||
from markupsafe import Markup
|
from markupsafe import Markup
|
||||||
|
|||||||
@@ -1,77 +1,80 @@
|
|||||||
from logging import Logger
|
from abc import ABC, abstractmethod
|
||||||
from typing import Any, Callable, Generator, Sequence, TypeVar
|
from collections import defaultdict
|
||||||
|
from collections.abc import MutableMapping
|
||||||
|
from contextlib import nullcontext
|
||||||
|
from typing import Any, Callable, Generator, Iterable, Literal, Mapping, Sequence, TypeVar
|
||||||
|
|
||||||
import werkzeug
|
import werkzeug
|
||||||
from werkzeug.datastructures import CombinedMultiDict
|
from werkzeug.datastructures import Headers
|
||||||
from werkzeug.exceptions import NotFound
|
from werkzeug.exceptions import NotFound
|
||||||
from werkzeug.local import LocalStack
|
from werkzeug.local import LocalStack
|
||||||
from werkzeug.routing import Map
|
from werkzeug.middleware.proxy_fix import ProxyFix as ProxyFix_
|
||||||
|
from werkzeug.routing import Map, Rule
|
||||||
|
from werkzeug.urls import URL
|
||||||
|
|
||||||
from .api import Environment
|
from .api import Environment
|
||||||
|
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._vendor import sessions
|
from .tools._vendor import sessions
|
||||||
|
from .tools.geoipresolver import GeoIPResolver
|
||||||
|
from .tools.profiler import Profiler
|
||||||
|
|
||||||
_T = TypeVar('_T')
|
_T = TypeVar('_T')
|
||||||
|
|
||||||
rpc_request: Logger
|
ProxyFix: Callable[..., ProxyFix_]
|
||||||
rpc_response: Logger
|
CORS_MAX_AGE: int
|
||||||
|
CSRF_FREE_METHODS: tuple[str, ...]
|
||||||
|
CSRF_TOKEN_SALT: int
|
||||||
|
DEFAULT_LANG: str
|
||||||
|
|
||||||
|
def get_default_session() -> dict[str, Any]: ...
|
||||||
|
|
||||||
|
JSON_MIMETYPES: tuple[str, ...]
|
||||||
|
MISSING_CSRF_WARNING: str
|
||||||
|
ROUTING_KEYS: set[str]
|
||||||
|
SESSION_LIFETIME: int
|
||||||
STATIC_CACHE: int
|
STATIC_CACHE: int
|
||||||
STATIC_CACHE_LONG: int
|
STATIC_CACHE_LONG: int
|
||||||
ALLOWED_DEBUG_MODES: list[str]
|
|
||||||
_request_stack: LocalStack
|
|
||||||
request: HttpRequest | JsonRequest
|
|
||||||
|
|
||||||
def replace_request_password(args) -> tuple: ...
|
class SessionExpiredException(Exception): ...
|
||||||
|
|
||||||
NO_POSTMORTEM: tuple[type[Exception], ...]
|
def content_disposition(filename: str) -> str: ...
|
||||||
|
def db_list(force: bool = ..., host: str | None = ...) -> list[str]: ...
|
||||||
|
def db_filter(dbs: Iterable[str], host: str | None = ...) -> list[str]: ...
|
||||||
|
def is_cors_preflight(request: Request, endpoint) -> bool: ...
|
||||||
|
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: ...
|
||||||
|
|
||||||
def dispatch_rpc(service_name: str, method: str, params): ...
|
class Stream:
|
||||||
|
type: str
|
||||||
|
data: bytes | None
|
||||||
|
path: str | None
|
||||||
|
url: str | None
|
||||||
|
mimetype: str | None
|
||||||
|
as_attachment: bool
|
||||||
|
download_name: str | None
|
||||||
|
conditional: bool
|
||||||
|
etag: bool
|
||||||
|
last_modified: float | None
|
||||||
|
max_age: int | None
|
||||||
|
immutable: bool
|
||||||
|
size: int | None
|
||||||
|
def __init__(self, **kwargs) -> None: ...
|
||||||
|
@classmethod
|
||||||
|
def from_path(cls, path: str, filter_ext: tuple[str, ...] = ...) -> Stream: ...
|
||||||
|
@classmethod
|
||||||
|
def from_attachment(cls, attachment: 'odoo.model.ir_attachment') -> Stream: ...
|
||||||
|
@classmethod
|
||||||
|
def from_binary_field(cls, record: BaseModel, field_name: str) -> Stream: ...
|
||||||
|
def read(self) -> bytes: ...
|
||||||
|
def get_response(self, as_attachment: bool | None = ..., immutable: bool | None = ..., **send_file_kwargs) -> werkzeug.Response: ...
|
||||||
|
|
||||||
class WebRequest:
|
class Controller:
|
||||||
httprequest: werkzeug.Request
|
children_classes: defaultdict[Any, list]
|
||||||
httpresponse: Response | None
|
@classmethod
|
||||||
disable_db: bool
|
def __init_subclass__(cls) -> None: ...
|
||||||
endpoint: EndPoint | None
|
|
||||||
endpoint_arguments: Any
|
|
||||||
auth_method: str | None
|
|
||||||
website: 'odoo.model.website'
|
|
||||||
lang: 'odoo.model.res_lang'
|
|
||||||
_cr: Cursor | None
|
|
||||||
_uid: int | None
|
|
||||||
_context: dict | None
|
|
||||||
_env: Environment | None
|
|
||||||
_failed: Exception | None
|
|
||||||
def __init__(self, httprequest: werkzeug.Request) -> None: ...
|
|
||||||
@property
|
|
||||||
def cr(self) -> Cursor: ...
|
|
||||||
@property
|
|
||||||
def uid(self) -> int: ...
|
|
||||||
@uid.setter
|
|
||||||
def uid(self, val) -> None: ...
|
|
||||||
@property
|
|
||||||
def context(self) -> dict: ...
|
|
||||||
@context.setter
|
|
||||||
def context(self, val) -> None: ...
|
|
||||||
@property
|
|
||||||
def env(self) -> Environment: ...
|
|
||||||
@property
|
|
||||||
def session(self) -> OpenERPSession: ...
|
|
||||||
def __enter__(self: _T) -> _T: ...
|
|
||||||
def __exit__(self, exc_type, exc_value, traceback) -> None: ...
|
|
||||||
def set_handler(self, endpoint: EndPoint, arguments, auth) -> None: ...
|
|
||||||
def _handle_exception(self, exception: Exception) -> None: ...
|
|
||||||
def redirect(self, location, code: int = ..., local: bool = ...) -> Response: ...
|
|
||||||
def redirect_query(self, location, query: Any | None = ..., code: int = ..., local: bool = ...) -> Response: ...
|
|
||||||
def _is_cors_preflight(self, endpoint: EndPoint) -> bool: ...
|
|
||||||
def _call_function(self, *args, **kwargs): ...
|
|
||||||
def registry_cr(self) -> Generator[tuple[Registry, Cursor], None, None]: ...
|
|
||||||
@property
|
|
||||||
def registry(self) -> Registry: ...
|
|
||||||
@property
|
|
||||||
def db(self) -> str | None: ...
|
|
||||||
def csrf_token(self, time_limit: int | None = ...): ...
|
|
||||||
def validate_csrf(self, csrf) -> bool: ...
|
|
||||||
|
|
||||||
def route(route: str | list[str] | None = ...,
|
def route(route: str | list[str] | None = ...,
|
||||||
type: str = ...,
|
type: str = ...,
|
||||||
@@ -80,89 +83,48 @@ def route(route: str | list[str] | None = ...,
|
|||||||
cors: str = ...,
|
cors: str = ...,
|
||||||
csrf: bool = ...,
|
csrf: bool = ...,
|
||||||
**kw): ...
|
**kw): ...
|
||||||
|
def _generate_routing_rules(modules: Sequence[str], nodb_only: bool, converters: Any | None = ...) -> Generator[tuple[str, Any], None, None]: ...
|
||||||
|
|
||||||
class JsonRequest(WebRequest):
|
class FilesystemSessionStore(sessions.FilesystemSessionStore):
|
||||||
_request_type: str
|
def get_session_filename(self, sid: str) -> str: ...
|
||||||
params: dict
|
def save(self, session: Session) -> None: ...
|
||||||
jsonrequest: Any
|
def get(self, sid: str) -> Session: ...
|
||||||
context: dict
|
def rotate(self, session: Session, env: Environment) -> None: ...
|
||||||
def __init__(self, *args) -> None: ...
|
def vacuum(self) -> None: ...
|
||||||
def _json_response(self, result: Any | None = ..., error: dict | None = ...) -> Response: ...
|
|
||||||
def _handle_exception(self, exception: Exception) -> Response: ...
|
|
||||||
def dispatch(self) -> Response: ...
|
|
||||||
|
|
||||||
def serialize_exception(e: Exception) -> dict[str, Any]: ...
|
class Session(MutableMapping):
|
||||||
|
__slots__ = ('can_save', 'data', 'is_dirty', 'is_explicit', 'is_new', 'should_rotate', 'sid')
|
||||||
class HttpRequest(WebRequest):
|
can_save: bool
|
||||||
_request_type: str
|
data: dict
|
||||||
params: dict
|
is_dirty: bool
|
||||||
def __init__(self, *args) -> None: ...
|
is_explicit: bool
|
||||||
def _handle_exception(self, exception: Exception): ...
|
is_new: bool
|
||||||
def _is_cors_preflight(self, endpoint: EndPoint) -> bool: ...
|
should_rotate: bool
|
||||||
def dispatch(self): ...
|
sid: str
|
||||||
def make_response(self, data, headers: list[tuple[str, str]] | None = ..., cookies: dict | None = ...) -> Response: ...
|
def __init__(self, data: dict, sid: str, new: bool = ...) -> None: ...
|
||||||
def render(self, template, qcontext: dict | None = ..., lazy: bool = ..., **kw) -> Response: ...
|
def __getitem__(self, item: str): ...
|
||||||
def not_found(self, description: str | Any | None = ...) -> NotFound: ...
|
def __setitem__(self, item: str, value) -> None: ...
|
||||||
|
def __delitem__(self, item: str) -> None: ...
|
||||||
addons_manifest: dict
|
def __len__(self) -> int: ...
|
||||||
controllers_per_module: dict[str, list]
|
def __iter__(self) -> Iterable[str]: ...
|
||||||
|
def __getattr__(self, attr: str): ...
|
||||||
class ControllerType(type):
|
def __setattr__(self, key: str, val) -> None: ...
|
||||||
def __init__(cls, name: str, bases: tuple, attrs: dict) -> None: ...
|
uid: int | None
|
||||||
|
pre_login: str | None
|
||||||
Controller = ControllerType('Controller', (object,), {})
|
|
||||||
|
|
||||||
class EndPoint:
|
|
||||||
method: Callable
|
|
||||||
original: Callable
|
|
||||||
routing: dict
|
|
||||||
arguments: dict
|
|
||||||
def __init__(self, method, routing) -> None: ...
|
|
||||||
@property
|
|
||||||
def first_arg_is_req(self) -> bool: ...
|
|
||||||
def __call__(self, *args, **kw): ...
|
|
||||||
def __eq__(self, other) -> bool: ...
|
|
||||||
def __hash__(self) -> int: ...
|
|
||||||
def _as_tuple(self) -> tuple[Callable, dict]: ...
|
|
||||||
def __repr__(self) -> str: ...
|
|
||||||
|
|
||||||
def _generate_routing_rules(modules: Sequence[str], nodb_only: bool, converters: Any | None = ...) -> Generator[tuple[str, EndPoint, dict], None, None]: ...
|
|
||||||
|
|
||||||
class AuthenticationError(Exception): ...
|
|
||||||
class SessionExpiredException(Exception): ...
|
|
||||||
|
|
||||||
class OpenERPSession(sessions.Session):
|
|
||||||
inited: bool
|
|
||||||
modified: bool
|
|
||||||
rotate: bool
|
|
||||||
def __init__(self, *args, **kwargs) -> None: ...
|
|
||||||
def __getattr__(self, attr): ...
|
|
||||||
def __setattr__(self, k, v): ...
|
|
||||||
pre_uid: int
|
pre_uid: int
|
||||||
uid: int
|
def authenticate(self, dbname: str, login: str | None = ..., password: str | None = ...) -> int: ...
|
||||||
db: str
|
def finalize(self, env: Environment) -> None: ...
|
||||||
login: str | None
|
|
||||||
def authenticate(self, db: str, login: str | None = ..., password: str | None = ...) -> int: ...
|
|
||||||
session_token: str | None
|
|
||||||
def finalize(self) -> None: ...
|
|
||||||
def check_security(self) -> None: ...
|
|
||||||
def logout(self, keep_db: bool = ...) -> None: ...
|
def logout(self, keep_db: bool = ...) -> None: ...
|
||||||
def _default_values(self) -> None: ...
|
def touch(self) -> None: ...
|
||||||
context: dict
|
|
||||||
def get_context(self) -> dict: ...
|
|
||||||
def _fix_lang(self, context: dict) -> None: ...
|
|
||||||
def save_action(self, action) -> int: ...
|
|
||||||
def get_action(self, key: int): ...
|
|
||||||
def save_request_data(self) -> None: ...
|
|
||||||
def load_request_data(self) -> Generator[CombinedMultiDict | None, None, None]: ...
|
|
||||||
|
|
||||||
def session_gc(session_store: sessions.FilesystemSessionStore) -> None: ...
|
_request_stack: LocalStack
|
||||||
|
request: Request
|
||||||
ODOO_DISABLE_SESSION_GC: bool
|
|
||||||
|
|
||||||
class Response(werkzeug.Response):
|
class Response(werkzeug.Response):
|
||||||
default_mimetype: str
|
default_mimetype: str
|
||||||
def __init__(self, *args, **kw) -> None: ...
|
def __init__(self, *args, **kw) -> None: ...
|
||||||
|
@classmethod
|
||||||
|
def load(cls, result, fname: str = ...): ...
|
||||||
template: Any
|
template: Any
|
||||||
qcontext: dict
|
qcontext: dict
|
||||||
uid: int
|
uid: int
|
||||||
@@ -171,36 +133,122 @@ class Response(werkzeug.Response):
|
|||||||
def is_qweb(self) -> bool: ...
|
def is_qweb(self) -> bool: ...
|
||||||
def render(self): ...
|
def render(self): ...
|
||||||
def flatten(self) -> None: ...
|
def flatten(self) -> None: ...
|
||||||
|
def set_cookie(self, key: str, value: str = ..., max_age: Any | None = ..., expires: Any | None = ...,
|
||||||
|
path: str = ..., domain: str | None = ..., secure: bool = ..., httponly: bool = ...,
|
||||||
|
samesite: str | None = ..., cookie_type: str = ...) -> None: ...
|
||||||
|
|
||||||
class DisableCacheMiddleware:
|
class FutureResponse:
|
||||||
app: Callable
|
charset: str
|
||||||
def __init__(self, app: Callable) -> None: ...
|
max_cookie_size: int
|
||||||
def __call__(self, environ: dict, start_response: Callable): ...
|
headers: Headers
|
||||||
|
|
||||||
class Root:
|
|
||||||
_loaded: bool
|
|
||||||
def __init__(self) -> None: ...
|
def __init__(self) -> None: ...
|
||||||
|
def set_cookie(self, key: str, value: str = ..., max_age: Any | None = ..., expires: Any | None = ...,
|
||||||
|
path: str = ..., domain: str | None = ..., secure: bool = ..., httponly: bool = ...,
|
||||||
|
samesite: str | None = ..., cookie_type: str = ...) -> None: ...
|
||||||
|
|
||||||
|
class Request:
|
||||||
|
httprequest: werkzeug.Request
|
||||||
|
future_response: FutureResponse | None
|
||||||
|
dispatcher: Dispatcher
|
||||||
|
registry: Registry | None
|
||||||
|
session: Session
|
||||||
|
db: str | None
|
||||||
|
env: Environment | None
|
||||||
|
website: 'odoo.model.website'
|
||||||
|
lang: 'odoo.model.res_lang'
|
||||||
|
def __init__(self, httprequest: werkzeug.Request) -> None: ...
|
||||||
|
def _get_session_and_dbname(self) -> tuple[Session, str]: ...
|
||||||
|
def update_env(self, user: 'odoo.model.res_users | int | None' = ..., context: dict[str, Any] | None = ...,
|
||||||
|
su: bool | None = ...) -> None: ...
|
||||||
|
def update_context(self, **overrides) -> None: ...
|
||||||
@property
|
@property
|
||||||
def session_store(self) -> sessions.FilesystemSessionStore: ...
|
def context(self) -> dict[str, Any]: ...
|
||||||
|
@context.setter
|
||||||
|
def context(self, value) -> None: ...
|
||||||
|
@property
|
||||||
|
def uid(self) -> int: ...
|
||||||
|
@uid.setter
|
||||||
|
def uid(self, value) -> None: ...
|
||||||
|
@property
|
||||||
|
def cr(self) -> Cursor: ...
|
||||||
|
@cr.setter
|
||||||
|
def cr(self, value) -> None: ...
|
||||||
|
_cr: Cursor
|
||||||
|
@property
|
||||||
|
def geoip(self) -> dict[str, Any]: ...
|
||||||
|
def csrf_token(self, time_limit: int | None = ...) -> str: ...
|
||||||
|
def validate_csrf(self, csrf: str) -> bool: ...
|
||||||
|
def default_context(self) -> dict: ...
|
||||||
|
def default_lang(self) -> str: ...
|
||||||
|
def _geoip_resolve(self) -> dict[str, Any]: ...
|
||||||
|
def get_http_params(self) -> dict: ...
|
||||||
|
def get_json_data(self): ...
|
||||||
|
def _get_profiler_context_manager(self) -> Profiler | nullcontext: ...
|
||||||
|
def _inject_future_response(self, response: werkzeug.Response): ...
|
||||||
|
def make_response(self, data: str, headers: list[tuple[str, Any]] | None = ..., cookies: Mapping | None = ...,
|
||||||
|
status: int = ...) -> Response: ...
|
||||||
|
def make_json_response(self, data, headers: list[tuple[str, Any]] | None = ..., cookies: Mapping | None = ...,
|
||||||
|
status: int = ...) -> Response: ...
|
||||||
|
def not_found(self, description: str | None = ...) -> NotFound: ...
|
||||||
|
def redirect(self, location: URL | str, code: int = ..., local: bool = ...) -> werkzeug.Response: ...
|
||||||
|
def redirect_query(self, location: str, query: Mapping[str, str] | Iterable[tuple[str, str]] | None = ...,
|
||||||
|
code: int = ..., local: bool = ...) -> werkzeug.Response: ...
|
||||||
|
def render(self, template: str, qcontext: dict | None = ..., lazy: bool = ..., **kw): ...
|
||||||
|
def _save_session(self) -> None: ...
|
||||||
|
def _set_request_dispatcher(self, rule: Rule) -> None: ...
|
||||||
|
def _serve_static(self) -> werkzeug.Response: ...
|
||||||
|
def _serve_nodb(self): ...
|
||||||
|
def _serve_db(self): ...
|
||||||
|
params: dict
|
||||||
|
def _serve_ir_http(self): ...
|
||||||
|
|
||||||
|
_dispatchers: dict[str, type[Dispatcher]]
|
||||||
|
|
||||||
|
class Dispatcher(ABC):
|
||||||
|
routing_type: str
|
||||||
|
@classmethod
|
||||||
|
def __init_subclass__(cls) -> None: ...
|
||||||
|
request: Request
|
||||||
|
def __init__(self, request: Request) -> None: ...
|
||||||
|
@classmethod
|
||||||
|
@abstractmethod
|
||||||
|
def is_compatible_with(cls, request: Request) -> bool: ...
|
||||||
|
def pre_dispatch(self, rule: Rule, args) -> None: ...
|
||||||
|
@abstractmethod
|
||||||
|
def dispatch(self, endpoint, args): ...
|
||||||
|
def post_dispatch(self, response: werkzeug.Response) -> None: ...
|
||||||
|
@abstractmethod
|
||||||
|
def handle_error(self, exc: Exception): ...
|
||||||
|
|
||||||
|
class HttpDispatcher(Dispatcher):
|
||||||
|
routing_type: str
|
||||||
|
@classmethod
|
||||||
|
def is_compatible_with(cls, request: Request) -> Literal[True]: ...
|
||||||
|
def dispatch(self, endpoint, args): ...
|
||||||
|
def handle_error(self, exc: Exception): ...
|
||||||
|
|
||||||
|
class JsonRPCDispatcher(Dispatcher):
|
||||||
|
routing_type: str
|
||||||
|
jsonrequest: dict
|
||||||
|
def __init__(self, request: Request) -> None: ...
|
||||||
|
@classmethod
|
||||||
|
def is_compatible_with(cls, request: Request) -> bool: ...
|
||||||
|
def dispatch(self, endpoint, args): ...
|
||||||
|
def handle_error(self, exc: Exception) -> Response: ...
|
||||||
|
def _response(self, result: Any | None = ..., error: Any | None = ...) -> Response: ...
|
||||||
|
|
||||||
|
class Application:
|
||||||
|
@property
|
||||||
|
def statics(self) -> dict[str, str]: ...
|
||||||
|
def get_static_file(self, url: str, host: str = ...) -> str | None: ...
|
||||||
@property
|
@property
|
||||||
def nodb_routing_map(self) -> Map: ...
|
def nodb_routing_map(self) -> Map: ...
|
||||||
def __call__(self, environ: dict, start_response: Callable): ...
|
@property
|
||||||
def load_addons(self) -> None: ...
|
def session_store(self) -> FilesystemSessionStore: ...
|
||||||
def setup_session(self, httprequest: werkzeug.Request) -> bool: ...
|
@property
|
||||||
def setup_db(self, httprequest: werkzeug.Request) -> None: ...
|
def geoip_resolver(self) -> GeoIPResolver | None: ...
|
||||||
def setup_lang(self, httprequest: werkzeug.Request) -> None: ...
|
def get_db_router(self, db: str): ...
|
||||||
def get_request(self, httprequest: werkzeug.Request) -> HttpRequest | JsonRequest: ...
|
|
||||||
def get_response(self, httprequest: werkzeug.Request, result, explicit_session: bool) -> Any: ...
|
|
||||||
def set_csp(self, response: werkzeug.Response) -> None: ...
|
def set_csp(self, response: werkzeug.Response) -> None: ...
|
||||||
def dispatch(self, environ: dict, start_response: Callable): ...
|
def __call__(self, environ: dict, start_response: Callable): ...
|
||||||
def get_profiler_context_manager(self, request: WebRequest): ...
|
|
||||||
def get_db_router(self, db: str) -> Map: ...
|
|
||||||
|
|
||||||
def db_list(force: bool = ..., httprequest: werkzeug.Request | None = ...) -> list[str]: ...
|
root: Application
|
||||||
def db_filter(dbs, httprequest: werkzeug.Request | None = ...) -> list[str]: ...
|
|
||||||
def db_monodb(httprequest: werkzeug.Request | None = ...) -> str | None: ...
|
|
||||||
def send_file(filepath_or_fp, mimetype: str | None = ..., as_attachment: bool = ..., filename: str | None = ..., mtime: Any | None = ..., add_etags: bool = ..., cache_timeout: int =..., conditional: bool = ...) -> Response: ...
|
|
||||||
def content_disposition(filename: str) -> str: ...
|
|
||||||
def set_safe_image_headers(headers, content): ...
|
|
||||||
|
|
||||||
root: Root
|
|
||||||
|
|||||||
Reference in New Issue
Block a user