Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
🔄 synced file(s) with WordPress/openverse (#1057)
Openverse (Bot)8df2c68d8e04
diff --git a/.flake8 b/.flake8deleted file mode 100644index 7ffb6959b..000000000--- a/.flake8+++ /dev/null@@ -1,7 +0,0 @@-[flake8]-# match black formatter's behavior-ignore = E203, W503-per-file-ignores =- # Ignore maximum line length rule for test files- test_*:E501-max-line-length = 88diff --git a/.github/workflows/new_issues.yml b/.github/workflows/new_issues.ymlindex e7e0eb586..823becaae 100644--- a/.github/workflows/new_issues.yml+++ b/.github/workflows/new_issues.yml@@ -5,6 +5,10 @@ on:issues:types:- opened+env:+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ ISSUE_ID: ${{ github.event.issue.id }}+ PROJECT_ID: "PVT_kwDOAAQ2Js4AMZdL" # The ID for the Openverse project (#75).jobs:add_issue:@@ -18,3 +22,75 @@ jobs:column: Backlog# TODO: Switch to GITHUB_TOKEN if the project is moved to a reporepo-token: ${{ secrets.ACCESS_TOKEN }}++ add_issue_to_project:+ name: Add new issue to project+ runs-on: ubuntu-latest+ steps:+ - name: Add issue to "Backlog"+ run: |+ # shellcheck disable=SC2016+ gh api graphql -f query='+ mutation($project:ID!, $issue:ID!) {+ addProjectV2ItemById(input: {projectId: $project, contentId: $issue}) {+ item {+ id+ content {+ ... on Issue {+ labels(first: 10) {+ nodes {+ name+ }+ }+ }+ }+ }+ }+ }' -f project="$PROJECT_ID" -f issue="$ISSUE_ID" >> issue_data.json++ echo 'ITEM_ID='"$(jq '.data.addProjectV2ItemById.item.id' issue_data.json)" >> "$GITHUB_ENV"+ ITEM_PRIORITY="$(jq '.data.addProjectV2ItemById.item.content.labels.nodes[] | select(.name | contains("priority")).name | split(": ")[1]' issue_data.json)" >> "$GITHUB_ENV"+ # The IDs for the project's Priority custom field options.+ # These IDs were manually retrieved from the GitHub API.+ if [[ $ITEM_PRIORITY == "low" ]]; then+ PRIORITY_VALUE_ID="279ae886"+ elif [[ $ITEM_PRIORITY == "medium" ]]; then+ PRIORITY_VALUE_ID="333b3c1d"+ elif [[ $ITEM_PRIORITY == "high" ]]; then+ PRIORITY_VALUE_ID="03fe8945"+ else+ PRIORITY_VALUE_ID="fb76bdbc"+ fi+ echo 'PRIORITY_VALUE_ID='"$PRIORITY_VALUE_ID" >> "$GITHUB_ENV"++ set_issue_priority_field:+ name: Set issue priority+ runs-on: ubuntu-latest+ needs:+ - add_issue_to_project+ steps:+ - name: Set issue priority+ env:+ PRIORITY_FIELD_ID: "PVTSSF_lADOAAQ2Js4AMZdLzgH6Kbo" # The ID for the project Priority custom field.+ run: |+ # shellcheck disable=SC2016+ gh api graphql -f query='+ mutation (+ $project: ID!+ $item: ID!+ $priority_field: ID!+ $priority_value: String!+ ) {+ set_priority_field: updateProjectV2ItemFieldValue(input: {+ projectId: $project+ itemId: $item+ fieldId: $priority_field+ value: {+ singleSelectOptionId: $priority_value+ }+ }) {+ projectV2Item {+ id+ }+ }+ }' -f project="$PROJECT_ID" -f item="$ITEM_ID" -f priority_field="$PRIORITY_FIELD_ID" -f priority_value="$PRIORITY_VALUE_ID"diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yamlindex a57897417..11447d2cf 100644--- a/.pre-commit-config.yaml+++ b/.pre-commit-config.yaml@@ -46,14 +46,10 @@ repos:args:- --py310-plus- # Use the `.flake8` file to configure additional project-specific requirements.- - repo: https://github.com/PyCQA/flake8- rev: 3.9.2+ - repo: https://github.com/charliermarsh/ruff-pre-commit+ rev: "v0.0.257"hooks:- - id: flake8- args:- - --extend-ignore=E203,W503- - --max-line-length=88+ - id: ruff- repo: https://github.com/ambv/blackrev: 22.3.0diff --git a/.ruff.toml b/.ruff.tomlnew file mode 100644index 000000000..4e07e6743--- /dev/null+++ b/.ruff.toml@@ -0,0 +1,3 @@+[per-file-ignores]+"*test*" = ["E501"]+"*__init__*" = ["F401"]diff --git a/DAGs.md b/DAGs.mdindex 58c5156f4..9ebe1c28d 100644--- a/DAGs.md+++ b/DAGs.md@@ -571,8 +571,8 @@ ETL Process: Use the API to identify all CC-licensed images.Output: TSV file containing the image, the respective meta-data.Notes:-https://github.com/TheScienceMuseum/collectionsonline/wiki/Collections-Online-API #-noqa Rate limited, no specific rate given.+https://github.com/TheScienceMuseum/collectionsonline/wiki/Collections-Online-API+Rate limited, no specific rate given.## `smithsonian_workflow`diff --git a/openverse_catalog/dags/providers/provider_api_scripts/rawpixel.py b/openverse_catalog/dags/providers/provider_api_scripts/rawpixel.pyindex fb18b1c74..2cbe81e22 100644--- a/openverse_catalog/dags/providers/provider_api_scripts/rawpixel.py+++ b/openverse_catalog/dags/providers/provider_api_scripts/rawpixel.py@@ -89,9 +89,9 @@ class RawpixelDataIngester(ProviderDataIngester):URL encode the ordered parameters in a way that matches Node'squerystring.stringify as closely as possible- See: https://docs.python.org/3.10/library/urllib.parse.html#urllib.parse.urlencode # noqa- and https://nodejs.org/api/querystring.html#querystringstringifyobj-sep-eq-options # noqa- """+ See: https://docs.python.org/3.10/library/urllib.parse.html#urllib.parse.urlencode+ and https://nodejs.org/api/querystring.html#querystringstringifyobj-sep-eq-options+ """ # noqa: E501# Params must be ordered for deterministic computationordered_params = {k: v for k, v in sorted(query_params.items())}# Build parameters as a string, split out sequences since that's Node's behaviordiff --git a/openverse_catalog/dags/providers/provider_api_scripts/science_museum.py b/openverse_catalog/dags/providers/provider_api_scripts/science_museum.pyindex 61591da93..abd3aad87 100644--- a/openverse_catalog/dags/providers/provider_api_scripts/science_museum.py+++ b/openverse_catalog/dags/providers/provider_api_scripts/science_museum.py@@ -6,9 +6,9 @@ ETL Process: Use the API to identify all CC-licensed images.Output: TSV file containing the image, the respectivemeta-data.-Notes: https://github.com/TheScienceMuseum/collectionsonline/wiki/Collections-Online-API # noqa+Notes: https://github.com/TheScienceMuseum/collectionsonline/wiki/Collections-Online-APIRate limited, no specific rate given.-"""+""" # noqa: E501import loggingimport refrom datetime import date