Update stubs

This commit is contained in:
Trinh Anh Ngoc
2023-10-03 15:54:38 +07:00
parent 5023971a96
commit f2cfefe170
4 changed files with 39 additions and 16 deletions

View File

@@ -407,6 +407,7 @@ class BaseModel(metaclass=MetaModel):
self: _ModelT, new: _ModelT, excluded: Container[str] = ...
) -> None: ...
def copy(self: _ModelT, default: dict[str, Any] | None = ...) -> _ModelT: ...
def copy_multi(self: _ModelT, default: dict[str, Any] | None = ...) -> _ModelT: ...
def exists(self: _ModelT) -> _ModelT: ...
def _check_recursion(self, parent: str | None = ...) -> bool: ...
def _check_m2m_recursion(self, field_name: str) -> bool: ...

View File

@@ -59,6 +59,7 @@ class Cursor(BaseCursor):
def dictfetchmany(self, size) -> list[dict[str, Any]]: ...
def dictfetchall(self) -> list[dict[str, Any]]: ...
def __del__(self) -> None: ...
def mogrify(self, query, params: Any | None = ...) -> str: ...
def execute(self, query, params: Any | None = ..., log_exceptions: bool = ...): ...
def execute_values(
self,

View File

@@ -1,17 +1,23 @@
from re import Pattern
from typing import Iterable, Iterator
from ..sql_db import Cursor
IDENT_RE: Pattern
from . import SQL
class Query:
order: str | None
limit: int | None
offset: int | None
def __init__(self, cr: Cursor, alias: str, table: str | None = ...) -> None: ...
def add_table(self, alias: str, table: str | None = ...) -> None: ...
def add_where(self, where_clause: str, where_params: Iterable = ...) -> None: ...
def __init__(
self, cr: Cursor, alias: str, table: str | SQL | None = ...
) -> None: ...
def make_alias(self, alias: str, link: str) -> str: ...
def add_table(self, alias: str, table: str | SQL | None = ...) -> None: ...
def add_join(
self, kind: str, alias: str, table: str | SQL | None, condition: SQL
) -> None: ...
def add_where(
self, where_clause: str | SQL, where_params: Iterable = ...
) -> None: ...
def join(
self,
lhs_alias: str,
@@ -19,8 +25,6 @@ class Query:
rhs_table: str,
rhs_column: str,
link: str,
extra: str | None = ...,
extra_params: tuple = ...,
) -> str: ...
def left_join(
self,
@@ -29,19 +33,19 @@ class Query:
rhs_table: str,
rhs_column: str,
link: str,
extra: str | None = ...,
extra_params: tuple = ...,
) -> str: ...
def select(self, *args) -> tuple[str, list]: ...
def subselect(self, *args) -> tuple[str, list]: ...
@property
def table(self) -> str: ...
@property
def from_clause(self) -> SQL: ...
@property
def where_clause(self) -> SQL: ...
def is_empty(self) -> bool: ...
def select(self, *args: str | SQL) -> SQL: ...
def subselect(self, *args: str | SQL) -> SQL: ...
def get_sql(self) -> tuple[str, str, list]: ...
def get_result_ids(self) -> tuple[int, ...]: ...
def set_result_ids(self, ids, ordered: bool = ...) -> None: ...
def __bool__(self) -> bool: ...
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[int]: ...
@property
def where_clause(self) -> tuple[str, ...]: ...
@property
def where_clause_params(self) -> tuple: ...

View File

@@ -1,10 +1,27 @@
import enum
from collections import defaultdict
from re import Pattern
from typing import Iterable, Literal
from ..models import BaseModel
from ..sql_db import Cursor
IDENT_RE: Pattern
class SQL:
def __new__(cls, code: str | SQL = ..., *args) -> SQL: ...
@property
def code(self) -> str: ...
@property
def params(self) -> list: ...
def __repr__(self) -> str: ...
def __bool__(self) -> bool: ...
def __eq__(self, other) -> bool: ...
def __iter__(self): ...
def join(self, args: Iterable) -> SQL: ...
@classmethod
def identifier(cls, name: str, subname: str | None = ...) -> SQL: ...
def existing_tables(cr: Cursor, tablenames: Iterable[str]) -> list[str]: ...
def table_exists(cr: Cursor, tablename: str) -> bool: ...