Skip to content

Commit ed52f68

Browse files
kasiumAlexWaygood
andauthored
Add stubs for flask-migrate (#8967)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
1 parent e1aa4d5 commit ed52f68

File tree

3 files changed

+109
-0
lines changed

3 files changed

+109
-0
lines changed

pyrightconfig.stricter.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"stubs/cryptography",
3232
"stubs/dateparser",
3333
"stubs/docutils",
34+
"stubs/Flask-Migrate",
3435
"stubs/Flask-SQLAlchemy",
3536
"stubs/fpdf2",
3637
"stubs/html5lib",

stubs/Flask-Migrate/METADATA.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
version = "4.0.*"
2+
requires = ["types-Flask-SQLAlchemy"]
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
from collections.abc import Callable, Iterable, Sequence
2+
from logging import Logger
3+
from typing import Any, TypeVar
4+
from typing_extensions import ParamSpec, TypeAlias
5+
6+
from flask_sqlalchemy import SQLAlchemy
7+
8+
_T = TypeVar("_T")
9+
_P = ParamSpec("_P")
10+
_App: TypeAlias = Any # flask.Flask is not possible as a dependency yet
11+
_ConfigureCallback: TypeAlias = Callable[[Config], Config]
12+
13+
alembic_version: tuple[int, int, int]
14+
log: Logger
15+
16+
class Config: # should inherit from alembic.config.Config which is not possible yet
17+
template_directory: str | None
18+
def __init__(self, *args, **kwargs) -> None: ...
19+
def get_template_directory(self) -> str: ...
20+
21+
class Migrate:
22+
configure_callbacks: list[_ConfigureCallback]
23+
db: SQLAlchemy | None
24+
directory: str
25+
alembic_ctx_kwargs: dict[str, Any]
26+
def __init__(
27+
self,
28+
app: _App | None = ...,
29+
db: SQLAlchemy | None = ...,
30+
directory: str = ...,
31+
command: str = ...,
32+
compare_type: bool = ...,
33+
render_as_batch: bool = ...,
34+
**kwargs,
35+
) -> None: ...
36+
def init_app(
37+
self,
38+
app: _App,
39+
db: SQLAlchemy | None = ...,
40+
directory: str | None = ...,
41+
command: str | None = ...,
42+
compare_type: bool | None = ...,
43+
render_as_batch: bool | None = ...,
44+
**kwargs,
45+
) -> None: ...
46+
def configure(self, f: _ConfigureCallback) -> _ConfigureCallback: ...
47+
def call_configure_callbacks(self, config: Config): ...
48+
def get_config(
49+
self, directory: str | None = ..., x_arg: str | Sequence[str] | None = ..., opts: Iterable[str] | None = ...
50+
): ...
51+
52+
def catch_errors(f: Callable[_P, _T]) -> Callable[_P, _T]: ...
53+
def list_templates() -> None: ...
54+
def init(directory: str | None = ..., multidb: bool = ..., template: str | None = ..., package: bool = ...) -> None: ...
55+
def revision(
56+
directory: str | None = ...,
57+
message: str | None = ...,
58+
autogenerate: bool = ...,
59+
sql: bool = ...,
60+
head: str = ...,
61+
splice: bool = ...,
62+
branch_label: str | None = ...,
63+
version_path: str | None = ...,
64+
rev_id: str | None = ...,
65+
) -> None: ...
66+
def migrate(
67+
directory: str | None = ...,
68+
message: str | None = ...,
69+
sql: bool = ...,
70+
head: str = ...,
71+
splice: bool = ...,
72+
branch_label: str | None = ...,
73+
version_path: str | None = ...,
74+
rev_id: str | None = ...,
75+
x_arg: str | Sequence[str] | None = ...,
76+
) -> None: ...
77+
def edit(directory: str | None = ..., revision: str = ...) -> None: ...
78+
def merge(
79+
directory: str | None = ...,
80+
revisions: str = ...,
81+
message: str | None = ...,
82+
branch_label: str | None = ...,
83+
rev_id: str | None = ...,
84+
) -> None: ...
85+
def upgrade(
86+
directory: str | None = ...,
87+
revision: str = ...,
88+
sql: bool = ...,
89+
tag: str | None = ...,
90+
x_arg: str | Sequence[str] | None = ...,
91+
) -> None: ...
92+
def downgrade(
93+
directory: str | None = ...,
94+
revision: str = ...,
95+
sql: bool = ...,
96+
tag: str | None = ...,
97+
x_arg: str | Sequence[str] | None = ...,
98+
) -> None: ...
99+
def show(directory: str | None = ..., revision: str = ...) -> None: ...
100+
def history(
101+
directory: str | None = ..., rev_range: str | None = ..., verbose: bool = ..., indicate_current: bool = ...
102+
) -> None: ...
103+
def heads(directory: str | None = ..., verbose: bool = ..., resolve_dependencies: bool = ...) -> None: ...
104+
def branches(directory: str | None = ..., verbose: bool = ...) -> None: ...
105+
def current(directory: str | None = ..., verbose: bool = ...) -> None: ...
106+
def stamp(directory: str | None = ..., revision: str = ..., sql: bool = ..., tag: str | None = ...) -> None: ...

0 commit comments

Comments
 (0)