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:
@@ -4,6 +4,8 @@ from collections.abc import MutableMapping
|
||||
from contextlib import nullcontext
|
||||
from typing import Any, Callable, Generator, Iterable, Literal, Mapping, Sequence, TypeVar
|
||||
|
||||
import geoip2.database
|
||||
import geoip2.models
|
||||
import werkzeug
|
||||
from werkzeug.datastructures import Headers
|
||||
from werkzeug.exceptions import NotFound
|
||||
@@ -17,7 +19,6 @@ from .models import BaseModel
|
||||
from .modules.registry import Registry
|
||||
from .sql_db import Cursor
|
||||
from .tools._vendor import sessions
|
||||
from .tools.geoipresolver import GeoIPResolver
|
||||
from .tools.profiler import Profiler
|
||||
|
||||
_T = TypeVar('_T')
|
||||
@@ -30,6 +31,8 @@ DEFAULT_LANG: str
|
||||
|
||||
def get_default_session() -> dict[str, Any]: ...
|
||||
|
||||
GEOIP_EMPTY_COUNTRY: geoip2.models.Country
|
||||
GEOIP_EMPTY_CITY: geoip2.models.City
|
||||
JSON_MIMETYPES: tuple[str, ...]
|
||||
MISSING_CSRF_WARNING: str
|
||||
ROUTING_KEYS: set[str]
|
||||
@@ -119,6 +122,23 @@ class Session(MutableMapping):
|
||||
def logout(self, keep_db: bool = ...) -> None: ...
|
||||
def touch(self) -> None: ...
|
||||
|
||||
class GeoIP(Mapping):
|
||||
ip: str
|
||||
def __init__(self, ip: str) -> None: ...
|
||||
@property
|
||||
def _city_record(self) -> geoip2.models.City: ...
|
||||
@property
|
||||
def _country_record(self) -> geoip2.models.Country: ...
|
||||
@property
|
||||
def country_name(self): ...
|
||||
@property
|
||||
def country_code(self): ...
|
||||
def __getattr__(self, attr): ...
|
||||
def __bool__(self) -> bool: ...
|
||||
def __getitem__(self, item): ...
|
||||
def __iter__(self): ...
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
_request_stack: LocalStack
|
||||
request: Request
|
||||
|
||||
@@ -152,6 +172,7 @@ class Request:
|
||||
httprequest: werkzeug.Request
|
||||
future_response: FutureResponse | None
|
||||
dispatcher: Dispatcher
|
||||
geoip: GeoIP
|
||||
registry: Registry | None
|
||||
session: Session
|
||||
db: str | None
|
||||
@@ -176,13 +197,10 @@ class Request:
|
||||
@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: ...
|
||||
@@ -247,9 +265,10 @@ class Application:
|
||||
def nodb_routing_map(self) -> Map: ...
|
||||
@property
|
||||
def session_store(self) -> FilesystemSessionStore: ...
|
||||
@property
|
||||
def geoip_resolver(self) -> GeoIPResolver | None: ...
|
||||
def get_db_router(self, db: str): ...
|
||||
@property
|
||||
def geoip_city_db(self) -> geoip2.database.Reader: ...
|
||||
def geoip_country_db(self) -> geoip2.database.Reader: ...
|
||||
def set_csp(self, response: werkzeug.Response) -> None: ...
|
||||
def __call__(self, environ: dict, start_response: Callable): ...
|
||||
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
from typing import Any
|
||||
|
||||
class GeoIPResolver:
|
||||
fname: str
|
||||
_db: Any
|
||||
version: int
|
||||
def __init__(self, fname: str) -> None: ...
|
||||
def __del__(self) -> None: ...
|
||||
@classmethod
|
||||
def open(cls, fname: str) -> GeoIPResolver | None: ...
|
||||
def resolve(self, ip: str) -> dict: ...
|
||||
def record_by_addr(self, addr: str) -> dict: ...
|
||||
Reference in New Issue
Block a user