Created
August 13, 2022 05:14
-
-
Save theY4Kman/5ab21a6be619a953b6e56a75d4f306bb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from _typeshed import Incomplete | |
from collections.abc import Generator | |
from typing import Any, Generic, Type, TypeVar | |
from sqlalchemy.orm.query import Query | |
from sqlalchemy.orm.session import Session | |
from . import utils as utils | |
from .model import DefaultMeta as DefaultMeta, Model as Model | |
models_committed: Any | |
before_models_committed: Any | |
class SignallingSession(Session): | |
app: Any | |
def __init__(self, db, autocommit: bool = ..., autoflush: bool = ..., **options) -> None: ... | |
def get_bind(self, mapper: Any | None = ..., clause: Any | None = ...): ... # type: ignore[override] | |
def get_debug_queries(): ... | |
_M = TypeVar("_M", bound=Model) | |
class BaseQuery(Query[_M]): | |
def get_or_404(self, ident, description: Incomplete | None = ...): ... | |
def first_or_404(self, description: Incomplete | None = ...): ... | |
def paginate( | |
self, | |
page: Incomplete | None = ..., | |
per_page: Incomplete | None = ..., | |
error_out: bool = ..., | |
max_per_page: Incomplete | None = ..., | |
) -> Pagination[_M]: ... | |
class _QueryProperty: | |
sa: SQLAlchemy | |
def __get__(self, obj, type: Type[_M]) -> BaseQuery[_M]: ... | |
class _Model(Model, metaclass=DefaultMeta): | |
query_class: Type[BaseQuery] | |
query: _QueryProperty | |
class Pagination(Generic[_M]): | |
query: BaseQuery[_M] | None | |
page: int | |
per_page: int | |
total: int | None | |
items: Any | |
def __init__(self, query: BaseQuery[_M] | None, page: int, per_page: int, total: int | None, items) -> None: ... | |
@property | |
def pages(self) -> int: ... | |
def prev(self, error_out: bool = ...) -> Pagination[_M]: ... | |
@property | |
def prev_num(self) -> int | None: ... | |
@property | |
def has_prev(self) -> bool: ... | |
def next(self, error_out: bool = ...) -> Pagination[_M]: ... | |
@property | |
def has_next(self) -> bool: ... | |
@property | |
def next_num(self) -> int | None: ... | |
def iter_pages( | |
self, left_edge: int = ..., left_current: int = ..., right_current: int = ..., right_edge: int = ... | |
) -> Generator[int | None, None, None]: ... | |
def get_state(app): ... | |
class SQLAlchemy: | |
Query: Type[Query] | |
use_native_unicode: Any | |
session: Any | |
Model: Type[_Model] | |
app: Any | |
def __init__( | |
self, | |
app: Any | None = ..., | |
use_native_unicode: bool = ..., | |
session_options: Any | None = ..., | |
metadata: Any | None = ..., | |
query_class: Type[Query] | None = ..., | |
model_class: Type[_M] | None = ..., | |
engine_options: Any | None = ..., | |
) -> None: ... | |
@property | |
def metadata(self): ... | |
def create_scoped_session(self, options: Any | None = ...): ... | |
def create_session(self, options): ... | |
def make_declarative_base(self, model, metadata: Any | None = ...) -> DefaultMeta: ... | |
def init_app(self, app): ... | |
def apply_pool_defaults(self, app, options): ... | |
def apply_driver_hacks(self, app, sa_url, options): ... | |
@property | |
def engine(self): ... | |
def make_connector(self, app: Any | None = ..., bind: Any | None = ...): ... | |
def get_engine(self, app: Any | None = ..., bind: Any | None = ...): ... | |
def create_engine(self, sa_url, engine_opts): ... | |
def get_app(self, reference_app: Any | None = ...): ... | |
def get_tables_for_bind(self, bind: Any | None = ...): ... | |
def get_binds(self, app: Any | None = ...): ... | |
def create_all(self, bind: str = ..., app: Any | None = ...) -> None: ... | |
def drop_all(self, bind: str = ..., app: Any | None = ...) -> None: ... | |
def reflect(self, bind: str = ..., app: Any | None = ...) -> None: ... | |
def __getattr__(self, name: str) -> Any: ... # exposes dynamically classes of SQLAlchemy | |
class FSADeprecationWarning(DeprecationWarning): ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from re import Pattern | |
from typing import Any, ClassVar | |
from sqlalchemy import Table | |
from sqlalchemy.ext.declarative import DeclarativeMeta | |
def should_set_tablename(cls: type) -> bool: ... | |
camelcase_re: Pattern[str] | |
def camel_to_snake_case(name: str) -> str: ... | |
class NameMetaMixin(type): | |
def __init__(cls, name: str, bases: tuple[type, ...], d: dict[str, Any]) -> None: ... | |
def __table_cls__(cls, *args, **kwargs) -> Table | None: ... | |
class BindMetaMixin(type): | |
def __init__(cls, name: str, bases: tuple[type, ...], d: dict[str, Any]) -> None: ... | |
class DefaultMeta(NameMetaMixin, BindMetaMixin, DeclarativeMeta): ... | |
class Model: | |
query_class: ClassVar[None] | |
query: ClassVar[None] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def parse_version(v: str) -> tuple[int, int, int]: ... | |
def sqlalchemy_version(op: str, val: str) -> bool: ... | |
def engine_config_warning(config, version: str, deprecated_config_key: str, engine_option) -> None: ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment