mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-02 09:33:25 +08:00
Add peewee playhouse.flask_utils stubs (#11731)
Co-authored-by: Avasam <samuel.06@hotmail.com> Co-authored-by: Alex Waygood <alex.waygood@gmail.com>
This commit is contained in:
0
stubs/peewee/playhouse/__init__.pyi
Normal file
0
stubs/peewee/playhouse/__init__.pyi
Normal file
28
stubs/peewee/playhouse/flask_utils.pyi
Normal file
28
stubs/peewee/playhouse/flask_utils.pyi
Normal file
@@ -0,0 +1,28 @@
|
||||
from _typeshed import Unused
|
||||
from collections.abc import Container
|
||||
from typing import Any
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from peewee import Database, ModelBase, Proxy
|
||||
|
||||
# Is actually flask.Flask
|
||||
_Flask: TypeAlias = Any
|
||||
|
||||
class FlaskDB:
|
||||
# Omitting undocumented base_model_class on purpose, use FlaskDB.Model instead
|
||||
database: Database | Proxy
|
||||
def __init__(
|
||||
self,
|
||||
app: _Flask | None = None,
|
||||
database: Database | Proxy | None = None,
|
||||
# Is actually type[ModelClass] but stubtest likely confuses with Model property
|
||||
# https://github.com/python/typeshed/pull/11731#issuecomment-2067694259
|
||||
model_class=...,
|
||||
excluded_routes: Container[str] | None = None,
|
||||
) -> None: ...
|
||||
def init_app(self, app: _Flask) -> None: ...
|
||||
def get_model_class(self) -> type[ModelBase]: ...
|
||||
@property
|
||||
def Model(self) -> type[ModelBase]: ...
|
||||
def connect_db(self) -> None: ...
|
||||
def close_db(self, exc: Unused) -> None: ...
|
||||
Reference in New Issue
Block a user