Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Update workflows (#5339)

Openverse (Bot)c24aebb28aea
diff --git a/.github/workflows/pr_label_check.yml b/.github/workflows/pr_label_check.yml
index f1cb88514..6d20e5237 100644
--- a/.github/workflows/pr_label_check.yml
+++ b/.github/workflows/pr_label_check.yml
@@ -55,7 +55,7 @@ jobs:
- get_label_groups
steps:
- name: Check goal label
- uses: docker://agilepathway/pull-request-label-checker:v1.6.60
+ uses: docker://agilepathway/pull-request-label-checker:v1.6.61
with:
one_of: ${{ needs.get_label_groups.outputs.goal }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
@@ -68,7 +68,7 @@ jobs:
- get_label_groups
steps:
- name: Check priority label
- uses: docker://agilepathway/pull-request-label-checker:v1.6.60
+ uses: docker://agilepathway/pull-request-label-checker:v1.6.61
with:
one_of: ${{ needs.get_label_groups.outputs.priority }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
@@ -81,7 +81,7 @@ jobs:
- get_label_groups
steps:
- name: Check stack label
- uses: docker://agilepathway/pull-request-label-checker:v1.6.60
+ uses: docker://agilepathway/pull-request-label-checker:v1.6.61
with:
any_of: ${{ needs.get_label_groups.outputs.stack }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml
index c8f0eed5a..0412994a6 100644
--- a/.github/workflows/renovate.yml
+++ b/.github/workflows/renovate.yml
@@ -62,7 +62,7 @@ jobs:
sudo chown -R runneradmin:root /tmp/renovate/
ls -R "$cache_dir"
- - uses: renovatebot/[email protected]
+ - uses: renovatebot/[email protected]
with:
# Renovate recommends _not_ to use any of
# [these names](https://docs.renovatebot.com/configuration-options/).
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 074b2c18e..d4702bb5f 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -46,7 +46,7 @@ repos:
- id: requirements-txt-fixer
- repo: https://github.com/astral-sh/ruff-pre-commit
- rev: v0.8.6
+ rev: v0.9.1
hooks:
- id: ruff # replaces Flake8, isort, pydocstyle, pyupgrade
args:
@@ -154,7 +154,7 @@ repos:
files: (.vale/.*|.mdx?)$
- repo: https://github.com/renovatebot/pre-commit-hooks
- rev: 39.91.3
+ rev: 39.107.2
hooks:
- id: renovate-config-validator
args:
diff --git a/api/api/management/commands/documentmedia.py b/api/api/management/commands/documentmedia.py
index 8c9484620..dd8c55b59 100644
--- a/api/api/management/commands/documentmedia.py
+++ b/api/api/management/commands/documentmedia.py
@@ -225,7 +225,7 @@ def generate_relation_table(
columns = ["Name", "Type", "DB type", "Nature", "To"]
table = "### Relations\n\n"
table += f"|{'|'.join(columns)}|\n"
- table += f"|{'-|'*len(columns)}\n"
+ table += f"|{'-|' * len(columns)}\n"
for relation in relations:
name = f"`{relation.name}`"
if relation.name in noted_fields:
@@ -258,7 +258,7 @@ def generate_value_table(
columns = ["Name", "Type", "DB type", "Constraints", "Default"]
table = "### Values\n\n"
table += f"|{'|'.join(columns)}|\n"
- table += f"|{'-|'*len(columns)}\n"
+ table += f"|{'-|' * len(columns)}\n"
for value in values:
name = f"`{value.name}`"
if value.name in noted_fields:
diff --git a/api/api/management/commands/generatewaveforms.py b/api/api/management/commands/generatewaveforms.py
index 51d39afef..f7ebf2e37 100644
--- a/api/api/management/commands/generatewaveforms.py
+++ b/api/api/management/commands/generatewaveforms.py
@@ -79,7 +79,7 @@ class Command(BaseCommand):
return errored_identifiers
except BaseException as err:
errored_identifiers.append(audio.identifier)
- self.error(f"Unable to process {audio.identifier}: " f"{err}")
+ self.error(f"Unable to process {audio.identifier}: {err}")
progress.update(1)
return errored_identifiers
diff --git a/api/api/models/audio.py b/api/api/models/audio.py
index 02b82263d..c9b4a38a2 100644
--- a/api/api/models/audio.py
+++ b/api/api/models/audio.py
@@ -133,8 +133,7 @@ class AudioAddOn(OpenLedgerModel):
# https://github.com/WordPress/openverse-api/blob/a7955c86d43bff504e8d41454f68717d79dd3a44/api/catalog/api/utils/waveform.py#L71
size=1500,
help_text=(
- "The waveform peaks. A list of floats in"
- " the range of 0 -> 1 inclusively."
+ "The waveform peaks. A list of floats in the range of 0 -> 1 inclusively."
),
null=True,
)
diff --git a/api/api/utils/image_proxy/__init__.py b/api/api/utils/image_proxy/__init__.py
index d130bfd22..14fada4ee 100644
--- a/api/api/utils/image_proxy/__init__.py
+++ b/api/api/utils/image_proxy/__init__.py
@@ -107,7 +107,7 @@ def _tally_response(
with tallies_conn.pipeline() as tallies:
tallies.incr(f"thumbnail_response_code:{month}:{status_code}")
tallies.incr(
- f"thumbnail_response_code_by_domain:{domain}:" f"{month}:{status_code}"
+ f"thumbnail_response_code_by_domain:{domain}:{month}:{status_code}"
)
tallies.incr(
f"thumbnail_response_code_by_provider:{media_info.media_provider}:"
diff --git a/api/test/unit/controllers/test_search_controller.py b/api/test/unit/controllers/test_search_controller.py
index 71c164039..5b63d977d 100644
--- a/api/test/unit/controllers/test_search_controller.py
+++ b/api/test/unit/controllers/test_search_controller.py
@@ -213,9 +213,9 @@ def create_mask_fixture() -> Callable[[Search, int, int], None]:
save_query_mask(query_hash, mask)
return
- assert (
- mask_size >= liveness_count
- ), "Cannot create more live bits than the mask can contain."
+ assert mask_size >= liveness_count, (
+ "Cannot create more live bits than the mask can contain."
+ )
dead_bits = [0] * (mask_size - liveness_count)
live_bits = [1] * liveness_count
mask = dead_bits + live_bits
@@ -420,9 +420,9 @@ def test_paginate_with_dead_link_mask_query_mask_overlaps_query_window(
actual_range = es_helpers._paginate_with_dead_link_mask(
s=unique_search, page_size=page_size, page=page
)
- assert (
- actual_range == expected_range
- ), f"expected {expected_range} but got {actual_range}"
+ assert actual_range == expected_range, (
+ f"expected {expected_range} but got {actual_range}"
+ )
@pytest.mark.parametrize(
diff --git a/api/test/unit/utils/test_help_text.py b/api/test/unit/utils/test_help_text.py
index 5a7e646fc..aed6bb012 100644
--- a/api/test/unit/utils/test_help_text.py
+++ b/api/test/unit/utils/test_help_text.py
@@ -13,8 +13,7 @@ from api.utils.help_text import make_comma_separated_help_text
),
(
["a", "b"],
- "A comma separated list of items; "
- "available items include: `a`, and `b`.",
+ "A comma separated list of items; available items include: `a`, and `b`.",
),
(
["a", "b", "c"],
diff --git a/api/test/unit/utils/test_search_context.py b/api/test/unit/utils/test_search_context.py
index 25b458487..58de5b74e 100644
--- a/api/test/unit/utils/test_search_context.py
+++ b/api/test/unit/utils/test_search_context.py
@@ -58,9 +58,9 @@ def test_sensitive_text(
search_context = SearchContext.build(
result_ids, media_type_config.origin_index
)
- assert (
- mock.total_matches == 0
- ), "There should be zero requests to ES if the setting is disabled"
+ assert mock.total_matches == 0, (
+ "There should be zero requests to ES if the setting is disabled"
+ )
pook.off()
else:
search_context = SearchContext.build(result_ids, media_type_config.origin_index)
diff --git a/catalog/dags/common/licenses/licenses.py b/catalog/dags/common/licenses/licenses.py
index 198b78254..0493b76e1 100644
--- a/catalog/dags/common/licenses/licenses.py
+++ b/catalog/dags/common/licenses/licenses.py
@@ -264,8 +264,7 @@ def _ensure_license_version_is_valid(
logger.debug("license_version is NoneType")
except (TypeError, ValueError) as e:
logger.warning(
- f"Could not recover license_version from {license_version}!"
- f" Error was {e}"
+ f"Could not recover license_version from {license_version}! Error was {e}"
)
return string_license_version
diff --git a/catalog/dags/common/loader/reporting.py b/catalog/dags/common/loader/reporting.py
index c674d0bce..015b66d5e 100644
--- a/catalog/dags/common/loader/reporting.py
+++ b/catalog/dags/common/loader/reporting.py
@@ -55,7 +55,7 @@ def humanize_time_duration(seconds: float | int) -> str:
for unit, div in TIME_DURATION_UNITS:
amount, seconds = divmod(int(seconds), div)
if amount > 0:
- parts.append(f'{amount} {unit}{"" if amount == 1 else "s"}')
+ parts.append(f"{amount} {unit}{'' if amount == 1 else 's'}")
return ", ".join(parts)
@@ -205,7 +205,7 @@ def report_completion(
message = f"""
*DAG*: `{dag_id}`
*Date range*: {date_range}
-*Duration of data pull tasks*: {duration or '_No data_'}
+*Duration of data pull tasks*: {duration or "_No data_"}
*Number of records upserted per media type*:
{media_type_reports}"""
diff --git a/catalog/dags/common/loader/sql.py b/catalog/dags/common/loader/sql.py
index dab820167..441fded27 100644
--- a/catalog/dags/common/loader/sql.py
+++ b/catalog/dags/common/loader/sql.py
@@ -316,9 +316,9 @@ def upsert_records_to_db_table(
upsert_query = dedent(
f"""
INSERT INTO {sql_info.media_table} AS old
- ({col.DIRECT_URL.name}, {', '.join(column_inserts.keys())})
+ ({col.DIRECT_URL.name}, {", ".join(column_inserts.keys())})
SELECT DISTINCT ON ({col.DIRECT_URL.name}) {col.DIRECT_URL.name},
- {', '.join(column_inserts.values())}
+ {", ".join(column_inserts.values())}
FROM {load_table} as new
WHERE NOT EXISTS (
SELECT {col.DIRECT_URL.name} from {sql_info.media_table}
diff --git a/catalog/dags/common/log_cleanup.py b/catalog/dags/common/log_cleanup.py
index c61ab6b04..86df8537f 100644
--- a/catalog/dags/common/log_cleanup.py
+++ b/catalog/dags/common/log_cleanup.py
@@ -167,7 +167,7 @@ if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Log Cleanup Job", add_help=True)
parser.add_argument(
"--maxLogAgeInDays",
- help="Logs older than maxLogAgeInDays days will be deleted. " "Default is 7.",
+ help="Logs older than maxLogAgeInDays days will be deleted. Default is 7.",
)
parser.add_argument(
"--enableDelete",
diff --git a/catalog/dags/common/requester.py b/catalog/dags/common/requester.py
index 5db7dfee7..c36c0b5ee 100644
--- a/catalog/dags/common/requester.py
+++ b/catalog/dags/common/requester.py
@@ -86,7 +86,7 @@ class DelayedRequester:
logger.info(f"{type(e).__name__}: {e}")
if params := request_kwargs.get("params"):
logger.info(f"Using query parameters {params}")
- logger.info(f'Using headers {request_kwargs.get("headers")}')
+ logger.info(f"Using headers {request_kwargs.get('headers')}")
raise
diff --git a/catalog/dags/common/slack.py b/catalog/dags/common/slack.py
index dfe9750b2..25092c49b 100644
--- a/catalog/dags/common/slack.py
+++ b/catalog/dags/common/slack.py
@@ -406,7 +406,7 @@ def on_failure_callback(context: dict) -> None:
message = f"""
*DAG*: `{dag_id}`
*Task*: `{task_id}`
-*Logical Date*: {logical_date.strftime('%Y-%m-%dT%H:%M:%SZ')}
+*Logical Date*: {logical_date.strftime("%Y-%m-%dT%H:%M:%SZ")}
*Log*: <{ti.log_url}|View Logs>
{exception_message}
"""
diff --git a/catalog/dags/data_augmentation/rekognition/add_rekognition_labels_dag.py b/catalog/dags/data_augmentation/rekognition/add_rekognition_labels_dag.py
index 46066e90c..031da933e 100644
--- a/catalog/dags/data_augmentation/rekognition/add_rekognition_labels_dag.py
+++ b/catalog/dags/data_augmentation/rekognition/add_rekognition_labels_dag.py
@@ -70,9 +70,7 @@ def add_rekognition_labels():
icon_emoji=constants.SLACK_ICON,
)
- notify_resume = notify_slack.override(
- task_id=constants.NOTIFY_RESUME_TASK_ID
- )(
+ notify_resume = notify_slack.override(task_id=constants.NOTIFY_RESUME_TASK_ID)(
text="Resuming Rekognition label insertion " # noqa: UP031
"from position: `{{ var.value.%s }}`\n%s"
% (constants.CURRENT_POS_VAR_NAME, constants.TEMPLATE_SLACK_MESSAGE_CONFIG),
diff --git a/catalog/dags/database/batched_update/batched_update_dag.py b/catalog/dags/database/batched_update/batched_update_dag.py
index 9c9009199..0279cd970 100644
--- a/catalog/dags/database/batched_update/batched_update_dag.py
+++ b/catalog/dags/database/batched_update/batched_update_dag.py
@@ -124,8 +124,7 @@ DAG_CONFIG = dict(
default="WHERE...",
type="string",
description=(
- "The `WHERE` clause of a query that selects all the rows to"
- " be updated."
+ "The `WHERE` clause of a query that selects all the rows to be updated."
),
pattern="^WHERE",
),
@@ -173,8 +172,7 @@ DAG_CONFIG = dict(
default=True,
type="boolean",
description=(
- "When True, the SQL commands will not actually be run"
- " but only logged."
+ "When True, the SQL commands will not actually be run but only logged."
),
),
},
diff --git a/catalog/dags/database/delete_records/delete_records_dag.py b/catalog/dags/database/delete_records/delete_records_dag.py
index 62a922074..14e140067 100644
--- a/catalog/dags/database/delete_records/delete_records_dag.py
+++ b/catalog/dags/database/delete_records/delete_records_dag.py
@@ -86,8 +86,7 @@ logger = logging.getLogger(__name__)
default="WHERE...",
type="string",
description=(
- "The `WHERE` clause of a query that selects all the rows to"
- " be deleted."
+ "The `WHERE` clause of a query that selects all the rows to be deleted."
),
pattern="^WHERE",
),
diff --git a/catalog/dags/elasticsearch_cluster/create_new_es_index/create_new_es_index_dag.py b/catalog/dags/elasticsearch_cluster/create_new_es_index/create_new_es_index_dag.py
index 2c1ee6117..55e0f7750 100644
--- a/catalog/dags/elasticsearch_cluster/create_new_es_index/create_new_es_index_dag.py
+++ b/catalog/dags/elasticsearch_cluster/create_new_es_index/create_new_es_index_dag.py
@@ -287,7 +287,7 @@ def create_new_es_index_dag(dag_config: CreateNewIndex):
trigger_rule=TriggerRule.NONE_FAILED
)(
text=(
- f"New index { index_name } was successfully created with alias"
+ f"New index {index_name} was successfully created with alias"
"{{ params.target_alias }}."
),
dag_id=dag.dag_id,
diff --git a/catalog/dags/popularity/sql.py b/catalog/dags/popularity/sql.py
index 4edd024fb..7bd336a44 100644
--- a/catalog/dags/popularity/sql.py
+++ b/catalog/dags/popularity/sql.py
@@ -108,7 +108,7 @@ def update_media_popularity_metrics(
query = dedent(
f"""
INSERT INTO public.{sql_info.metrics_table} (
- {', '.join(column_names)}
+ {", ".join(column_names)}
) VALUES
{popularity_metric_inserts}
ON CONFLICT ({PARTITION})
diff --git a/catalog/dags/providers/provider_api_scripts/provider_data_ingester.py b/catalog/dags/providers/provider_api_scripts/provider_data_ingester.py
index 713b1399d..eb0aa3e09 100644
--- a/catalog/dags/providers/provider_api_scripts/provider_data_ingester.py
+++ b/catalog/dags/providers/provider_api_scripts/provider_data_ingester.py
@@ -393,8 +393,7 @@ class ProviderDataIngester(ABC):
[f"{e.query_params}" for e in self.ingestion_errors]
)
logger.info(
- "The following query_params resulted in errors: \n"
- f"{bad_query_params}"
+ f"The following query_params resulted in errors: \n{bad_query_params}"
)
errors_str = "\n".join(
e.repr_with_traceback() for e in self.ingestion_errors
diff --git a/catalog/tests/dags/common/loader/test_reporting.py b/catalog/tests/dags/common/loader/test_reporting.py
index 5f4e06861..7c5d482dc 100644
--- a/catalog/tests/dags/common/loader/test_reporting.py
+++ b/catalog/tests/dags/common/loader/test_reporting.py
@@ -213,14 +213,14 @@ def test_report_completion_contents(
# Assert that if we were supposed to skip or alert missing records, we did not
# get this far
assert not should_skip, "Completion was reported when it should have skipped."
- assert (
- not should_alert_missing_records
- ), "Completion was reported instead of alerting missing records."
+ assert not should_alert_missing_records, (
+ "Completion was reported instead of alerting missing records."
+ )
for expected in [audio_expected, image_expected]:
- assert (
- expected in message
- ), "Completion message doesn't contain expected text"
+ assert expected in message, (
+ "Completion message doesn't contain expected text"
+ )
# Split message into "sections"
parts = message.strip().split("\n")
@@ -282,9 +282,9 @@ def test_report_completion_contents_with_lists(
return
for expected in [audio_expected, image_expected]:
- assert (
- expected in message
- ), "Completion message doesn't contain expected text"
+ assert expected in message, (
+ "Completion message doesn't contain expected text"
+ )
# Split message into "sections"
parts = message.strip().split("\n")
# Get the date section
diff --git a/catalog/tests/dags/common/loader/test_sql.py b/catalog/tests/dags/common/loader/test_sql.py
index 8652d071b..b94acba5a 100644
--- a/catalog/tests/dags/common/loader/test_sql.py
+++ b/catalog/tests/dags/common/loader/test_sql.py
@@ -309,7 +309,7 @@ def test_loaders_delete_null_foreign_landing_url_rows(
# Check that rows with null foreign landing urls were deleted
foreign_landing_url_check = (
- f"SELECT COUNT (*) FROM {load_table} " f"WHERE foreign_landing_url IS NULL;"
+ f"SELECT COUNT (*) FROM {load_table} WHERE foreign_landing_url IS NULL;"
)
postgres_with_load_table.cursor.execute(foreign_landing_url_check)
null_foreign_landing_url_num_rows = postgres_with_load_table.cursor.fetchone()[0]
@@ -346,7 +346,7 @@ def test_data_loaders_delete_null_foreign_identifier_rows(
# Check that rows with null foreign identifiers were deleted
foreign_identifier_check = (
- f"SELECT COUNT (*) FROM {load_table} " f"WHERE foreign_identifier IS NULL;"
+ f"SELECT COUNT (*) FROM {load_table} WHERE foreign_identifier IS NULL;"
)
postgres_with_load_table.cursor.execute(foreign_identifier_check)
null_foreign_identifier_num_rows = postgres_with_load_table.cursor.fetchone()[0]
@@ -383,7 +383,7 @@ def test_import_data_deletes_duplicate_foreign_identifier_rows(
# Check that rows with duplicate foreign ids were deleted
foreign_id_duplicate_check = (
- f"SELECT COUNT (*) FROM {load_table} " f"WHERE foreign_identifier='135257';"
+ f"SELECT COUNT (*) FROM {load_table} WHERE foreign_identifier='135257';"
)
postgres_with_load_table.cursor.execute(foreign_id_duplicate_check)
foreign_id_duplicate_num_rows = postgres_with_load_table.cursor.fetchone()[0]
@@ -1639,7 +1639,7 @@ def test_drop_load_table_drops_table(postgres_with_load_table, load_table, ident
postgres_conn_id = POSTGRES_CONN_ID
sql.drop_load_table(postgres_conn_id, identifier)
check_query = (
- f"SELECT EXISTS (" f"SELECT FROM pg_tables WHERE tablename='{load_table}');"
+ f"SELECT EXISTS (SELECT FROM pg_tables WHERE tablename='{load_table}');"
)
postgres_with_load_table.cursor.execute(check_query)
check_result = postgres_with_load_table.cursor.fetchone()[0]
diff --git a/catalog/tests/dags/database/test_report_pending_reported_media.py b/catalog/tests/dags/database/test_report_pending_reported_media.py
index 9e7c2ca72..df3f636e7 100644
--- a/catalog/tests/dags/database/test_report_pending_reported_media.py
+++ b/catalog/tests/dags/database/test_report_pending_reported_media.py
@@ -45,9 +45,9 @@ def test_report_actionable_records(
report_actionable_records(report_counts_by_media_type)
for message in audio_expected_messages + image_expected_messages:
- assert (
- message in send_alert_mock.call_args.args[0]
- ), "Completion message doesn't contain expected text"
+ assert message in send_alert_mock.call_args.args[0], (
+ "Completion message doesn't contain expected text"
+ )
def test_report_actionable_records_no_data_message():
diff --git a/catalog/tests/dags/providers/provider_api_scripts/resources/metropolitan_museum_of_art/read_met_csv.py b/catalog/tests/dags/providers/provider_api_scripts/resources/metropolitan_museum_of_art/read_met_csv.py
index 7bc90be2e..0f2732b99 100644
--- a/catalog/tests/dags/providers/provider_api_scripts/resources/metropolitan_museum_of_art/read_met_csv.py
+++ b/catalog/tests/dags/providers/provider_api_scripts/resources/metropolitan_museum_of_art/read_met_csv.py
@@ -119,7 +119,9 @@ for c in raw_data.columns:
elif m > 0:
example = max(raw_data[raw_data[c].isna()].index)
sample_cases.add(example)
- print(f"{c} is missing {int(100.0*m/total_records)}% of values, see {example}")
+ print(
+ f"{c} is missing {int(100.0 * m / total_records)}% of values, see {example}"
+ )
else:
print(f"{c} is never missing.")
diff --git a/catalog/tests/dags/providers/provider_api_scripts/test_europeana.py b/catalog/tests/dags/providers/provider_api_scripts/test_europeana.py
index b76b802a6..4309c4fb1 100644
--- a/catalog/tests/dags/providers/provider_api_scripts/test_europeana.py
+++ b/catalog/tests/dags/providers/provider_api_scripts/test_europeana.py
@@ -190,7 +190,7 @@ def test_record_builder_get_record_data(ingester, record_builder):
assert record_data == {
"foreign_landing_url": (
- "http://bibliotecadigital.jcyl.es/i18n/consulta/registro.cmd?" "id=26229"
+ "http://bibliotecadigital.jcyl.es/i18n/consulta/registro.cmd?id=26229"
),
"url": (
"http://bibliotecadigital.jcyl.es/i18n/catalogo_imagenes"
diff --git a/catalog/tests/dags/providers/provider_api_scripts/test_flickr.py b/catalog/tests/dags/providers/provider_api_scripts/test_flickr.py
index 63f6982a0..6bef437f6 100644
--- a/catalog/tests/dags/providers/provider_api_scripts/test_flickr.py
+++ b/catalog/tests/dags/providers/provider_api_scripts/test_flickr.py
@@ -156,7 +156,7 @@ def test_get_record_data():
expected_data = {
"foreign_landing_url": "https://www.flickr.com/photos/71925535@N03/49514824541",
- "url": ("https://live.staticflickr.com/65535/49514824541_35d1b4f8db" "_b.jpg"),
+ "url": ("https://live.staticflickr.com/65535/49514824541_35d1b4f8db_b.jpg"),
"license_info": test_license_info,
"foreign_identifier": "49514824541",
"width": 1024,
@@ -344,7 +344,7 @@ def test_get_record_data_with_sub_provider():
"foreign_landing_url": (
"https://www.flickr.com/photos/35067687@N04/49950595947"
),
- "url": ("https://live.staticflickr.com/65535/49950595947_65a3560ddc" "_b.jpg"),
+ "url": ("https://live.staticflickr.com/65535/49950595947_65a3560ddc_b.jpg"),
"license_info": test_license_info,
"foreign_identifier": "49950595947",
"width": 1024,
diff --git a/catalog/tests/dags/providers/provider_api_scripts/test_wikimedia_commons.py b/catalog/tests/dags/providers/provider_api_scripts/test_wikimedia_commons.py
index 32bf43761..92055602a 100644
--- a/catalog/tests/dags/providers/provider_api_scripts/test_wikimedia_commons.py
+++ b/catalog/tests/dags/providers/provider_api_scripts/test_wikimedia_commons.py
@@ -313,7 +313,7 @@ def test_get_record_data_handles_example_dict(wmc):
"categories": [
"Coasts of Ploz\u00e9vet",
"No QIC by usr:PtrQs",
- "Photographs taken with Minolta AF Zoom " "28-70mm F2.8 G",
+ "Photographs taken with Minolta AF Zoom 28-70mm F2.8 G",
"Self-published work",
"Taken with Sony DSLR-A900",
"Trees in Finist\u00e8re",
diff --git a/catalog/tests/dags/test_dag_parsing.py b/catalog/tests/dags/test_dag_parsing.py
index b4446326c..b21bef2f0 100644
--- a/catalog/tests/dags/test_dag_parsing.py
+++ b/catalog/tests/dags/test_dag_parsing.py
@@ -77,9 +77,9 @@ def test_dag_import_errors():
dag_errors.append(Path(filename).name)
error_string = ",".join(dag_errors)
- assert (
- len(dagbag.import_errors) == 0
- ), f"Errors found during DAG import for files: {error_string}"
+ assert len(dagbag.import_errors) == 0, (
+ f"Errors found during DAG import for files: {error_string}"
+ )
all_paths = {str(dag.relative_fileloc) for dag in dagbag.dags.values()}
missing_paths = all_paths - set(DAG_PATHS)
@@ -115,6 +115,6 @@ def test_dag_uses_default_args():
if on_failure_callback is None:
failures.append(dag_id)
- assert (
- not failures
- ), f"The following DAGs do not have DAG_DEFAULT_ARGS defined: {failures}"
+ assert not failures, (
+ f"The following DAGs do not have DAG_DEFAULT_ARGS defined: {failures}"
+ )
diff --git a/catalog/tests/factories/github/__init__.py b/catalog/tests/factories/github/__init__.py
index 451d70a6a..8e37a0658 100644
--- a/catalog/tests/factories/github/__init__.py
+++ b/catalog/tests/factories/github/__init__.py
@@ -128,7 +128,7 @@ def make_pr_comment(
comment["user"]["login"] = "openverse-bot"
comment["body"] = (
- ("This is a comment\n" f"{COMMENT_MARKER}\n\n" "Please review me :)")
+ (f"This is a comment\n{COMMENT_MARKER}\n\nPlease review me :)")
if is_reminder
else (
"This looks great! Amazing work :tada: "
diff --git a/catalog/tests/utilities/media_props_gen/test_column_parser.py b/catalog/tests/utilities/media_props_gen/test_column_parser.py
index 754b10979..a53eb4726 100644
--- a/catalog/tests/utilities/media_props_gen/test_column_parser.py
+++ b/catalog/tests/utilities/media_props_gen/test_column_parser.py
@@ -24,7 +24,7 @@ from utilities.media_props_gen.helpers.column_parser import (
pytest.param(
{"name": "id", "db_name": "user_id", "python_type": "IntegerColumn"},
True,
- f'{COLUMN_DEFINITIONS["IntegerColumn"]} '
+ f"{COLUMN_DEFINITIONS['IntegerColumn']} "
f'(`name="id", upsert_strategy=newest_non_null, nullable=True, required=False`)',
id="name and db_name are different",
),
@@ -61,9 +61,9 @@ from utilities.media_props_gen.helpers.column_parser import (
)
def test_column(init_args, expected_nullable, expected_str):
column = Column(**init_args)
- assert (
- column.nullable == expected_nullable
- ), "Nullable attribute did not match expected value"
- assert (
- str(column) == expected_str
- ), "__str__ representation did not match expected value"
+ assert column.nullable == expected_nullable, (
+ "Nullable attribute did not match expected value"
+ )
+ assert str(column) == expected_str, (
+ "__str__ representation did not match expected value"
+ )
diff --git a/catalog/utilities/media_props_gen/generate_media_properties.py b/catalog/utilities/media_props_gen/generate_media_properties.py
index 73e35af87..071c4a607 100644
--- a/catalog/utilities/media_props_gen/generate_media_properties.py
+++ b/catalog/utilities/media_props_gen/generate_media_properties.py
@@ -69,9 +69,7 @@ def generate_media_props_table(media_properties) -> str:
for field_name, field in media_properties.items():
name, db_properties = generate_db_props_string(field["sql"])
- table += (
- f"| {name} | {db_properties} | " f"{field.get('python_column', '')} |\n"
- )
+ table += f"| {name} | {db_properties} | {field.get('python_column', '')} |\n"
return table
@@ -145,7 +143,7 @@ def generate_markdown_doc() -> str:
{Md.heading(2, "Image Properties")}{tables["image"]}
{Md.heading(2, "Audio Properties")}{tables["audio"]}
{Md.heading(2, "Media Property Descriptions")}{long_form_doc}
-{Md.horizontal_line + POSTAMBLE if POSTAMBLE else ''}
+{Md.horizontal_line + POSTAMBLE if POSTAMBLE else ""}
""".strip()
+ "\n"
)
diff --git a/docker/dev_env/exec.py b/docker/dev_env/exec.py
index cf0c7806c..d94f9af9c 100644
--- a/docker/dev_env/exec.py
+++ b/docker/dev_env/exec.py
@@ -70,9 +70,9 @@ def alias_info(aliases: dict, args: list[str]):
joined = " ".join(cmd)
output += dedent(
f"""
- {alias}{' ' * (longest_alias - len(alias))} -> {joined}
+ {alias}{" " * (longest_alias - len(alias))} -> {joined}
{doc}
- {'(Built-in alias)' if alias in SHARED_ALIASES else '(Personal alias)'}
+ {"(Built-in alias)" if alias in SHARED_ALIASES else "(Personal alias)"}
"""
)
diff --git a/indexer_worker/indexer_worker/queries.py b/indexer_worker/indexer_worker/queries.py
index cb57ef779..f58eebb0e 100644
--- a/indexer_worker/indexer_worker/queries.py
+++ b/indexer_worker/indexer_worker/queries.py
@@ -15,7 +15,7 @@ def get_existence_queries(model_name: str, table_name: str) -> tuple[SQL, SQL]:
table_name: the name of the media table to check entries in
"""
exists_in_table = (
- "EXISTS(SELECT 1 FROM {table} " "WHERE identifier = {identifier}) AS {name}"
+ "EXISTS(SELECT 1 FROM {table} WHERE identifier = {identifier}) AS {name}"
)
exists_in_deleted_table = SQL(exists_in_table).format(
table=Identifier(f"api_deleted{model_name}"),
diff --git a/ingestion_server/ingestion_server/cleanup.py b/ingestion_server/ingestion_server/cleanup.py
index b5bdea2f1..59238993b 100644
--- a/ingestion_server/ingestion_server/cleanup.py
+++ b/ingestion_server/ingestion_server/cleanup.py
@@ -272,7 +272,7 @@ def _clean_data_worker(rows, temp_table, sources_config, all_fields: list[str]):
if len(update_field_expressions) > 0:
update_query = f"""UPDATE {temp_table} SET
- {', '.join(update_field_expressions)} WHERE id = {_id}
+ {", ".join(update_field_expressions)} WHERE id = {_id}
"""
log.debug(f"Executing update query: \n\t{update_query}")
write_cur.execute(update_query)
diff --git a/ingestion_server/ingestion_server/indexer.py b/ingestion_server/ingestion_server/indexer.py
index 7ff92955c..f13b04e1c 100644
--- a/ingestion_server/ingestion_server/indexer.py
+++ b/ingestion_server/ingestion_server/indexer.py
@@ -64,9 +64,7 @@ def get_last_item_ids(table):
pg_conn.set_session(readonly=True)
cur = pg_conn.cursor()
# Find the last row added to the database table
- query = SQL(
- "SELECT id, identifier " "FROM {table} " "ORDER BY id DESC " "LIMIT 1;"
- ).format(
+ query = SQL("SELECT id, identifier FROM {table} ORDER BY id DESC LIMIT 1;").format(
table=Identifier(table),
)
cur.execute(query)
diff --git a/ingestion_server/ingestion_server/queries.py b/ingestion_server/ingestion_server/queries.py
index 8c367db3b..803fa0e4e 100644
--- a/ingestion_server/ingestion_server/queries.py
+++ b/ingestion_server/ingestion_server/queries.py
@@ -23,7 +23,7 @@ def get_existence_queries(model: str, table: str = None) -> tuple[SQL, SQL]:
table = model # By default, tables are named after the model.
exists_in_table = (
- "EXISTS(SELECT 1 FROM {table} " "WHERE identifier = {identifier}) AS {name}"
+ "EXISTS(SELECT 1 FROM {table} WHERE identifier = {identifier}) AS {name}"
)
exists_in_deleted_table = SQL(exists_in_table).format(
table=Identifier(f"api_deleted{model}"),
diff --git a/ingestion_server/test/integration_test.py b/ingestion_server/test/integration_test.py
index 91cafd750..d74235de3 100644
--- a/ingestion_server/test/integration_test.py
+++ b/ingestion_server/test/integration_test.py
@@ -257,12 +257,12 @@ def _ingest_upstream(cb_queue, downstream_db, model, suffix="integration"):
# Check that the indices remained the same
after_indices = _get_indices(downstream_db, model)
after_constraints = _get_constraints(downstream_db, model)
- assert (
- before_indices == after_indices
- ), "Indices in DB don't match the names they had before the go-live"
- assert (
- before_constraints == after_constraints
- ), "Constraints in DB don't match the names they had before the go-live"
+ assert before_indices == after_indices, (
+ "Indices in DB don't match the names they had before the go-live"
+ )
+ assert before_constraints == after_constraints, (
+ "Constraints in DB don't match the names they had before the go-live"
+ )
@pytest.fixture()
@@ -599,9 +599,9 @@ def test_filtered_indexes(sample_es, sensitive_term, index):
}
res = es.search(index=index, query=query)
count = res["hits"]["total"]["value"]
- assert (
- count == 0
- ), f"There should be no results that exactly match {sensitive_term} in {index}. Found {count}."
+ assert count == 0, (
+ f"There should be no results that exactly match {sensitive_term} in {index}. Found {count}."
+ )
@pytest.mark.order(after="test_upstream_indexed_audio")
diff --git a/ingestion_server/test/unit_tests/test_distributed_reindex_scheduler.py b/ingestion_server/test/unit_tests/test_distributed_reindex_scheduler.py
index 6c2805ff4..7ad6bdc8a 100644
--- a/ingestion_server/test/unit_tests/test_distributed_reindex_scheduler.py
+++ b/ingestion_server/test/unit_tests/test_distributed_reindex_scheduler.py
@@ -24,9 +24,9 @@ from ingestion_server import distributed_reindex_scheduler
)
def test_assign_work(estimated_records, record_limit, workers, expected_ranges):
# Checks for the parameters
- assert len(workers) == len(
- expected_ranges
- ), "Number of workers and expected ranges do not match, correct the test parameters"
+ assert len(workers) == len(expected_ranges), (
+ "Number of workers and expected ranges do not match, correct the test parameters"
+ )
# Set up database mock response
mock_db = mock.MagicMock()
mock_db.cursor.return_value.__enter__.return_value.fetchone.return_value = [