Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid D103 linter warnings via script.py.mako #1568

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions alembic/templates/async/script.py.mako
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ depends_on: Union[str, Sequence[str], None] = ${repr(depends_on)}


def upgrade() -> None:
"""Upgrade schema."""
${upgrades if upgrades else "pass"}


def downgrade() -> None:
"""Downgrade schema."""
${downgrades if downgrades else "pass"}
2 changes: 2 additions & 0 deletions alembic/templates/generic/script.py.mako
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ depends_on: Union[str, Sequence[str], None] = ${repr(depends_on)}


def upgrade() -> None:
"""Upgrade schema."""
${upgrades if upgrades else "pass"}


def downgrade() -> None:
"""Downgrade schema."""
${downgrades if downgrades else "pass"}
4 changes: 4 additions & 0 deletions alembic/templates/multidb/script.py.mako
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ depends_on: Union[str, Sequence[str], None] = ${repr(depends_on)}


def upgrade(engine_name: str) -> None:
"""Upgrade schema."""
globals()["upgrade_%s" % engine_name]()


def downgrade(engine_name: str) -> None:
"""Downgrade schema."""
globals()["downgrade_%s" % engine_name]()

<%
Expand All @@ -38,10 +40,12 @@ def downgrade(engine_name: str) -> None:
% for db_name in re.split(r',\s*', db_names):

def upgrade_${db_name}() -> None:
"""Upgrade ${db_name} schema."""
${context.get("%s_upgrades" % db_name, "pass")}


def downgrade_${db_name}() -> None:
"""Downgrade ${db_name} schema."""
${context.get("%s_downgrades" % db_name, "pass")}

% endfor
Loading