Remove all "WPS" codes

This commit is contained in:
Alexander Hess 2026-11-28 02:01:12 +01:00
commit 9fcb3c8c14
Signed by: alexander
GPG key ID: B46EDB4DFC26805D
4 changed files with 171 additions and 254 deletions

View file

@ -21,9 +21,9 @@ log_config.fileConfig(context.config.config_file_name)
def include_object(obj, _name, type_, _reflected, _compare_to):
"""Only include the clean schema into --autogenerate migrations."""
if ( # noqa:WPS337
if (
type_ in {'table', 'column'}
and hasattr(obj, 'schema') # noqa:WPS421 => fix for rare edge case
and hasattr(obj, 'schema') # => fix for rare edge case
and obj.schema != velofy_config.CLEAN_SCHEMA
):
return False

View file

@ -38,7 +38,7 @@ def upgrade():
sa.Column('initial_zoom', sa.SmallInteger(), nullable=False),
sa.PrimaryKeyConstraint('id', name=op.f('pk_cities')),
*(
[ # noqa:WPS504
[
sa.ForeignKeyConstraint(
['id'],
[f'{config.ORIGINAL_SCHEMA}.cities.id'],
@ -83,7 +83,7 @@ def upgrade():
),
sa.PrimaryKeyConstraint('id', name=op.f('pk_couriers')),
*(
[ # noqa:WPS504
[
sa.ForeignKeyConstraint(
['id'],
[f'{config.ORIGINAL_SCHEMA}.couriers.id'],
@ -148,7 +148,7 @@ def upgrade():
),
sa.PrimaryKeyConstraint('id', name=op.f('pk_addresses')),
*(
[ # noqa:WPS504
[
sa.ForeignKeyConstraint(
['id'],
[f'{config.ORIGINAL_SCHEMA}.addresses.id'],
@ -210,7 +210,7 @@ def upgrade():
),
sa.PrimaryKeyConstraint('id', name=op.f('pk_restaurants')),
*(
[ # noqa:WPS504
[
sa.ForeignKeyConstraint(
['id'],
[f'{config.ORIGINAL_SCHEMA}.businesses.id'],
@ -628,7 +628,7 @@ def upgrade():
),
sa.PrimaryKeyConstraint('id', name=op.f('pk_orders')),
*(
[ # noqa:WPS504
[
sa.ForeignKeyConstraint(
['id'],
[f'{config.ORIGINAL_SCHEMA}.orders.id'],

View file

@ -31,7 +31,7 @@ def upgrade():
TO
train_horizon;
""",
) # noqa:WPS355
)
def downgrade():
@ -45,4 +45,4 @@ def downgrade():
TO
training_horizon;
""",
) # noqa:WPS355
)

View file

@ -29,7 +29,7 @@ def upgrade():
ALTER TABLE {config.CLEAN_SCHEMA}.orders
DROP CONSTRAINT ck_orders_on_ordered_timestamps_21;
""",
) # noqa:WPS355
)
# Add forgotten check constraints to the `orders` table.
op.execute(
@ -38,7 +38,7 @@ def upgrade():
ADD CONSTRAINT check_orders_on_ordered_timestamps_placed_at_before_pickup_at
CHECK (placed_at < pickup_at);
""",
) # noqa:WPS355
)
op.execute(
f"""
ALTER TABLE {config.CLEAN_SCHEMA}.orders
@ -55,7 +55,7 @@ def upgrade():
)
);
""",
) # noqa:WPS355
)
# This `UniqueConstraint` is needed by the `replayed_orders` table below.
op.create_unique_constraint(
@ -403,17 +403,17 @@ def downgrade():
ALTER TABLE {config.CLEAN_SCHEMA}.orders
DROP CONSTRAINT check_orders_on_scheduled_orders_must_be_at_quarters_of_an_hour;
""",
) # noqa:WPS355
)
op.execute(
f"""
ALTER TABLE {config.CLEAN_SCHEMA}.orders
DROP CONSTRAINT check_orders_on_ordered_timestamps_placed_at_before_pickup_at;
""",
) # noqa:WPS355
)
op.execute(
f"""
ALTER TABLE {config.CLEAN_SCHEMA}.orders
ADD CONSTRAINT ck_orders_on_ordered_timestamps_21
CHECK (cancelled_at > delivery_at);
""",
) # noqa:WPS355
)