Skip to content

Commit

Permalink
Do not add type: ignore to imports
Browse files Browse the repository at this point in the history
  • Loading branch information
artem.golovin committed Nov 13, 2024
1 parent 7a145b5 commit 0ca88eb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions alembic_postgresql_enum/operations/sync_enum_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ def is_column_type_import_needed(self) -> bool:
@alembic.autogenerate.render.renderers.dispatch_for(SyncEnumValuesOp)
def render_sync_enum_value_op(autogen_context: AutogenContext, op: SyncEnumValuesOp):
if op.is_column_type_import_needed:
autogen_context.imports.add("from alembic_postgresql_enum import ColumnType # type: ignore[attr-defined]")
autogen_context.imports.add("from alembic_postgresql_enum import TableReference # type: ignore[attr-defined]")
autogen_context.imports.add("from alembic_postgresql_enum import ColumnType")
autogen_context.imports.add("from alembic_postgresql_enum import TableReference")

return (
f"op.sync_enum_values({op.schema!r}, {op.name!r}, {op.new_values!r}, # type: ignore[attr-defined]\n"
Expand Down
4 changes: 2 additions & 2 deletions tests/sync_enum_values/test_array_column.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ def test_add_new_enum_value_render_with_array(connection: "Connection"):
autogenerate._render_migration_diffs(context, template_args)

assert template_args["imports"] == (
"from alembic_postgresql_enum import ColumnType # type: ignore[attr-defined]"
"\nfrom alembic_postgresql_enum import TableReference # type: ignore[attr-defined]"
"from alembic_postgresql_enum import ColumnType"
"\nfrom alembic_postgresql_enum import TableReference"
)

assert (
Expand Down

0 comments on commit 0ca88eb

Please sign in to comment.