mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 04:34:28 +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:
@@ -8,3 +8,9 @@ peewee.DQ.__invert__
|
||||
peewee.Window.as_groups
|
||||
peewee.Window.as_range
|
||||
peewee.Window.as_rows
|
||||
|
||||
# Ignore missing playhouse modules and names we don't currently provide
|
||||
playhouse\.\w+?
|
||||
playhouse.flask_utils.PaginatedQuery
|
||||
playhouse.flask_utils.get_\w+
|
||||
playhouse.flask_utils.object_list
|
||||
|
||||
@@ -1,2 +1,10 @@
|
||||
version = "3.17.3"
|
||||
upstream_repository = "https://github.com/coleifer/peewee"
|
||||
# We're not providing stubs for all playhouse modules right now
|
||||
# https://github.com/python/typeshed/pull/11731#issuecomment-2065729058
|
||||
partial_stub = true
|
||||
|
||||
[tool.stubtest]
|
||||
stubtest_requirements = ["Flask>=2.0.0"]
|
||||
# Using stubtest_allowlist to ignore playhouse modules we don't provide.
|
||||
ignore_missing_stub = false
|
||||
|
||||
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