Update stubs

This commit is contained in:
Trinh Anh Ngoc
2022-10-14 15:06:50 +07:00
parent 8d1cfe9db1
commit 9fcbd64ba6
5 changed files with 86 additions and 69 deletions

View File

@@ -139,6 +139,7 @@ class OpenERPSession(sessions.Session):
def __getattr__(self, attr): ... def __getattr__(self, attr): ...
def __setattr__(self, k, v): ... def __setattr__(self, k, v): ...
pre_uid: int pre_uid: int
uid: int
db: str db: str
login: str | None login: str | None
def authenticate(self, db: str, login: str | None = ..., password: str | None = ...) -> int: ... def authenticate(self, db: str, login: str | None = ..., password: str | None = ...) -> int: ...

View File

@@ -1,5 +1,5 @@
import threading import threading
from collections import deque from collections import defaultdict, deque
from collections.abc import Mapping from collections.abc import Mapping
from threading import RLock from threading import RLock
from typing import Any, Callable, ClassVar, Iterable, Iterator from typing import Any, Callable, ClassVar, Iterable, Iterator
@@ -24,7 +24,7 @@ class Registry(Mapping[str, type[BaseModel]]):
_init: bool _init: bool
_assertion_report: OdooTestResult _assertion_report: OdooTestResult
_fields_by_model: Any _fields_by_model: Any
_ordinary_tables: Any _ordinary_tables: set[str] | None
_constraint_queue: deque _constraint_queue: deque
__cache: LRU __cache: LRU
_init_modules: set[str] _init_modules: set[str]
@@ -39,8 +39,8 @@ 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
registry_sequence: Any registry_sequence: int | None
cache_sequence: Any cache_sequence: int | None
_invalidation_flags: threading.local _invalidation_flags: threading.local
has_unaccent: bool has_unaccent: bool
has_trigram: bool has_trigram: bool
@@ -57,7 +57,7 @@ class Registry(Mapping[str, type[BaseModel]]):
def __delitem__(self, model_name: str) -> None: ... def __delitem__(self, model_name: str) -> None: ...
def descendants(self, model_names: Iterable[str], *kinds) -> set[str]: ... def descendants(self, model_names: Iterable[str], *kinds) -> set[str]: ...
def load(self, cr: Cursor, module: Node) -> set[str]: ... def load(self, cr: Cursor, module: Node) -> set[str]: ...
_m2m: Any _m2m: defaultdict[Any, list]
def setup_models(self, cr: Cursor) -> None: ... def setup_models(self, cr: Cursor) -> None: ...
@property @property
def field_computed(self) -> dict[Field, list[Field]]: ... def field_computed(self) -> dict[Field, list[Field]]: ...

View File

@@ -1,3 +1,8 @@
def check(db, uid, passwd): ... from typing import Literal
def compute_session_token(session, env): ...
def check_session(session, env): ... from ..api import Environment
from ..http import OpenERPSession
def check(db: str, uid: int, passwd: str) -> None: ...
def compute_session_token(session: OpenERPSession, env: Environment) -> str | Literal[False]: ...
def check_session(session: OpenERPSession, env: Environment) -> bool: ...

View File

@@ -1,15 +1,27 @@
import werkzeug.serving from socket import socket as socket_
from ..tests import runner as runner from threading import Semaphore, Thread
from gevent.pywsgi import WSGIServer
from itertools import chain as chain from itertools import chain as chain
from typing import Any from typing import Any, Callable, Iterable, Literal, TypeVar
import werkzeug.serving
from inotify.adapters import InotifyTrees
from psutil import Process
from watchdog.observers import Observer
from ..modules.registry import Registry
from ..sql_db import Cursor
from ..tests import runner as runner
_WorkerT = TypeVar('_WorkerT', bound=Worker)
INOTIFY_LISTEN_EVENTS: Any INOTIFY_LISTEN_EVENTS: Any
_logger: Any
SLEEP_INTERVAL: int SLEEP_INTERVAL: int
def memory_info(process): ... def memory_info(process: Process): ...
def set_limit_memory_hard() -> None: ... def set_limit_memory_hard() -> None: ...
def empty_pipe(fd) -> None: ... def empty_pipe(fd: int) -> None: ...
class LoggingBaseWSGIServerMixIn: class LoggingBaseWSGIServerMixIn:
def handle_error(self, request, client_address) -> None: ... def handle_error(self, request, client_address) -> None: ...
@@ -19,16 +31,15 @@ class BaseWSGIServerNoBind(LoggingBaseWSGIServerMixIn, werkzeug.serving.BaseWSGI
def server_activate(self) -> None: ... def server_activate(self) -> None: ...
class RequestHandler(werkzeug.serving.WSGIRequestHandler): class RequestHandler(werkzeug.serving.WSGIRequestHandler):
timeout: int
def setup(self) -> None: ... def setup(self) -> None: ...
class ThreadedWSGIServerReloadable(LoggingBaseWSGIServerMixIn, werkzeug.serving.ThreadedWSGIServer): class ThreadedWSGIServerReloadable(LoggingBaseWSGIServerMixIn, werkzeug.serving.ThreadedWSGIServer):
max_http_threads: Any max_http_threads: Any
http_threads_sem: Any http_threads_sem: Semaphore
daemon_threads: bool daemon_threads: bool
def __init__(self, host, port, app) -> None: ... def __init__(self, host: str, port: str, app) -> None: ...
reload_socket: bool reload_socket: bool
socket: Any socket: socket_
def server_bind(self) -> None: ... def server_bind(self) -> None: ...
def server_activate(self) -> None: ... def server_activate(self) -> None: ...
def process_request(self, request, client_address) -> None: ... def process_request(self, request, client_address) -> None: ...
@@ -36,10 +47,10 @@ class ThreadedWSGIServerReloadable(LoggingBaseWSGIServerMixIn, werkzeug.serving.
def shutdown_request(self, request) -> None: ... def shutdown_request(self, request) -> None: ...
class FSWatcherBase: class FSWatcherBase:
def handle_file(self, path): ... def handle_file(self, path: str) -> Literal[True]: ...
class FSWatcherWatchdog(FSWatcherBase): class FSWatcherWatchdog(FSWatcherBase):
observer: Any observer: Observer
def __init__(self) -> None: ... def __init__(self) -> None: ...
def dispatch(self, event) -> None: ... def dispatch(self, event) -> None: ...
def start(self) -> None: ... def start(self) -> None: ...
@@ -47,10 +58,10 @@ class FSWatcherWatchdog(FSWatcherBase):
class FSWatcherInotify(FSWatcherBase): class FSWatcherInotify(FSWatcherBase):
started: bool started: bool
watcher: Any watcher: InotifyTrees
def __init__(self) -> None: ... def __init__(self) -> None: ...
def run(self) -> None: ... def run(self) -> None: ...
thread: Any thread: Thread
def start(self) -> None: ... def start(self) -> None: ...
def stop(self) -> None: ... def stop(self) -> None: ...
@@ -84,63 +95,63 @@ class ThreadedServer(CommonServer):
def reload(self) -> None: ... def reload(self) -> None: ...
class GeventServer(CommonServer): class GeventServer(CommonServer):
port: Any port: int
httpd: Any httpd: WSGIServer | None
def __init__(self, app) -> None: ... def __init__(self, app) -> None: ...
def process_limits(self) -> None: ... def process_limits(self) -> None: ...
ppid: Any ppid: int
def watchdog(self, beat: int = ...) -> None: ... def watchdog(self, beat: int = ...) -> None: ...
client_address: Any client_address: Any
def start(self): ... def start(self): ...
def stop(self) -> None: ... def stop(self) -> None: ...
def run(self, preload, stop) -> None: ... def run(self, preload, stop: bool) -> None: ...
class PreforkServer(CommonServer): class PreforkServer(CommonServer):
population: Any population: int
timeout: Any timeout: int
limit_request: Any limit_request: int
cron_timeout: Any cron_timeout: int
beat: int beat: int
socket: Any socket: socket_ | None
workers_http: Any workers_http: dict[int, WorkerHTTP]
workers_cron: Any workers_cron: dict[int, WorkerCron]
workers: Any workers: dict[int, Worker]
generation: int generation: int
queue: Any queue: list
long_polling_pid: Any long_polling_pid: int | None
def __init__(self, app) -> None: ... def __init__(self, app) -> None: ...
def pipe_new(self): ... def pipe_new(self) -> tuple[int, int]: ...
def pipe_ping(self, pipe) -> None: ... def pipe_ping(self, pipe: tuple[int, int]) -> None: ...
def signal_handler(self, sig, frame) -> None: ... def signal_handler(self, sig: int, frame) -> None: ...
def worker_spawn(self, klass, workers_registry): ... def worker_spawn(self, klass: Callable[..., _WorkerT], workers_registry: dict[int, _WorkerT]) -> _WorkerT | None: ...
def long_polling_spawn(self) -> None: ... def long_polling_spawn(self) -> None: ...
def worker_pop(self, pid) -> None: ... def worker_pop(self, pid: int) -> None: ...
def worker_kill(self, pid, sig) -> None: ... def worker_kill(self, pid: int, sig: int) -> None: ...
def process_signals(self) -> None: ... def process_signals(self) -> None: ...
def process_zombie(self) -> None: ... def process_zombie(self) -> None: ...
def process_timeout(self) -> None: ... def process_timeout(self) -> None: ...
def process_spawn(self) -> None: ... def process_spawn(self) -> None: ...
def sleep(self) -> None: ... def sleep(self) -> None: ...
pipe: Any pipe: tuple[int, int]
def start(self) -> None: ... def start(self) -> None: ...
def stop(self, graceful: bool = ...) -> None: ... def stop(self, graceful: bool = ...) -> None: ...
def run(self, preload, stop): ... def run(self, preload, stop: bool): ...
class Worker: class Worker:
multi: Any multi: PreforkServer
watchdog_time: Any watchdog_time: float
watchdog_pipe: Any watchdog_pipe: tuple[int, int]
eintr_pipe: Any eintr_pipe: tuple[int, int]
watchdog_timeout: Any watchdog_timeout: Any
ppid: Any ppid: int
pid: Any pid: int | None
alive: bool alive: bool
request_max: Any request_max: Any
request_count: int request_count: int
def __init__(self, multi) -> None: ... def __init__(self, multi: PreforkServer) -> None: ...
def setproctitle(self, title: str = ...) -> None: ... def setproctitle(self, title: str = ...) -> None: ...
def close(self) -> None: ... def close(self) -> None: ...
def signal_handler(self, sig, frame) -> None: ... def signal_handler(self, sig: int, frame) -> None: ...
def signal_time_expired_handler(self, n, stack) -> None: ... def signal_time_expired_handler(self, n, stack) -> None: ...
def sleep(self) -> None: ... def sleep(self) -> None: ...
def check_limits(self) -> None: ... def check_limits(self) -> None: ...
@@ -151,29 +162,29 @@ class Worker:
def _runloop(self) -> None: ... def _runloop(self) -> None: ...
class WorkerHTTP(Worker): class WorkerHTTP(Worker):
sock_timeout: Any sock_timeout: float
def __init__(self, multi) -> None: ... def __init__(self, multi: PreforkServer) -> None: ...
def process_request(self, client, addr) -> None: ... def process_request(self, client: socket_, addr) -> None: ...
def process_work(self) -> None: ... def process_work(self) -> None: ...
server: Any server: BaseWSGIServerNoBind
def start(self) -> None: ... def start(self) -> None: ...
class WorkerCron(Worker): class WorkerCron(Worker):
db_index: int db_index: int
watchdog_timeout: Any watchdog_timeout: int
def __init__(self, multi) -> None: ... def __init__(self, multi: PreforkServer) -> None: ...
def sleep(self) -> None: ... def sleep(self) -> None: ...
def _db_list(self): ... def _db_list(self): ...
def process_work(self) -> None: ... def process_work(self) -> None: ...
dbcursor: Any dbcursor: Cursor
def start(self) -> None: ... def start(self) -> None: ...
def stop(self) -> None: ... def stop(self) -> None: ...
server: Any server: CommonServer | None
def load_server_wide_modules() -> None: ... def load_server_wide_modules() -> None: ...
def _reexec(updated_modules: Any | None = ...) -> None: ... def _reexec(updated_modules: Iterable[str] | None = ...) -> None: ...
def load_test_file_py(registry, test_file) -> None: ... def load_test_file_py(registry: Registry, test_file: str) -> None: ...
def preload_registries(dbnames): ... def preload_registries(dbnames: list[str] | None): ...
def start(preload: Any | None = ..., stop: bool = ...): ... def start(preload: list[str] | None = ..., stop: bool = ...): ...
def restart() -> None: ... def restart() -> None: ...

View File

@@ -1,16 +1,16 @@
from typing import Any from werkzeug.middleware.proxy_fix import ProxyFix as ProxyFix_
from typing import Callable
_logger: Any
RPC_FAULT_CODE_CLIENT_ERROR: int RPC_FAULT_CODE_CLIENT_ERROR: int
RPC_FAULT_CODE_APPLICATION_ERROR: int RPC_FAULT_CODE_APPLICATION_ERROR: int
RPC_FAULT_CODE_WARNING: int RPC_FAULT_CODE_WARNING: int
RPC_FAULT_CODE_ACCESS_DENIED: int RPC_FAULT_CODE_ACCESS_DENIED: int
RPC_FAULT_CODE_ACCESS_ERROR: int RPC_FAULT_CODE_ACCESS_ERROR: int
def xmlrpc_handle_exception_int(e): ... def xmlrpc_handle_exception_int(e: Exception) -> str: ...
def xmlrpc_handle_exception_string(e): ... def xmlrpc_handle_exception_string(e: Exception) -> str: ...
def application_unproxied(environ, start_response): ... def application_unproxied(environ, start_response): ...
ProxyFix: Any ProxyFix: Callable[..., ProxyFix_]
def application(environ, start_response): ... def application(environ, start_response): ...