From: Nathan Louie Date: Tue, 13 Dec 2022 07:15:36 +0000 (-0800) Subject: flake8 fix X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6f87e1ff934e7484a6ee359b8232df8b6c27443d;p=thirdparty%2Fsqlalchemy%2Falembic.git flake8 fix --- diff --git a/alembic/command.py b/alembic/command.py index 76db9b00..c132e46c 100644 --- a/alembic/command.py +++ b/alembic/command.py @@ -19,6 +19,7 @@ if TYPE_CHECKING: log = logging.getLogger(__name__) + def list_templates(config): """List available templates. @@ -245,7 +246,8 @@ def revision( def check( config: "Config", ) -> None: - """Checks if the revision command with autogenerate has pending upgrade ops to run. + """Checks if the revision command with autogenerate has pending upgrade + ops to run. :param config: a :class:`.Config` object. @@ -289,9 +291,11 @@ def check( migration_script = revision_context.generated_revisions[-1] diffs = migration_script.upgrade_ops.as_diffs() if diffs: - raise util.RevisionOpsNotEmptyError(f"Revision has upgrade ops to run: {diffs}.") + raise util.RevisionOpsNotEmptyError( + f"Revision has upgrade ops to run: {diffs}." + ) else: - log.info("Revision has no upgrade ops to run.") + log.info("Revision has no upgrade ops to run.") def merge( diff --git a/alembic/util/exc.py b/alembic/util/exc.py index 15d118b0..533e1a2b 100644 --- a/alembic/util/exc.py +++ b/alembic/util/exc.py @@ -1,5 +1,6 @@ class CommandError(Exception): pass + class RevisionOpsNotEmptyError(Exception): pass diff --git a/tests/test_command.py b/tests/test_command.py index 1a7c13c5..99a3be82 100644 --- a/tests/test_command.py +++ b/tests/test_command.py @@ -8,7 +8,7 @@ import re from typing import cast from sqlalchemy import exc as sqla_exc -from sqlalchemy import VARCHAR, text +from sqlalchemy import text, VARCHAR from sqlalchemy.engine import Engine from sqlalchemy.sql.schema import Column @@ -579,13 +579,14 @@ finally: def test_check_no_changes(self): self._env_fixture() - command.check(self.cfg) # no problem + command.check(self.cfg) # no problem def test_check_changes_detected(self): self._env_fixture() with mock.patch( "alembic.operations.ops.UpgradeOps.as_diffs", - return_value=[('remove_column', None, 'foo', Column('old_data', VARCHAR()))] + return_value=[('remove_column', None, 'foo', + Column('old_data', VARCHAR()))] ): assert_raises_message( util.RevisionOpsNotEmptyError,