From 8012e016f0b420a241610daf1c24723893c2d5d9 Mon Sep 17 00:00:00 2001 From: Trinh Anh Ngoc Date: Tue, 9 Nov 2021 21:50:12 +0700 Subject: [PATCH] Update stubs --- odoo-stubs/__init__.pyi | 4 ++-- odoo-stubs/api.pyi | 25 ++++++++++++------------- odoo-stubs/http.pyi | 5 +++-- odoo-stubs/models.pyi | 1 + odoo-stubs/sql_db.pyi | 3 ++- 5 files changed, 20 insertions(+), 18 deletions(-) diff --git a/odoo-stubs/__init__.pyi b/odoo-stubs/__init__.pyi index d6768e6..a741ded 100644 --- a/odoo-stubs/__init__.pyi +++ b/odoo-stubs/__init__.pyi @@ -1,6 +1,6 @@ from . import api as api, fields as fields, models as models -from odoo.modules.registry import Registry -from odoo.tools.translate import _ as _ +from .modules.registry import Registry +from .tools.translate import _ as _ from typing import Any evented: bool diff --git a/odoo-stubs/api.pyi b/odoo-stubs/api.pyi index 54a6672..b0f3c81 100644 --- a/odoo-stubs/api.pyi +++ b/odoo-stubs/api.pyi @@ -1,7 +1,8 @@ from collections import Mapping from typing import Any -from odoo.sql_db import Cursor +from .modules.registry import Registry +from .sql_db import Cursor __all__: Any _logger: Any @@ -55,27 +56,25 @@ class Environment(Mapping): cr: Cursor = ... uid: int = ... context: dict = ... - @classmethod - @property - def envs(cls) -> Environments: ... + envs: Environments = ... @classmethod def manage(cls) -> None: ... @classmethod def reset(cls) -> None: ... - registry: Any + registry: Registry cache: Any _protected: Any dirty: Any - all: Any - def __new__(cls, cr, uid, context) -> Environment: ... - def __contains__(self, model_name): ... + all: Environments + def __new__(cls, cr: Cursor, uid, context) -> Environment: ... + def __contains__(self, model_name) -> bool: ... def __getitem__(self, model_name): ... def __iter__(self): ... - def __len__(self): ... - def __eq__(self, other): ... - def __ne__(self, other): ... - def __hash__(self): ... - def __call__(self, cr: Any | None = ..., user: Any | None = ..., context: Any | None = ...): ... + def __len__(self) -> int: ... + def __eq__(self, other) -> bool: ... + def __ne__(self, other) -> bool: ... + def __hash__(self) -> int: ... + def __call__(self, cr: Cursor | None = ..., user: Any | None = ..., context: Any | None = ...) -> Environment: ... def ref(self, xml_id, raise_if_not_found: bool = ...): ... @property def user(self): diff --git a/odoo-stubs/http.pyi b/odoo-stubs/http.pyi index d8639ea..09add5e 100644 --- a/odoo-stubs/http.pyi +++ b/odoo-stubs/http.pyi @@ -1,7 +1,8 @@ -import werkzeug.wsgi -import werkzeug.contrib.sessions from typing import Any, Union +import werkzeug.contrib.sessions +import werkzeug.wsgi + from .api import Environment from .modules.registry import Registry from .sql_db import Cursor diff --git a/odoo-stubs/models.pyi b/odoo-stubs/models.pyi index 8ca0001..7ac331b 100644 --- a/odoo-stubs/models.pyi +++ b/odoo-stubs/models.pyi @@ -1,5 +1,6 @@ from collections import MutableMapping from typing import Any, Generator, List + from . import api, fields from .api import Environment from .modules.registry import Registry diff --git a/odoo-stubs/sql_db.pyi b/odoo-stubs/sql_db.pyi index 340b672..12090e0 100644 --- a/odoo-stubs/sql_db.pyi +++ b/odoo-stubs/sql_db.pyi @@ -1,6 +1,7 @@ -import psycopg2.extensions from typing import Any +import psycopg2.extensions + _logger: Any types_mapping: Any