Skip to content

Commit

Permalink
Fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
maver1ck committed Oct 31, 2024
1 parent 0dc0bda commit a2723c0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
6 changes: 3 additions & 3 deletions alembic/ddl/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,9 @@
from sqlalchemy.sql import Executable
from sqlalchemy.sql.elements import ColumnElement
from sqlalchemy.sql.elements import quoted_name
from sqlalchemy.sql.schema import Column
from sqlalchemy.sql.schema import Constraint
from sqlalchemy.sql.schema import ForeignKeyConstraint
from sqlalchemy.sql.schema import Index
from sqlalchemy.sql.schema import Table
from sqlalchemy.sql.schema import UniqueConstraint
from sqlalchemy.sql.selectable import TableClause
from sqlalchemy.sql.type_api import TypeEngine
Expand Down Expand Up @@ -141,7 +139,9 @@ def static_output(self, text: str) -> None:
self.output_buffer.write(text + "\n\n")
self.output_buffer.flush()

def version_table_impl(self, version_table, version_table_schema, version_table_pk):
def version_table_impl(
self, version_table, version_table_schema, version_table_pk
) -> Table:
"""create the Table object for the version_table.
Provided as part of impl so that third party dialects can override
Expand Down
5 changes: 3 additions & 2 deletions alembic/runtime/migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

from sqlalchemy import Column
from sqlalchemy import literal_column
from sqlalchemy import select
from sqlalchemy.engine import Engine
from sqlalchemy.engine import url as sqla_url
from sqlalchemy.engine.strategies import MockEngineStrategy
Expand Down Expand Up @@ -531,7 +530,9 @@ def get_current_heads(self) -> Tuple[str, ...]:
return ()
assert self.connection is not None
return tuple(
row[0] for row in self.connection.execute(select(self._version.c.version_num))
row[0] for row in self.connection.execute(
self._version.select().with_only_columns(
self._version.c.version_num))
)

def _ensure_version_table(self, purge: bool = False) -> None:
Expand Down
10 changes: 5 additions & 5 deletions tests/test_version_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
)




def _up(from_, to_, branch_presence_changed=False):
return migration.StampStep(from_, to_, True, branch_presence_changed)

Expand Down Expand Up @@ -385,7 +383,9 @@ class CustomVersionTableTest(TestMigrationContext):

class MyDialectImpl(impl.DefaultImpl):

def version_table_impl(self, version_table, version_table_schema, version_table_pk):
def version_table_impl(
self, version_table, version_table_schema, version_table_pk
):
vt = Table(
version_table,
MetaData(),
Expand All @@ -401,9 +401,9 @@ def version_table_impl(self, version_table, version_table_schema, version_table_
)
return vt


def setUp(self):
# nasty hack to get the sqlite dialect to use our custom dialect implementation
# nasty hack to get the sqlite dialect
# to use our custom dialect implementation
impl._impls["sqlite_bak"] = impl._impls["sqlite"]
impl._impls["sqlite"] = self.MyDialectImpl
super().setUp()
Expand Down

0 comments on commit a2723c0

Please sign in to comment.