Skip to content

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

Update workflows (#3858)

Openverse (Bot)331b576ad8dd
diff --git a/.github/workflows/pr_label_check.yml b/.github/workflows/pr_label_check.yml
index abcee295f..ec07a9d73 100644
--- a/.github/workflows/pr_label_check.yml
+++ b/.github/workflows/pr_label_check.yml
@@ -42,7 +42,7 @@ jobs:
- get_label_groups
steps:
- name: Check aspect label
- uses: docker://agilepathway/pull-request-label-checker:v1.6.20
+ uses: docker://agilepathway/pull-request-label-checker:v1.6.23
with:
any_of: ${{ needs.get_label_groups.outputs.aspect }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
@@ -55,7 +55,7 @@ jobs:
- get_label_groups
steps:
- name: Check goal label
- uses: docker://agilepathway/pull-request-label-checker:v1.6.20
+ uses: docker://agilepathway/pull-request-label-checker:v1.6.23
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.20
+ uses: docker://agilepathway/pull-request-label-checker:v1.6.23
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.20
+ uses: docker://agilepathway/pull-request-label-checker:v1.6.23
with:
any_of: ${{ needs.get_label_groups.outputs.stack }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index dc6a456f9..81b2c97da 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.2.0
+ rev: v0.3.0
hooks:
- id: ruff # replaces Flake8, isort, pydocstyle, pyupgrade
args:
@@ -74,7 +74,7 @@ repos:
- id: shfmt-docker
- repo: https://github.com/rhysd/actionlint
- rev: v1.6.26
+ rev: v1.6.27
hooks:
- id: actionlint-docker
@@ -153,7 +153,7 @@ repos:
files: (.vale/.*|.mdx?)$
- repo: https://github.com/renovatebot/pre-commit-hooks
- rev: 37.168.1
+ rev: 37.221.1
hooks:
- id: renovate-config-validator
args:
diff --git a/api/api/constants/media_types.py b/api/api/constants/media_types.py
index ae97bbd3e..a1b0f71f4 100644
--- a/api/api/constants/media_types.py
+++ b/api/api/constants/media_types.py
@@ -1,4 +1,5 @@
"""Also see `ingestion_server/constants/media_types.py`."""
+
from typing import Literal
diff --git a/api/api/utils/aiohttp.py b/api/api/utils/aiohttp.py
index 2d1905a36..339f9db0b 100644
--- a/api/api/utils/aiohttp.py
+++ b/api/api/utils/aiohttp.py
@@ -14,9 +14,9 @@ _SESSIONS: weakref.WeakKeyDictionary[
asyncio.AbstractEventLoop, aiohttp.ClientSession
] = weakref.WeakKeyDictionary()
-_LOCKS: weakref.WeakKeyDictionary[
- asyncio.AbstractEventLoop, asyncio.Lock
-] = weakref.WeakKeyDictionary()
+_LOCKS: weakref.WeakKeyDictionary[asyncio.AbstractEventLoop, asyncio.Lock] = (
+ weakref.WeakKeyDictionary()
+)
@asgi_shutdown.connect
diff --git a/api/api/utils/licenses.py b/api/api/utils/licenses.py
index 4a58a9e93..01ae9337f 100644
--- a/api/api/utils/licenses.py
+++ b/api/api/utils/licenses.py
@@ -5,7 +5,6 @@ For any changes made here, please make the corresponding changes in the
frontend, or open an issue to track it.
"""
-
from api.constants.licenses import (
ALL_CC_LICENSES,
DEPRECATED_CC_LICENSES,
diff --git a/api/conf/urls/__init__.py b/api/conf/urls/__init__.py
index 62a980aa2..8ce45a6ad 100644
--- a/api/conf/urls/__init__.py
+++ b/api/conf/urls/__init__.py
@@ -4,6 +4,7 @@ URL configuration for the Openverse API.
For more information on this file, see
https://docs.djangoproject.com/en/4.2/topics/http/urls/
"""
+
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
diff --git a/api/test/fixtures/asynchronous.py b/api/test/fixtures/asynchronous.py
index 5277a134a..e0041bf5c 100644
--- a/api/test/fixtures/asynchronous.py
+++ b/api/test/fixtures/asynchronous.py
@@ -43,8 +43,7 @@ def ensure_asgi_lifecycle(session_loop: asyncio.AbstractEventLoop):
"""
scope = {"type": "lifespan"}
- async def noop(*args, **kwargs):
- ...
+ async def noop(*args, **kwargs): ...
async def shutdown():
return {"type": "lifespan.shutdown"}
diff --git a/api/test/unit/utils/test_throttle.py b/api/test/unit/utils/test_throttle.py
index a727ea2b8..975276c38 100644
--- a/api/test/unit/utils/test_throttle.py
+++ b/api/test/unit/utils/test_throttle.py
@@ -43,9 +43,9 @@ def enable_throttles(settings):
# Put settings into base Django settings from which DRF reads
# settings when we call `api_settings.reload()`
settings.REST_FRAMEWORK["DEFAULT_THROTTLE_RATES"] = settings.DEFAULT_THROTTLE_RATES
- settings.REST_FRAMEWORK[
- "DEFAULT_THROTTLE_CLASSES"
- ] = settings.DEFAULT_THROTTLE_CLASSES
+ settings.REST_FRAMEWORK["DEFAULT_THROTTLE_CLASSES"] = (
+ settings.DEFAULT_THROTTLE_CLASSES
+ )
# Reload the settings and read them from base Django settings
# Also handles importing classes from class strings, etc
diff --git a/automations/python/models/label.py b/automations/python/models/label.py
index edbed65a4..6a91967e7 100644
--- a/automations/python/models/label.py
+++ b/automations/python/models/label.py
@@ -4,7 +4,6 @@ from models.label_group import LabelGroup
class Label:
-
"""
Represents a single label.
diff --git a/automations/python/workflows/get_folder_differences.py b/automations/python/workflows/get_folder_differences.py
index a45053fa1..cbf2572b5 100644
--- a/automations/python/workflows/get_folder_differences.py
+++ b/automations/python/workflows/get_folder_differences.py
@@ -7,6 +7,7 @@ changed. It then converts the paths to URLs that can be used to view the
files on the docs preview site. Finally, it outputs the preview site docs
generated comment along with a list of new and changed files.
"""
+
import os
import shutil
import subprocess
diff --git a/catalog/dags/common/cloudwatch.py b/catalog/dags/common/cloudwatch.py
index 0be3df340..3d51b3b57 100644
--- a/catalog/dags/common/cloudwatch.py
+++ b/catalog/dags/common/cloudwatch.py
@@ -9,6 +9,7 @@ Modifying alarms can be skipped by setting the `TOGGLE_CLOUDWATCH_ALARMS` to `Fa
in the Airflow Variables, which is particularly the desired behavior when running
the Data Refresh DAGs locally or in a development environment.
"""
+
import logging
from airflow.exceptions import AirflowSkipException
diff --git a/catalog/dags/common/licenses/licenses.py b/catalog/dags/common/licenses/licenses.py
index a939de24d..198b78254 100644
--- a/catalog/dags/common/licenses/licenses.py
+++ b/catalog/dags/common/licenses/licenses.py
@@ -2,6 +2,7 @@
This module has a number of public methods which are useful for working
with licenses.
"""
+
import logging
from functools import lru_cache
from typing import NamedTuple
diff --git a/catalog/dags/common/loader/provider_details.py b/catalog/dags/common/loader/provider_details.py
index 6e892a62e..39c97daec 100644
--- a/catalog/dags/common/loader/provider_details.py
+++ b/catalog/dags/common/loader/provider_details.py
@@ -8,6 +8,7 @@ Apart from that, this file stores other provider related information which
might be useful for retrieving sub-providers at the database level and the
API level.
"""
+
import os
diff --git a/catalog/dags/common/storage/db_columns.py b/catalog/dags/common/storage/db_columns.py
index 2ca7d800e..c508603bf 100644
--- a/catalog/dags/common/storage/db_columns.py
+++ b/catalog/dags/common/storage/db_columns.py
@@ -2,6 +2,7 @@
This module contains the lists of database columns in the same order as in the
main media tables within the database.
"""
+
from common.constants import AUDIO, IMAGE
from common.storage import columns as col
from common.utils import setup_kwargs_for_media_type
diff --git a/catalog/dags/common/storage/util.py b/catalog/dags/common/storage/util.py
index 3f6b75f22..514e4e47a 100644
--- a/catalog/dags/common/storage/util.py
+++ b/catalog/dags/common/storage/util.py
@@ -1,4 +1,5 @@
"""This module has public methods which are useful for storage operations."""
+
import logging
from common.storage.audio import AudioStore
diff --git a/catalog/dags/common/urls.py b/catalog/dags/common/urls.py
index d8dd08f16..cdfc33e3e 100644
--- a/catalog/dags/common/urls.py
+++ b/catalog/dags/common/urls.py
@@ -2,6 +2,7 @@
This module has a number of public methods which are useful for
verifying and cleaning URLs.
"""
+
import logging
import re
from functools import lru_cache
diff --git a/catalog/dags/data_refresh/create_filtered_index.py b/catalog/dags/data_refresh/create_filtered_index.py
index f4fd3d927..a77c2d53e 100644
--- a/catalog/dags/data_refresh/create_filtered_index.py
+++ b/catalog/dags/data_refresh/create_filtered_index.py
@@ -15,6 +15,7 @@ index, and then points the filtered index alias for the media type to the new in
finally deleting the old, now unused filtered index. These TaskGroups are used in
the data refresh DAGs to execute the filtered index steps.
"""
+
from datetime import timedelta
from airflow.operators.empty import EmptyOperator
diff --git a/catalog/dags/data_refresh/create_filtered_index_dag.py b/catalog/dags/data_refresh/create_filtered_index_dag.py
index 7fc0f38ea..20f365f98 100644
--- a/catalog/dags/data_refresh/create_filtered_index_dag.py
+++ b/catalog/dags/data_refresh/create_filtered_index_dag.py
@@ -50,6 +50,7 @@ DAG runs for the media type to finish before continuing.
This ensures that neither are depending on or modifying the origin indexes
critical for the creation of the filtered indexes.
"""
+
from datetime import datetime
from airflow import DAG
diff --git a/catalog/dags/data_refresh/dag_factory.py b/catalog/dags/data_refresh/dag_factory.py
index 838ab97c8..358a0b3e2 100644
--- a/catalog/dags/data_refresh/dag_factory.py
+++ b/catalog/dags/data_refresh/dag_factory.py
@@ -22,6 +22,7 @@ https://github.com/WordPress/openverse-catalog/issues/353)
- [[Feature] Merge popularity calculations and data refresh into a single DAG](
https://github.com/WordPress/openverse-catalog/issues/453)
"""
+
import logging
from collections.abc import Sequence
diff --git a/catalog/dags/data_refresh/data_refresh_task_factory.py b/catalog/dags/data_refresh/data_refresh_task_factory.py
index 8444f0641..3ad20a806 100644
--- a/catalog/dags/data_refresh/data_refresh_task_factory.py
+++ b/catalog/dags/data_refresh/data_refresh_task_factory.py
@@ -44,6 +44,7 @@ issues and related PRs:
- [[Feature] Data refresh orchestration DAG](
https://github.com/WordPress/openverse-catalog/issues/353)
"""
+
import logging
import os
from collections.abc import Sequence
diff --git a/catalog/dags/data_refresh/data_refresh_types.py b/catalog/dags/data_refresh/data_refresh_types.py
index f6bc6dff6..27d2cc0ca 100644
--- a/catalog/dags/data_refresh/data_refresh_types.py
+++ b/catalog/dags/data_refresh/data_refresh_types.py
@@ -5,6 +5,7 @@ configuration for a Data Refresh DAG, and defines the actual `DATA_REFRESH_CONFI
for each of our media types. This configuration information is used to generate
the dynamic Data Refresh dags.
"""
+
import os
from dataclasses import dataclass, field
from datetime import datetime, timedelta
diff --git a/catalog/dags/database/batched_update/batched_update_dag.py b/catalog/dags/database/batched_update/batched_update_dag.py
index a698d79eb..c032e027e 100644
--- a/catalog/dags/database/batched_update/batched_update_dag.py
+++ b/catalog/dags/database/batched_update/batched_update_dag.py
@@ -63,7 +63,6 @@ for example, if there was a problem with the `update_query` which caused DAG
failures during the `update_batches` step.
"""
-
import logging
from airflow.decorators import dag
diff --git a/catalog/dags/database/delete_records/delete_records_dag.py b/catalog/dags/database/delete_records/delete_records_dag.py
index 679de59be..62a922074 100644
--- a/catalog/dags/database/delete_records/delete_records_dag.py
+++ b/catalog/dags/database/delete_records/delete_records_dag.py
@@ -50,7 +50,6 @@ DAG, for instance. The simplest way to do this is to ensure that any affected pr
DAGs are not currently running.
"""
-
import logging
from airflow.decorators import dag
diff --git a/catalog/dags/database/report_pending_reported_media.py b/catalog/dags/database/report_pending_reported_media.py
index 61f041691..edc1e850e 100644
--- a/catalog/dags/database/report_pending_reported_media.py
+++ b/catalog/dags/database/report_pending_reported_media.py
@@ -9,6 +9,7 @@ determine whether further action (such as deindexing the record) needs to be
taken. If a record has been reported multiple times, it only needs to be
reviewed once and so is only counted once in the reporting by this DAG.
"""
+
import logging
import os
from textwrap import dedent
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 3062281ee..407af9a5f 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
@@ -96,6 +96,7 @@ The resulting, merged configuration will be:
}
```
"""
+
import logging
from airflow import DAG
diff --git a/catalog/dags/elasticsearch_cluster/create_proportional_by_source_staging_index/create_proportional_by_source_staging_index_dag.py b/catalog/dags/elasticsearch_cluster/create_proportional_by_source_staging_index/create_proportional_by_source_staging_index_dag.py
index 28ed4a02a..1903d5f0c 100644
--- a/catalog/dags/elasticsearch_cluster/create_proportional_by_source_staging_index/create_proportional_by_source_staging_index_dag.py
+++ b/catalog/dags/elasticsearch_cluster/create_proportional_by_source_staging_index/create_proportional_by_source_staging_index_dag.py
@@ -36,6 +36,7 @@ immediately if any of the following DAGs are running:
* `recreate_full_staging_index`
* `create_new_staging_es_index`
"""
+
from datetime import datetime, timedelta
from airflow.decorators import dag
diff --git a/catalog/dags/elasticsearch_cluster/recreate_staging_index/recreate_full_staging_index_dag.py b/catalog/dags/elasticsearch_cluster/recreate_staging_index/recreate_full_staging_index_dag.py
index b91e93edb..0be1bc848 100644
--- a/catalog/dags/elasticsearch_cluster/recreate_staging_index/recreate_full_staging_index_dag.py
+++ b/catalog/dags/elasticsearch_cluster/recreate_staging_index/recreate_full_staging_index_dag.py
@@ -40,6 +40,7 @@ immediately if any of the following DAGs are running:
* `create_proportional_by_provider_staging_index`
* `create_new_staging_es_index`
"""
+
from datetime import datetime
from airflow.decorators import dag
diff --git a/catalog/dags/flickr_thumbs_removal.py b/catalog/dags/flickr_thumbs_removal.py
index 5c8615c2e..9c2e9e0eb 100644
--- a/catalog/dags/flickr_thumbs_removal.py
+++ b/catalog/dags/flickr_thumbs_removal.py
@@ -2,6 +2,7 @@
One-time run DAG to remove progressively all the old Flickr thumbnails,
as they were determined to be unsuitable for the Openverse UI requirements.
"""
+
import logging
from datetime import timedelta
from textwrap import dedent
diff --git a/catalog/dags/maintenance/add_license_url.py b/catalog/dags/maintenance/add_license_url.py
index 61a03012b..3eb36de35 100644
--- a/catalog/dags/maintenance/add_license_url.py
+++ b/catalog/dags/maintenance/add_license_url.py
@@ -9,6 +9,7 @@ This is a maintenance DAG that should be run once. If all the null values in
the `meta_data` column are updated, the DAG will only run the first and the
last step, logging the statistics.
"""
+
import csv
import logging
from collections import defaultdict
diff --git a/catalog/dags/maintenance/airflow_log_cleanup_workflow.py b/catalog/dags/maintenance/airflow_log_cleanup_workflow.py
index 23f2876d6..e645ab6a8 100644
--- a/catalog/dags/maintenance/airflow_log_cleanup_workflow.py
+++ b/catalog/dags/maintenance/airflow_log_cleanup_workflow.py
@@ -19,6 +19,7 @@ airflow dags trigger --conf
- maxLogAgeInDays:<INT> - Optional
- enableDelete:<BOOLEAN> - Optional
"""
+
from datetime import datetime, timedelta
import jinja2
diff --git a/catalog/dags/oauth2/authorize_dag.py b/catalog/dags/oauth2/authorize_dag.py
index a02238ed9..db5ad0c48 100644
--- a/catalog/dags/oauth2/authorize_dag.py
+++ b/catalog/dags/oauth2/authorize_dag.py
@@ -1,4 +1,5 @@
"""# OAuth Provider Authorization"""
+
from datetime import datetime
from airflow.models import DAG
diff --git a/catalog/dags/oauth2/token_refresh_dag.py b/catalog/dags/oauth2/token_refresh_dag.py
index 56c65309a..4c83fdef6 100644
--- a/catalog/dags/oauth2/token_refresh_dag.py
+++ b/catalog/dags/oauth2/token_refresh_dag.py
@@ -1,4 +1,5 @@
"""# OAuth Provider Token Refresh"""
+
from datetime import datetime
from airflow.models import DAG
diff --git a/catalog/dags/popularity/popularity_refresh_dag_factory.py b/catalog/dags/popularity/popularity_refresh_dag_factory.py
index d8f05b433..615d7fc50 100644
--- a/catalog/dags/popularity/popularity_refresh_dag_factory.py
+++ b/catalog/dags/popularity/popularity_refresh_dag_factory.py
@@ -22,6 +22,7 @@ implementation plan:
- [[Implementation Plan] Decoupling Popularity Calculations from the Data Refresh](
https://docs.openverse.org/projects/proposals/popularity_optimizations/20230420-implementation_plan_popularity_optimizations.html)
"""
+
import logging
from datetime import datetime
diff --git a/catalog/dags/popularity/popularity_refresh_types.py b/catalog/dags/popularity/popularity_refresh_types.py
index 67c9cb519..46d661ab5 100644
--- a/catalog/dags/popularity/popularity_refresh_types.py
+++ b/catalog/dags/popularity/popularity_refresh_types.py
@@ -5,6 +5,7 @@ configuration for a Popularity Refresh DAG, and defines the actual
`POPULARITY_REFRESH_CONFIGS` for each of our media types. This configuration info
is used to generate the dynamic Popularity Refresh dags.
"""
+
import os
from dataclasses import dataclass, field
from datetime import datetime, timedelta
diff --git a/catalog/dags/popularity/recreate_popularity_calculation_dag_factory.py b/catalog/dags/popularity/recreate_popularity_calculation_dag_factory.py
index f8662b06b..c13ea77eb 100644
--- a/catalog/dags/popularity/recreate_popularity_calculation_dag_factory.py
+++ b/catalog/dags/popularity/recreate_popularity_calculation_dag_factory.py
@@ -12,6 +12,7 @@ the new functions.
These DAGs are not on a schedule, and should only be run manually when new
SQL code is deployed for the calculation.
"""
+
from airflow import DAG
from common.constants import DAG_DEFAULT_ARGS, POSTGRES_CONN_ID
@@ -74,6 +75,6 @@ for popularity_refresh in POPULARITY_REFRESH_CONFIGS:
recreate_popularity_calculation_dag = create_recreate_popularity_calculation_dag(
popularity_refresh
)
- globals()[
- recreate_popularity_calculation_dag.dag_id
- ] = recreate_popularity_calculation_dag
+ globals()[recreate_popularity_calculation_dag.dag_id] = (
+ recreate_popularity_calculation_dag
+ )
diff --git a/catalog/dags/providers/provider_api_scripts/auckland_museum.py b/catalog/dags/providers/provider_api_scripts/auckland_museum.py
index 87035537a..2d57da0fc 100644
--- a/catalog/dags/providers/provider_api_scripts/auckland_museum.py
+++ b/catalog/dags/providers/provider_api_scripts/auckland_museum.py
@@ -16,6 +16,7 @@ Resource | Requests per second | Requests per day
/search, /id | 10 | 1000
/id/media | 10 | 1000
"""
+
import logging
from datetime import datetime, timedelta
diff --git a/catalog/dags/providers/provider_api_scripts/europeana.py b/catalog/dags/providers/provider_api_scripts/europeana.py
index 8a4ea6876..63f44685d 100644
--- a/catalog/dags/providers/provider_api_scripts/europeana.py
+++ b/catalog/dags/providers/provider_api_scripts/europeana.py
@@ -8,6 +8,7 @@ Output: TSV file containing the images and the
Notes: https://pro.europeana.eu/page/search
"""
+
import argparse
import functools
import logging
diff --git a/catalog/dags/providers/provider_api_scripts/finnish_museums.py b/catalog/dags/providers/provider_api_scripts/finnish_museums.py
index de842b37e..28ec13147 100644
--- a/catalog/dags/providers/provider_api_scripts/finnish_museums.py
+++ b/catalog/dags/providers/provider_api_scripts/finnish_museums.py
@@ -14,6 +14,7 @@ Notes: https://api.finna.fi/swagger-ui/
reingestion DAG, as updated data will be processed during
regular ingestion.
"""
+
import logging
from itertools import chain
diff --git a/catalog/dags/providers/provider_api_scripts/freesound.py b/catalog/dags/providers/provider_api_scripts/freesound.py
index 6cf55bc80..fc6f01a7f 100644
--- a/catalog/dags/providers/provider_api_scripts/freesound.py
+++ b/catalog/dags/providers/provider_api_scripts/freesound.py
@@ -11,6 +11,7 @@ Notes: https://freesound.org/docs/api/
This script can be run either to ingest the full dataset or
as a dated DAG.
"""
+
import functools
import logging
from datetime import datetime
diff --git a/catalog/dags/providers/provider_api_scripts/jamendo.py b/catalog/dags/providers/provider_api_scripts/jamendo.py
index 5243bf958..0b58c1f94 100644
--- a/catalog/dags/providers/provider_api_scripts/jamendo.py
+++ b/catalog/dags/providers/provider_api_scripts/jamendo.py
@@ -15,6 +15,7 @@ Notes: https://api.jamendo.com/v3.0/tracks/
sample rate: 44.1 or 48 kHz
channels: 1/2
"""
+
import logging
from datetime import timedelta
from urllib.parse import parse_qs, urlencode, urlsplit
diff --git a/catalog/dags/providers/provider_api_scripts/justtakeitfree.py b/catalog/dags/providers/provider_api_scripts/justtakeitfree.py
index 7b0bafbea..503b8c8ed 100644
--- a/catalog/dags/providers/provider_api_scripts/justtakeitfree.py
+++ b/catalog/dags/providers/provider_api_scripts/justtakeitfree.py
@@ -9,6 +9,7 @@ Output: TSV file containing the media and the
Notes: https://justtakeitfree.com/api/api.php
This API requires an API key. For more details, see https://github.com/WordPress/openverse/pull/2793
"""
+
import logging
from airflow.models import Variable
diff --git a/catalog/dags/providers/provider_api_scripts/nappy.py b/catalog/dags/providers/provider_api_scripts/nappy.py
index f9078b8ba..ffe9d6eb9 100644
--- a/catalog/dags/providers/provider_api_scripts/nappy.py
+++ b/catalog/dags/providers/provider_api_scripts/nappy.py
@@ -10,6 +10,7 @@ Notes: This api was written specially for Openverse.
https://nappy.co/
"""
+
import logging
from common import constants
diff --git a/catalog/dags/providers/provider_api_scripts/rawpixel.py b/catalog/dags/providers/provider_api_scripts/rawpixel.py
index bbd8d6570..dbe68df03 100644
--- a/catalog/dags/providers/provider_api_scripts/rawpixel.py
+++ b/catalog/dags/providers/provider_api_scripts/rawpixel.py
@@ -12,6 +12,7 @@ Notes: Rawpixel has given Openverse beta access to their API.
although the API key we've been given can circumvent this limit.
https://www.rawpixel.com/api/v1/search?tags=$publicdomain&page=1&pagesize=100
"""
+
import base64
import hmac
import html
diff --git a/catalog/dags/providers/provider_api_scripts/science_museum.py b/catalog/dags/providers/provider_api_scripts/science_museum.py
index 35a8ff513..7876ecf4b 100644
--- a/catalog/dags/providers/provider_api_scripts/science_museum.py
+++ b/catalog/dags/providers/provider_api_scripts/science_museum.py
@@ -9,6 +9,7 @@ Output: TSV file containing the image, the respective
Notes: https://github.com/TheScienceMuseum/collectionsonline/wiki/Collections-Online-API
Rate limited, no specific rate given.
""" # noqa: E501
+
import logging
import re
from datetime import date
diff --git a/catalog/dags/providers/provider_api_scripts/smk.py b/catalog/dags/providers/provider_api_scripts/smk.py
index 63d0ff660..b17d1142e 100644
--- a/catalog/dags/providers/provider_api_scripts/smk.py
+++ b/catalog/dags/providers/provider_api_scripts/smk.py
@@ -7,6 +7,7 @@ Output: TSV file containing the media metadata.
Notes: https://www.smk.dk/en/article/smk-api/
"""
+
import logging
import urllib.parse
diff --git a/catalog/dags/providers/provider_api_scripts/stocksnap.py b/catalog/dags/providers/provider_api_scripts/stocksnap.py
index e7d2f558d..faca731e3 100644
--- a/catalog/dags/providers/provider_api_scripts/stocksnap.py
+++ b/catalog/dags/providers/provider_api_scripts/stocksnap.py
@@ -11,6 +11,7 @@ Notes: https://stocksnap.io/api/load-photos/date/desc/1
No rate limits or authorization required.
API is undocumented.
"""
+
import json
import logging
diff --git a/catalog/dags/providers/provider_api_scripts/wordpress.py b/catalog/dags/providers/provider_api_scripts/wordpress.py
index 4d8fc3dfb..4c60d1b46 100644
--- a/catalog/dags/providers/provider_api_scripts/wordpress.py
+++ b/catalog/dags/providers/provider_api_scripts/wordpress.py
@@ -9,6 +9,7 @@ Notes: https://wordpress.org/photos/wp-json/wp/v2
Provide photos, media, users and more related resources.
No rate limit specified.
"""
+
import logging
import lxml.html as html
diff --git a/catalog/dags/providers/provider_dag_factory.py b/catalog/dags/providers/provider_dag_factory.py
index dc31be489..a35159866 100644
--- a/catalog/dags/providers/provider_dag_factory.py
+++ b/catalog/dags/providers/provider_dag_factory.py
@@ -62,6 +62,7 @@ https://github.com/creativecommons/cccatalog/issues/333)
- [DB Loader should take data from S3, rather than EC2 to load into PostgreSQL](
https://github.com/creativecommons/cccatalog/issues/334)
"""
+
import logging
import os
import re
diff --git a/catalog/tests/dags/common/storage/test_media.py b/catalog/tests/dags/common/storage/test_media.py
index e84332616..d1cdfd9d3 100644
--- a/catalog/tests/dags/common/storage/test_media.py
+++ b/catalog/tests/dags/common/storage/test_media.py
@@ -2,6 +2,7 @@
MediaStore is an abstract class, so to test it we
use one of the inheriting classes, ImageStore
"""
+
import logging
from unittest.mock import patch
diff --git a/catalog/tests/dags/common/test_resources/fake_provider_module.py b/catalog/tests/dags/common/test_resources/fake_provider_module.py
index 811ca852e..196b7cd1f 100644
--- a/catalog/tests/dags/common/test_resources/fake_provider_module.py
+++ b/catalog/tests/dags/common/test_resources/fake_provider_module.py
@@ -2,6 +2,7 @@
This is a fake provider module used in test_dag_factory.
It is used to check that the output path acquisition logic is correct.
"""
+
from common.storage.audio import AudioStore
from common.storage.image import ImageStore
diff --git a/catalog/tests/dags/maintenance/test_pr_review_reminders.py b/catalog/tests/dags/maintenance/test_pr_review_reminders.py
index 9d2ad8634..07731e5a7 100644
--- a/catalog/tests/dags/maintenance/test_pr_review_reminders.py
+++ b/catalog/tests/dags/maintenance/test_pr_review_reminders.py
@@ -265,9 +265,9 @@ def test_pings_past_due(github, urgency, events):
github["events"][past_due_pull["number"]] = make_urgent_events(urgency, events)
github["events"][not_due_pull["number"]] = make_non_urgent_events(events)
- github["events"][
- old_but_not_due_pull["number"]
- ] = make_non_urgent_reviewable_events(events)
+ github["events"][old_but_not_due_pull["number"]] = (
+ make_non_urgent_reviewable_events(events)
+ )
post_reminders("not_set", dry_run=False)
@@ -307,9 +307,9 @@ def test_does_not_reping_past_due_if_reminder_is_current(github, urgency, events
github["events"][past_due_pull["number"]] = make_urgent_events(urgency, events)
github["events"][not_due_pull["number"]] = make_non_urgent_events(events)
- github["events"][
- old_but_not_due_pull["number"]
- ] = make_non_urgent_reviewable_events(events)
+ github["events"][old_but_not_due_pull["number"]] = (
+ make_non_urgent_reviewable_events(events)
+ )
post_reminders("not_set", dry_run=False)
@@ -343,9 +343,9 @@ def test_does_reping_past_due_if_reminder_is_outdated(github, urgency, events):
github["events"][past_due_pull["number"]] = make_urgent_events(urgency, events)
github["events"][not_due_pull["number"]] = make_non_urgent_events(events)
- github["events"][
- old_but_not_due_pull["number"]
- ] = make_non_urgent_reviewable_events(events)
+ github["events"][old_but_not_due_pull["number"]] = (
+ make_non_urgent_reviewable_events(events)
+ )
post_reminders("not_set", dry_run=False)
@@ -459,9 +459,9 @@ def test_does_not_ping_if_no_reviewers(github, urgency, events):
github["events"][past_due_pull["number"]] = make_urgent_events(urgency, events)
github["events"][not_due_pull["number"]] = make_non_urgent_events(events)
- github["events"][
- old_but_not_due_pull["number"]
- ] = make_non_urgent_reviewable_events(events)
+ github["events"][old_but_not_due_pull["number"]] = (
+ make_non_urgent_reviewable_events(events)
+ )
for pr in [past_due_pull, not_due_pull]:
_setup_branch_protection(github, pr)
diff --git a/catalog/tests/dags/providers/provider_api_scripts/resources/inaturalist/pull_sample_records.py b/catalog/tests/dags/providers/provider_api_scripts/resources/inaturalist/pull_sample_records.py
index ac58de781..5fffe0615 100644
--- a/catalog/tests/dags/providers/provider_api_scripts/resources/inaturalist/pull_sample_records.py
+++ b/catalog/tests/dags/providers/provider_api_scripts/resources/inaturalist/pull_sample_records.py
@@ -7,7 +7,6 @@ Assumes that large files are saved outside of the Openverse repo to take pressur
git and linting.
"""
-
import csv
import gzip
import os
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 853e31a72..da446916f 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
@@ -493,9 +493,9 @@ def test_get_audio_record_data_parses_wav_invalid_bit_rate(wmc):
file_metadata = _get_resource_json("audio_filedata_wav.json")
original_data = {"url": "myurl.com", "meta_data": {}}
# Set the bit rate higher than the int max
- file_metadata["metadata"][5]["value"][3]["value"][0]["value"][3][
- "value"
- ] = 4294967294
+ file_metadata["metadata"][5]["value"][3]["value"][0]["value"][3]["value"] = (
+ 4294967294
+ )
expected_parsed_data = {
"url": "myurl.com",
"bit_rate": None,
diff --git a/catalog/utilities/dag_doc_gen/dag_doc_generation.py b/catalog/utilities/dag_doc_gen/dag_doc_generation.py
index 436bb7096..aabec1dff 100644
--- a/catalog/utilities/dag_doc_gen/dag_doc_generation.py
+++ b/catalog/utilities/dag_doc_gen/dag_doc_generation.py
@@ -13,6 +13,7 @@ individual documentation subsections further in the document.
The individual DAG documentation section pulls the DAG's `doc_md` blurb and renders
it within the document.
"""
+
import logging
import re
from collections import defaultdict
diff --git a/documentation/_ext/link_issues.py b/documentation/_ext/link_issues.py
index cdb70382c..9070b6931 100644
--- a/documentation/_ext/link_issues.py
+++ b/documentation/_ext/link_issues.py
@@ -26,6 +26,7 @@ Changes by Openverse Contributors:
Add GitHub token to prevent rate limiting
"""
+
import dataclasses
import os
import re
diff --git a/documentation/_ext/link_usernames.py b/documentation/_ext/link_usernames.py
index 4ed01b89c..d9543b40c 100644
--- a/documentation/_ext/link_usernames.py
+++ b/documentation/_ext/link_usernames.py
@@ -8,6 +8,7 @@ to the user's GitHub profile.
The plugin ignores code inside of fixed text blocks, including code blocks and backticks.
"""
+
import re
from docutils import nodes
diff --git a/ingestion_server/ingestion_server/api.py b/ingestion_server/ingestion_server/api.py
index 7285fc695..9156c5613 100644
--- a/ingestion_server/ingestion_server/api.py
+++ b/ingestion_server/ingestion_server/api.py
@@ -1,4 +1,5 @@
"""A small RPC API server for scheduling data refresh and indexing tasks."""
+
import logging
import os
import time
diff --git a/ingestion_server/ingestion_server/cleanup.py b/ingestion_server/ingestion_server/cleanup.py
index 23f69f843..6e794f290 100644
--- a/ingestion_server/ingestion_server/cleanup.py
+++ b/ingestion_server/ingestion_server/cleanup.py
@@ -3,6 +3,7 @@ Functions for processing data when it is imported into the catalog.
This includes cleaning up malformed URLs and filtering out undesirable tags.
"""
+
import csv
import logging as log
import multiprocessing
diff --git a/utilities/dead_links/dead_link_tally.py b/utilities/dead_links/dead_link_tally.py
index 1a1d9cda4..77562a2a5 100644
--- a/utilities/dead_links/dead_link_tally.py
+++ b/utilities/dead_links/dead_link_tally.py
@@ -5,6 +5,7 @@ This script assumes that the API Redis instance you care about is present
on localhost (usually via tunneling). It will run through the link validation
entries in Redis.
"""
+
import pprint
from collections import defaultdict
from urllib.parse import urlparse
diff --git a/utilities/project_planning/calculate_average_weeks_of_work.py b/utilities/project_planning/calculate_average_weeks_of_work.py
index 0b8246de6..94a783b01 100644
--- a/utilities/project_planning/calculate_average_weeks_of_work.py
+++ b/utilities/project_planning/calculate_average_weeks_of_work.py
@@ -4,6 +4,7 @@ members.
See the README for more information.
"""
+
from pathlib import Path
import click
diff --git a/utilities/project_planning/graph_project_voting.py b/utilities/project_planning/graph_project_voting.py
index df2c79eb9..ee63642d3 100644
--- a/utilities/project_planning/graph_project_voting.py
+++ b/utilities/project_planning/graph_project_voting.py
@@ -3,6 +3,7 @@ Script for generating graphs of project voting results.
See the README for more information.
"""
+
from datetime import datetime
from pathlib import Path
diff --git a/utilities/project_planning/process_selection_votes.py b/utilities/project_planning/process_selection_votes.py
index b3d3e7073..a809ec4b0 100644
--- a/utilities/project_planning/process_selection_votes.py
+++ b/utilities/project_planning/process_selection_votes.py
@@ -3,6 +3,7 @@ Script for gathering project selection votes and sharing the results
See the README for more information.
"""
+
from datetime import datetime
from pathlib import Path
diff --git a/utilities/provider_tallies/provider_tally_stats.py b/utilities/provider_tallies/provider_tally_stats.py
index ae073cb97..9f62eff7d 100644
--- a/utilities/provider_tallies/provider_tally_stats.py
+++ b/utilities/provider_tallies/provider_tally_stats.py
@@ -5,6 +5,7 @@ This script assumes that the API Redis instance you care about is present
on localhost (usually via tunneling). It will run through the provider result count
entries in Redis and output them to CSV.
"""
+
import pprint
from datetime import datetime
from pathlib import Path