Skip to content

Commit b56c74a

Browse files
committed
Add typing and linting to alembic/
1 parent 364938d commit b56c74a

File tree

5 files changed

+16
-26
lines changed

5 files changed

+16
-26
lines changed

.pre-commit-config.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ repos:
4343
entry: poetry run pylint --rcfile=.python-lint
4444
language: system
4545
types: ['python']
46-
exclude: ^alembic/
4746
- id: flake8
4847
name: Flake8
4948
entry: poetry run flake8
@@ -61,7 +60,6 @@ repos:
6160
language: system
6261
types: ['python']
6362
exclude: (?x)(
64-
alembic|
6563
tests|
6664
scripts
6765
)

alembic/env.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
"""Configuration for Alembic migrations."""
2+
13
from logging.config import fileConfig
2-
from typing import Any, Literal, Optional
4+
from typing import Literal, Optional
35

46
from sqlalchemy import engine_from_config, pool
57
from sqlalchemy.sql.schema import SchemaItem
@@ -8,6 +10,10 @@
810
from rctab.crud.models import metadata
911
from rctab.settings import Settings
1012

13+
# pylint: disable=unused-argument
14+
# pylint: disable=no-member
15+
# pylint: disable=redefined-builtin
16+
1117
settings = Settings()
1218
# this is the Alembic Config object, which provides
1319
# access to the values within the .ini file in use.
@@ -41,10 +47,7 @@ def include_object(
4147
reflected: bool,
4248
compare_to: Optional[SchemaItem],
4349
) -> bool:
44-
"""
45-
Exclude views from Alembic's consideration.
46-
"""
47-
50+
"""Exclude views from Alembic's consideration."""
4851
if object.info:
4952
if object.info.get("is_view", False):
5053
return False

alembic/versions/b65796c99771_squash.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Squash
1+
"""Squash (previous migrations).
22
33
Revision ID: b65796c99771
44
Revises:
@@ -12,6 +12,9 @@
1212

1313
from alembic import op
1414

15+
# pylint: disable=no-member
16+
# pylint: disable=invalid-name
17+
1518
# revision identifiers, used by Alembic.
1619
revision = "b65796c99771"
1720
down_revision = None
@@ -68,6 +71,7 @@ class FinanceHistorySql:
6871

6972

7073
def upgrade() -> None:
74+
"""Upgrade the database."""
7175
op.execute(text("create schema accounting"))
7276
op.create_table(
7377
"user_cache",
@@ -487,6 +491,7 @@ def upgrade() -> None:
487491

488492

489493
def downgrade() -> None:
494+
"""Downgrade the database."""
490495
op.drop_table("cost_recovery", schema="accounting")
491496
op.execute(
492497
"DROP MATERIALIZED VIEW {schema}.usage_view;".format(schema="accounting")

poetry.lock

Lines changed: 1 addition & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ authors = []
66

77
[tool.poetry.dependencies]
88
python = ">=3.10 <3.12"
9-
alembic = "^1.7.1"
9+
alembic = "^1.13.2"
1010
anyio = "^4.4.0" # only pinned to satisfy safety warning on <=4.3.0
1111
asyncpg = "^0.27.0"
1212
azure-identity = "^1.16.0"
@@ -56,7 +56,6 @@ pytest-asyncio = "^0.14.0"
5656
pytest-cov = "^2.10.1"
5757
pytest-mock = "^3.6.1"
5858
safety = "^3.1.0"
59-
sqlalchemy-stubs = "^0.3"
6059
types-requests = "^2.32.0.20240602"
6160

6261
[tool.poetry.extras]

0 commit comments

Comments
 (0)