From: Mike Bayer Date: Mon, 12 Sep 2016 22:11:44 +0000 (-0400) Subject: The imports in the default script.py.mako are now at the top X-Git-Tag: rel_0_8_8~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dc2aae0374b76ccab8494be6e103d84089bc449b;p=thirdparty%2Fsqlalchemy%2Falembic.git The imports in the default script.py.mako are now at the top so that flake8 editors don't complain by default. PR courtesy Guilherme Mansur. Change-Id: Ie38810df0f36a08b8fdd36f4a6a0ec243515dc34 --- diff --git a/alembic/templates/generic/script.py.mako b/alembic/templates/generic/script.py.mako index 43c09401..8f45a34e 100644 --- a/alembic/templates/generic/script.py.mako +++ b/alembic/templates/generic/script.py.mako @@ -5,6 +5,9 @@ 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)} @@ -12,10 +15,6 @@ 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"} diff --git a/alembic/templates/multidb/script.py.mako b/alembic/templates/multidb/script.py.mako index 09ec497d..c3970a52 100644 --- a/alembic/templates/multidb/script.py.mako +++ b/alembic/templates/multidb/script.py.mako @@ -8,6 +8,9 @@ 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)} @@ -15,9 +18,6 @@ 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]() diff --git a/alembic/templates/pylons/script.py.mako b/alembic/templates/pylons/script.py.mako index 43c09401..2c015630 100644 --- a/alembic/templates/pylons/script.py.mako +++ b/alembic/templates/pylons/script.py.mako @@ -5,6 +5,9 @@ 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)} @@ -12,9 +15,6 @@ 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"} diff --git a/docs/build/changelog.rst b/docs/build/changelog.rst index cd9ce411..5865ef01 100644 --- a/docs/build/changelog.rst +++ b/docs/build/changelog.rst @@ -6,6 +6,13 @@ Changelog .. changelog:: :version: 0.8.8 + .. change:: + :tags: autogenerate + + The imports in the default script.py.mako are now at the top + so that flake8 editors don't complain by default. PR courtesy + Guilherme Mansur. + .. change:: :tags: feature, operations, postgresql :tickets: 292