Skip to content

Commit

Permalink
Imports at top of file as specified by Flake8 and added branch label.
Browse files Browse the repository at this point in the history
Moving the imports to the top of the file will prevent an error:
'E402 module level import not at top of file'.
  • Loading branch information
MaicoTimmerman committed Nov 13, 2016
1 parent 9eec677 commit c95c201
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions flask_migrate/templates/flask-multidb/script.py.mako
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ Revises: ${down_revision | comma,n}
Create Date: ${create_date}

"""
from alembic import op
import sqlalchemy as sa
${imports if imports else ""}

# revision identifiers, used by Alembic.
revision = ${repr(up_revision)}
down_revision = ${repr(down_revision)}
branch_labels = ${repr(branch_labels)}
depends_on = ${repr(depends_on)}

from alembic import op
import sqlalchemy as sa
${imports if imports else ""}

def upgrade(engine_name):
globals()["upgrade_%s" % engine_name]()
Expand Down
10 changes: 6 additions & 4 deletions flask_migrate/templates/flask/script.py.mako
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
"""${message}

Revision ID: ${up_revision}
Revises: ${down_revision}
Revises: ${down_revision | comma,n}
Create Date: ${create_date}

"""
from alembic import op
import sqlalchemy as sa
${imports if imports else ""}

# revision identifiers, used by Alembic.
revision = ${repr(up_revision)}
down_revision = ${repr(down_revision)}
branch_labels = ${repr(branch_labels)}
depends_on = ${repr(depends_on)}

from alembic import op
import sqlalchemy as sa
${imports if imports else ""}

def upgrade():
${upgrades if upgrades else "pass"}
Expand Down

0 comments on commit c95c201

Please sign in to comment.