Skip to content

Commit

Permalink
fix flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
luolingchun committed Jul 21, 2023
1 parent 1c1187e commit 8a37e13
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
8 changes: 4 additions & 4 deletions src/flask_migrate/templates/aioflask-multidb/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ def process_revision_directives(context, revision, directives):
directives[:] = []
logger.info('No changes in schema detected.')

configure_args = current_app.extensions['migrate'].configure_args
if configure_args.get("process_revision_directives") is None:
configure_args["process_revision_directives"] = process_revision_directives
conf_args = current_app.extensions['migrate'].configure_args
if conf_args.get("process_revision_directives") is None:
conf_args["process_revision_directives"] = process_revision_directives

for name, rec in engines.items():
rec['sync_connection'] = conn = rec['connection']._sync_connection()
Expand All @@ -150,7 +150,7 @@ def process_revision_directives(context, revision, directives):
upgrade_token="%s_upgrades" % name,
downgrade_token="%s_downgrades" % name,
target_metadata=get_metadata(name),
**configure_args
**conf_args
)
context.run_migrations(engine_name=name)

Expand Down
8 changes: 4 additions & 4 deletions src/flask_migrate/templates/aioflask/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,14 @@ def process_revision_directives(context, revision, directives):
directives[:] = []
logger.info('No changes in schema detected.')

configure_args = current_app.extensions['migrate'].configure_args
if configure_args.get("process_revision_directives") is None:
configure_args["process_revision_directives"] = process_revision_directives
conf_args = current_app.extensions['migrate'].configure_args
if conf_args.get("process_revision_directives") is None:
conf_args["process_revision_directives"] = process_revision_directives

context.configure(
connection=connection,
target_metadata=get_metadata(),
**configure_args
**conf_args
)

with context.begin_transaction():
Expand Down
8 changes: 4 additions & 4 deletions src/flask_migrate/templates/flask-multidb/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ def process_revision_directives(context, revision, directives):
directives[:] = []
logger.info('No changes in schema detected.')

configure_args = current_app.extensions['migrate'].configure_args
if configure_args.get("process_revision_directives") is None:
configure_args["process_revision_directives"] = process_revision_directives
conf_args = current_app.extensions['migrate'].configure_args
if conf_args.get("process_revision_directives") is None:
conf_args["process_revision_directives"] = process_revision_directives

# for the direct-to-DB use case, start a transaction on all
# engines, then run all migrations, then commit all transactions.
Expand Down Expand Up @@ -166,7 +166,7 @@ def process_revision_directives(context, revision, directives):
upgrade_token="%s_upgrades" % name,
downgrade_token="%s_downgrades" % name,
target_metadata=get_metadata(name),
**configure_args
**conf_args
)
context.run_migrations(engine_name=name)

Expand Down
8 changes: 4 additions & 4 deletions src/flask_migrate/templates/flask/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,17 @@ def process_revision_directives(context, revision, directives):
directives[:] = []
logger.info('No changes in schema detected.')

configure_args = current_app.extensions['migrate'].configure_args
if configure_args.get("process_revision_directives") is None:
configure_args["process_revision_directives"] = process_revision_directives
conf_args = current_app.extensions['migrate'].configure_args
if conf_args.get("process_revision_directives") is None:
conf_args["process_revision_directives"] = process_revision_directives

connectable = get_engine()

with connectable.connect() as connection:
context.configure(
connection=connection,
target_metadata=get_metadata(),
**configure_args
**conf_args
)

with context.begin_transaction():
Expand Down
8 changes: 4 additions & 4 deletions tests/custom_template/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,17 @@ def process_revision_directives(context, revision, directives):
directives[:] = []
logger.info('No changes in schema detected.')

configure_args = current_app.extensions['migrate'].configure_args
if configure_args.get("process_revision_directives") is None:
configure_args["process_revision_directives"] = process_revision_directives
conf_args = current_app.extensions['migrate'].configure_args
if conf_args.get("process_revision_directives") is None:
conf_args["process_revision_directives"] = process_revision_directives

connectable = current_app.extensions['migrate'].db.get_engine()

with connectable.connect() as connection:
context.configure(
connection=connection,
target_metadata=target_metadata,
**configure_args
**conf_args
)

with context.begin_transaction():
Expand Down

0 comments on commit 8a37e13

Please sign in to comment.