diff --git a/.flake8 b/.flake8
deleted file mode 100644
index 90a48e215d..0000000000
--- a/.flake8
+++ /dev/null
@@ -1,15 +0,0 @@
-[flake8]
-max_line_length = 88
-ignore = E203, E501, W503
-
-exclude =
- media/*,
- */pontoon-intro/*,
- docs/conf.py,
- */migrations/*,
- docs/conf.py,
- setup.py,
- node_modules,
- bin,
- tag-admin,
- translate
diff --git a/.github/workflows/py-lint.yml b/.github/workflows/py-lint.yml
index fc6c78fc93..6a798ab9e4 100644
--- a/.github/workflows/py-lint.yml
+++ b/.github/workflows/py-lint.yml
@@ -18,7 +18,7 @@ on:
workflow_dispatch:
jobs:
- flake8:
+ ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
@@ -29,33 +29,7 @@ jobs:
run: |
pip install -U pip
pip install -r requirements/lint.txt
- - name: flake8
- run: flake8 pontoon
-
- black:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
- - uses: actions/setup-python@v5
- with:
- python-version: '3.11'
- - name: Install Dependencies
- run: |
- pip install -U pip
- pip install -r requirements/lint.txt
- - name: black
- run: black --check pontoon
-
- pyupgrade:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
- - uses: actions/setup-python@v5
- with:
- python-version: '3.11'
- - name: Install Dependencies
- run: |
- pip install -U pip
- pip install -r requirements/lint.txt
- - name: pyupgrade
- run: pyupgrade --py311-plus *.py `find pontoon -name \*.py`
+ - name: ruff lint
+ run: ruff check pontoon
+ - name: ruff format
+ run: ruff format --check pontoon
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
index 5146f6a8e2..2caf47e1ae 100644
--- a/CONTRIBUTING.rst
+++ b/CONTRIBUTING.rst
@@ -115,33 +115,22 @@ To run the required linters on the Python and the Javascript code at once you ca
Python code conventions
=======================
-Our Python code is automatically formatted using `black `_.
+Our Python code is automatically formatted using `ruff `_.
We enforce that in our Continuous Integration, so you will need to run
-black on your code before sending it for review.
+ruff on your code before sending it for review.
-You can run black locally either as an
-`add-on in your code editor `_,
-or as a `git pre-hook commit `_.
+You can run ruff locally either as an
+`add-on in your code editor `_,
+or as a `git pre-hook commit `_.
Alternatively, you can format your code using:
.. code-block:: shell
- $ make black
+ $ make ruff
-We also require Python code to use newer syntax of Python. You can upgrade automatically by running:
-
-.. code-block:: shell
-
- $ make pyupgrade
-
-Additionally, we use a linter to verify that imports are correct. You can run it with:
-
-.. code-block:: shell
-
- $ make flake8
-
-In the rare case when you cannot fix a flake8 error, use ``# noqa`` to make the linter
-ignore that error. Note that in most cases, it is better to fix the issues than ignoring them.
+In the rare case when you cannot fix an error, use ``# noqa`` to make the linter
+ignore that error (see `documentation `_).
+Note that in most cases, it is better to fix the issues than ignoring them.
Javascript code conventions
diff --git a/Makefile b/Makefile
index 5acb8aacd4..7d38e87475 100644
--- a/Makefile
+++ b/Makefile
@@ -9,7 +9,7 @@ SITE_URL ?= http://localhost:8000
USER_ID?=1000
GROUP_ID?=1000
-.PHONY: build build-translate build-tagadmin build-server server-env setup run clean shell ci test test-translate test-tagadmin test-server jest pytest format lint types eslint prettier check-prettier flake8 pyupgrade check-pyupgrade black check-black dropdb dumpdb loaddb sync-projects requirements
+.PHONY: build build-translate build-tagadmin build-server server-env setup run clean shell ci test test-translate test-tagadmin test-server jest pytest format lint types eslint prettier check-prettier ruff check-ruff dropdb dumpdb loaddb sync-projects requirements
help:
@echo "Welcome to Pontoon!\n"
@@ -34,12 +34,9 @@ help:
@echo " eslint Runs a code linter on the JavaScript code"
@echo " prettier Runs the Prettier formatter"
@echo " check-prettier Runs a check for format issues with the Prettier formatter"
- @echo " flake8 Runs the flake8 style guides on all Python code"
- @echo " pyupgrade Upgrades all Python code to newer syntax of Python"
- @echo " check-pyupgrade Runs a check for outdated syntax of Python with the pyupgrade formatter"
- @echo " black Runs the black formatter on all Python code"
- @echo " check-black Runs a check for format issues with the black formatter"
@echo " dropdb Completely remove the postgres container and its data"
+ @echo " ruff Runs the ruff formatter on all Python code"
+ @echo " check-ruff Runs a check for format issues with the ruff formatter"
@echo " dumpdb Create a postgres database dump with timestamp used as file name"
@echo " loaddb Load a database dump into postgres, file name in DB_DUMP_FILE"
@echo " sync-projects Runs the synchronization task on all projects"
@@ -99,9 +96,9 @@ test-server: pytest
pytest:
"${DC}" run ${run_opts} --rm server pytest --cov-report=xml:pontoon/coverage.xml --cov=. $(opts)
-format: prettier pyupgrade black
+format: prettier ruff
-lint: types eslint check-prettier flake8 check-pyupgrade check-black
+lint: types eslint check-prettier check-ruff
types:
npm run types -w translate
@@ -115,20 +112,13 @@ prettier:
check-prettier:
npm run check-prettier
-flake8:
- "${DC}" run --rm server flake8 pontoon/
+ruff:
+ "${DC}" run --rm server ruff check --fix pontoon/
+ "${DC}" run --rm server ruff format pontoon/
-pyupgrade:
- "${DC}" run --rm server pyupgrade --exit-zero-even-if-changed --py311-plus *.py `find pontoon -name \*.py`
-
-check-pyupgrade:
- "${DC}" run --rm server pyupgrade --py311-plus *.py `find pontoon -name \*.py`
-
-black:
- "${DC}" run --rm server black pontoon/
-
-check-black:
- "${DC}" run --rm server black --check pontoon
+check-ruff:
+ "${DC}" run --rm server ruff check pontoon
+ "${DC}" run --rm server ruff format --check pontoon
dropdb:
"${DC}" down --volumes postgresql
diff --git a/pontoon/actionlog/migrations/0001_squashed_0002_auto_20200123_1843.py b/pontoon/actionlog/migrations/0001_squashed_0002_auto_20200123_1843.py
index 35f5dfb218..e2690fbdaf 100644
--- a/pontoon/actionlog/migrations/0001_squashed_0002_auto_20200123_1843.py
+++ b/pontoon/actionlog/migrations/0001_squashed_0002_auto_20200123_1843.py
@@ -5,7 +5,6 @@
class Migration(migrations.Migration):
-
initial = True
dependencies = [
diff --git a/pontoon/actionlog/migrations/0002_auto_20200703_0709.py b/pontoon/actionlog/migrations/0002_auto_20200703_0709.py
index 00ade776ff..3d6d7ca2c9 100644
--- a/pontoon/actionlog/migrations/0002_auto_20200703_0709.py
+++ b/pontoon/actionlog/migrations/0002_auto_20200703_0709.py
@@ -6,7 +6,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("actionlog", "0001_squashed_0002_auto_20200123_1843"),
]
diff --git a/pontoon/actionlog/migrations/0003_existing_pretranslation_action.py b/pontoon/actionlog/migrations/0003_existing_pretranslation_action.py
index 5f611b0e11..82088cedf3 100644
--- a/pontoon/actionlog/migrations/0003_existing_pretranslation_action.py
+++ b/pontoon/actionlog/migrations/0003_existing_pretranslation_action.py
@@ -37,7 +37,6 @@ def delete_action_logs_for_pretranslations(apps, schema_editor):
class Migration(migrations.Migration):
-
dependencies = [
("actionlog", "0002_auto_20200703_0709"),
]
diff --git a/pontoon/allauth_urls.py b/pontoon/allauth_urls.py
index 833d2d107d..ee251b086a 100644
--- a/pontoon/allauth_urls.py
+++ b/pontoon/allauth_urls.py
@@ -3,6 +3,7 @@
Because of concerns related to the security concerns it's a better to keep only selected
views and don't allow user to tamper with the state of an account.
"""
+
import importlib
from django.urls import path
diff --git a/pontoon/base/management/commands/warmup_cache.py b/pontoon/base/management/commands/warmup_cache.py
index 4b7f7a6faa..d6cd086bdc 100644
--- a/pontoon/base/management/commands/warmup_cache.py
+++ b/pontoon/base/management/commands/warmup_cache.py
@@ -80,8 +80,8 @@ def warmup_insights_cache(self):
path = reverse("pontoon.insights")
url = urljoin(SITE_URL, path)
keys = [
- f"/pontoon.insights.views/team_pretranslation_quality",
- f"/pontoon.insights.views/project_pretranslation_quality",
+ "/pontoon.insights.views/team_pretranslation_quality",
+ "/pontoon.insights.views/project_pretranslation_quality",
]
self.warmup_url(url, keys=keys)
self.stdout.write("Insights page warmed up.")
diff --git a/pontoon/base/migrations/0001_squashed_0154_auto_20200206_1736.py b/pontoon/base/migrations/0001_squashed_0154_auto_20200206_1736.py
index 41d5b4cb9e..b8383392a1 100644
--- a/pontoon/base/migrations/0001_squashed_0154_auto_20200206_1736.py
+++ b/pontoon/base/migrations/0001_squashed_0154_auto_20200206_1736.py
@@ -12,7 +12,6 @@
class Migration(migrations.Migration):
-
initial = True
dependencies = [
diff --git a/pontoon/base/migrations/0002_auto_20200322_1821.py b/pontoon/base/migrations/0002_auto_20200322_1821.py
index 12e38c7978..5a4a01359b 100644
--- a/pontoon/base/migrations/0002_auto_20200322_1821.py
+++ b/pontoon/base/migrations/0002_auto_20200322_1821.py
@@ -1437,7 +1437,6 @@ def squashed_run_python(apps, schema_editor):
class Migration(migrations.Migration):
-
dependencies = [
("base", "0001_squashed_0154_auto_20200206_1736"),
("guardian", "__first__"),
diff --git a/pontoon/base/migrations/0003_add_visibility_field_to_project.py b/pontoon/base/migrations/0003_add_visibility_field_to_project.py
index ddd818a38e..ce60915216 100644
--- a/pontoon/base/migrations/0003_add_visibility_field_to_project.py
+++ b/pontoon/base/migrations/0003_add_visibility_field_to_project.py
@@ -4,7 +4,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0002_auto_20200322_1821"),
]
diff --git a/pontoon/base/migrations/0004_make_old_projects_public_again.py b/pontoon/base/migrations/0004_make_old_projects_public_again.py
index 4cfc81d58c..941b5d58c5 100644
--- a/pontoon/base/migrations/0004_make_old_projects_public_again.py
+++ b/pontoon/base/migrations/0004_make_old_projects_public_again.py
@@ -11,7 +11,6 @@ def make_projects_public(apps, schema_editor):
class Migration(migrations.Migration):
-
dependencies = [
("base", "0003_add_visibility_field_to_project"),
]
diff --git a/pontoon/base/migrations/0005_add_terminology_project.py b/pontoon/base/migrations/0005_add_terminology_project.py
index b695eb43da..1a7cd247f4 100644
--- a/pontoon/base/migrations/0005_add_terminology_project.py
+++ b/pontoon/base/migrations/0005_add_terminology_project.py
@@ -177,7 +177,6 @@ def remove_terminology_project(apps, schema_editor):
class Migration(migrations.Migration):
-
dependencies = [
("base", "0004_make_old_projects_public_again"),
("terminology", "0002_term_entity"),
diff --git a/pontoon/base/migrations/0006_auto_20200703_0710.py b/pontoon/base/migrations/0006_auto_20200703_0710.py
index cb82f0ef14..da8c0b2d7d 100644
--- a/pontoon/base/migrations/0006_auto_20200703_0710.py
+++ b/pontoon/base/migrations/0006_auto_20200703_0710.py
@@ -6,7 +6,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0005_add_terminology_project"),
]
diff --git a/pontoon/base/migrations/0007_machinery_sources_translation.py b/pontoon/base/migrations/0007_machinery_sources_translation.py
index 1b48b61a88..e78826bc5b 100644
--- a/pontoon/base/migrations/0007_machinery_sources_translation.py
+++ b/pontoon/base/migrations/0007_machinery_sources_translation.py
@@ -5,7 +5,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0006_auto_20200703_0710"),
]
diff --git a/pontoon/base/migrations/0008_add_systran_locales.py b/pontoon/base/migrations/0008_add_systran_locales.py
index d044d00848..b06e4be551 100644
--- a/pontoon/base/migrations/0008_add_systran_locales.py
+++ b/pontoon/base/migrations/0008_add_systran_locales.py
@@ -5,7 +5,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0007_machinery_sources_translation"),
]
diff --git a/pontoon/base/migrations/0009_change_pontoon_users_emails.py b/pontoon/base/migrations/0009_change_pontoon_users_emails.py
index 47c963618d..460d38936f 100644
--- a/pontoon/base/migrations/0009_change_pontoon_users_emails.py
+++ b/pontoon/base/migrations/0009_change_pontoon_users_emails.py
@@ -29,7 +29,6 @@ def revert_system_user_email(apps, schema_editor):
class Migration(migrations.Migration):
-
initial = True
dependencies = [
diff --git a/pontoon/base/migrations/0010_comment_pinned.py b/pontoon/base/migrations/0010_comment_pinned.py
index 9418fecb25..3266c57666 100644
--- a/pontoon/base/migrations/0010_comment_pinned.py
+++ b/pontoon/base/migrations/0010_comment_pinned.py
@@ -4,7 +4,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0009_change_pontoon_users_emails"),
]
diff --git a/pontoon/base/migrations/0011_rename_download_prefix.py b/pontoon/base/migrations/0011_rename_download_prefix.py
index dc1e50e7ac..088dcf72b8 100644
--- a/pontoon/base/migrations/0011_rename_download_prefix.py
+++ b/pontoon/base/migrations/0011_rename_download_prefix.py
@@ -4,7 +4,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0010_comment_pinned"),
]
diff --git a/pontoon/base/migrations/0012_auto_20201020_1830.py b/pontoon/base/migrations/0012_auto_20201020_1830.py
index a79fc28eac..a11a7a4f76 100644
--- a/pontoon/base/migrations/0012_auto_20201020_1830.py
+++ b/pontoon/base/migrations/0012_auto_20201020_1830.py
@@ -6,7 +6,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0011_rename_download_prefix"),
]
diff --git a/pontoon/base/migrations/0013_transvision_remove.py b/pontoon/base/migrations/0013_transvision_remove.py
index f4d83810d1..772cb3dcbc 100644
--- a/pontoon/base/migrations/0013_transvision_remove.py
+++ b/pontoon/base/migrations/0013_transvision_remove.py
@@ -5,7 +5,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0012_auto_20201020_1830"),
]
diff --git a/pontoon/base/migrations/0014_auto_20210310_1945.py b/pontoon/base/migrations/0014_auto_20210310_1945.py
index 43d54837cc..692b7e3f06 100644
--- a/pontoon/base/migrations/0014_auto_20210310_1945.py
+++ b/pontoon/base/migrations/0014_auto_20210310_1945.py
@@ -5,7 +5,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0013_transvision_remove"),
]
diff --git a/pontoon/base/migrations/0015_userprofile_has_dismissed_addon_promotion.py b/pontoon/base/migrations/0015_userprofile_has_dismissed_addon_promotion.py
index 4e38e58b13..9792a7fa48 100644
--- a/pontoon/base/migrations/0015_userprofile_has_dismissed_addon_promotion.py
+++ b/pontoon/base/migrations/0015_userprofile_has_dismissed_addon_promotion.py
@@ -4,7 +4,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0014_auto_20210310_1945"),
]
diff --git a/pontoon/base/migrations/0016_entity_key_required.py b/pontoon/base/migrations/0016_entity_key_required.py
index 623549ef10..c149daec99 100644
--- a/pontoon/base/migrations/0016_entity_key_required.py
+++ b/pontoon/base/migrations/0016_entity_key_required.py
@@ -4,7 +4,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0015_userprofile_has_dismissed_addon_promotion"),
]
diff --git a/pontoon/base/migrations/0017_entity_context.py b/pontoon/base/migrations/0017_entity_context.py
index 389b5a08e9..c527c6991e 100644
--- a/pontoon/base/migrations/0017_entity_context.py
+++ b/pontoon/base/migrations/0017_entity_context.py
@@ -4,7 +4,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0016_entity_key_required"),
]
diff --git a/pontoon/base/migrations/0018_populate_entity_context.py b/pontoon/base/migrations/0018_populate_entity_context.py
index 322f26d508..8125defc1c 100644
--- a/pontoon/base/migrations/0018_populate_entity_context.py
+++ b/pontoon/base/migrations/0018_populate_entity_context.py
@@ -39,7 +39,6 @@ def remove_entity_context(apps, schema_editor):
class Migration(migrations.Migration):
-
dependencies = [
("base", "0017_entity_context"),
]
diff --git a/pontoon/base/migrations/0019_alter_locale_cldr_plurals.py b/pontoon/base/migrations/0019_alter_locale_cldr_plurals.py
index 5ee9fbc2ab..db116462c1 100644
--- a/pontoon/base/migrations/0019_alter_locale_cldr_plurals.py
+++ b/pontoon/base/migrations/0019_alter_locale_cldr_plurals.py
@@ -5,7 +5,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0018_populate_entity_context"),
]
diff --git a/pontoon/base/migrations/0020_notification_subscriptions.py b/pontoon/base/migrations/0020_notification_subscriptions.py
index a0f1dfcdd2..8051a4b8f9 100644
--- a/pontoon/base/migrations/0020_notification_subscriptions.py
+++ b/pontoon/base/migrations/0020_notification_subscriptions.py
@@ -4,7 +4,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0019_alter_locale_cldr_plurals"),
]
diff --git a/pontoon/base/migrations/0021_alter_repository_url.py b/pontoon/base/migrations/0021_alter_repository_url.py
index f82758d5b8..b582933c21 100644
--- a/pontoon/base/migrations/0021_alter_repository_url.py
+++ b/pontoon/base/migrations/0021_alter_repository_url.py
@@ -5,7 +5,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0020_notification_subscriptions"),
]
diff --git a/pontoon/base/migrations/0022_reviewed_suggestions.py b/pontoon/base/migrations/0022_reviewed_suggestions.py
index 49eb108923..54858c9d36 100644
--- a/pontoon/base/migrations/0022_reviewed_suggestions.py
+++ b/pontoon/base/migrations/0022_reviewed_suggestions.py
@@ -4,7 +4,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0021_alter_repository_url"),
]
diff --git a/pontoon/base/migrations/0023_fuzzy_to_missing.py b/pontoon/base/migrations/0023_fuzzy_to_missing.py
index 44c4a11df3..93068cc1b4 100644
--- a/pontoon/base/migrations/0023_fuzzy_to_missing.py
+++ b/pontoon/base/migrations/0023_fuzzy_to_missing.py
@@ -28,7 +28,6 @@ def fuzzy_to_missing(apps, schema_editor):
class Migration(migrations.Migration):
-
dependencies = [
("base", "0022_reviewed_suggestions"),
]
diff --git a/pontoon/base/migrations/0024_fuzzy_to_pretranslated_strings.py b/pontoon/base/migrations/0024_fuzzy_to_pretranslated_strings.py
index 6a5192f0d8..c926cb5701 100644
--- a/pontoon/base/migrations/0024_fuzzy_to_pretranslated_strings.py
+++ b/pontoon/base/migrations/0024_fuzzy_to_pretranslated_strings.py
@@ -5,7 +5,6 @@
class Migration(migrations.Migration):
-
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
("base", "0023_fuzzy_to_missing"),
diff --git a/pontoon/base/migrations/0025_remove_tm_entries_of_rejected.py b/pontoon/base/migrations/0025_remove_tm_entries_of_rejected.py
index faba5015e6..82ae37e47c 100644
--- a/pontoon/base/migrations/0025_remove_tm_entries_of_rejected.py
+++ b/pontoon/base/migrations/0025_remove_tm_entries_of_rejected.py
@@ -9,7 +9,6 @@ def remove_tm_entries_of_rejected(apps, schema_editor):
class Migration(migrations.Migration):
-
dependencies = [
("base", "0024_fuzzy_to_pretranslated_strings"),
]
diff --git a/pontoon/base/migrations/0026_projectlocale_pretranslation_enabled.py b/pontoon/base/migrations/0026_projectlocale_pretranslation_enabled.py
index 9fd43c0aa6..d4c1b10a13 100644
--- a/pontoon/base/migrations/0026_projectlocale_pretranslation_enabled.py
+++ b/pontoon/base/migrations/0026_projectlocale_pretranslation_enabled.py
@@ -4,7 +4,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0025_remove_tm_entries_of_rejected"),
]
diff --git a/pontoon/base/migrations/0027_keep_pretranslation_enabled.py b/pontoon/base/migrations/0027_keep_pretranslation_enabled.py
index 23099c9fdd..4f05a94224 100644
--- a/pontoon/base/migrations/0027_keep_pretranslation_enabled.py
+++ b/pontoon/base/migrations/0027_keep_pretranslation_enabled.py
@@ -14,7 +14,6 @@ def propagate_pretranslation_enabled(apps, schema_editor):
class Migration(migrations.Migration):
-
dependencies = [
("base", "0026_projectlocale_pretranslation_enabled"),
]
diff --git a/pontoon/base/migrations/0028_userprofile_new_contributor_notifications.py b/pontoon/base/migrations/0028_userprofile_new_contributor_notifications.py
index d22295424f..0761f0a669 100644
--- a/pontoon/base/migrations/0028_userprofile_new_contributor_notifications.py
+++ b/pontoon/base/migrations/0028_userprofile_new_contributor_notifications.py
@@ -4,7 +4,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0027_keep_pretranslation_enabled"),
]
diff --git a/pontoon/base/migrations/0029_external_accounts.py b/pontoon/base/migrations/0029_external_accounts.py
index 60273db278..3f30d4d292 100644
--- a/pontoon/base/migrations/0029_external_accounts.py
+++ b/pontoon/base/migrations/0029_external_accounts.py
@@ -4,7 +4,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0028_userprofile_new_contributor_notifications"),
]
diff --git a/pontoon/base/migrations/0030_userprofile_username.py b/pontoon/base/migrations/0030_userprofile_username.py
index dc0dfa4c07..283900f9c3 100644
--- a/pontoon/base/migrations/0030_userprofile_username.py
+++ b/pontoon/base/migrations/0030_userprofile_username.py
@@ -4,7 +4,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0029_external_accounts"),
]
diff --git a/pontoon/base/migrations/0031_userprofile_bio.py b/pontoon/base/migrations/0031_userprofile_bio.py
index d21b6cb1bd..5d73cdf43a 100644
--- a/pontoon/base/migrations/0031_userprofile_bio.py
+++ b/pontoon/base/migrations/0031_userprofile_bio.py
@@ -4,7 +4,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0030_userprofile_username"),
]
diff --git a/pontoon/base/migrations/0032_user_profile_visibility.py b/pontoon/base/migrations/0032_user_profile_visibility.py
index d1164096f4..ffd2fed9be 100644
--- a/pontoon/base/migrations/0032_user_profile_visibility.py
+++ b/pontoon/base/migrations/0032_user_profile_visibility.py
@@ -4,7 +4,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0031_userprofile_bio"),
]
diff --git a/pontoon/base/migrations/0033_userprofile_contact_email.py b/pontoon/base/migrations/0033_userprofile_contact_email.py
index 0540551141..5c43fa0cda 100644
--- a/pontoon/base/migrations/0033_userprofile_contact_email.py
+++ b/pontoon/base/migrations/0033_userprofile_contact_email.py
@@ -4,7 +4,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0032_user_profile_visibility"),
]
diff --git a/pontoon/base/migrations/0034_rename_matrix_to_chat.py b/pontoon/base/migrations/0034_rename_matrix_to_chat.py
index c9b61d9f0e..c1b50349a8 100644
--- a/pontoon/base/migrations/0034_rename_matrix_to_chat.py
+++ b/pontoon/base/migrations/0034_rename_matrix_to_chat.py
@@ -4,7 +4,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0033_userprofile_contact_email"),
]
diff --git a/pontoon/base/migrations/0035_ratio_to_rate.py b/pontoon/base/migrations/0035_ratio_to_rate.py
index 0128d56408..f73f842654 100644
--- a/pontoon/base/migrations/0035_ratio_to_rate.py
+++ b/pontoon/base/migrations/0035_ratio_to_rate.py
@@ -4,7 +4,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0034_rename_matrix_to_chat"),
]
diff --git a/pontoon/base/migrations/0036_locale_google_automl_model.py b/pontoon/base/migrations/0036_locale_google_automl_model.py
index 8f56abd57c..cea9cc4df5 100644
--- a/pontoon/base/migrations/0036_locale_google_automl_model.py
+++ b/pontoon/base/migrations/0036_locale_google_automl_model.py
@@ -4,7 +4,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0035_ratio_to_rate"),
]
diff --git a/pontoon/base/migrations/0037_alter_locale_population.py b/pontoon/base/migrations/0037_alter_locale_population.py
index e109591a8e..953fbe7154 100644
--- a/pontoon/base/migrations/0037_alter_locale_population.py
+++ b/pontoon/base/migrations/0037_alter_locale_population.py
@@ -4,7 +4,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0036_locale_google_automl_model"),
]
diff --git a/pontoon/base/migrations/0038_userprofile_system_user.py b/pontoon/base/migrations/0038_userprofile_system_user.py
index 09031afaa1..79c71a38df 100644
--- a/pontoon/base/migrations/0038_userprofile_system_user.py
+++ b/pontoon/base/migrations/0038_userprofile_system_user.py
@@ -4,7 +4,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0037_alter_locale_population"),
]
diff --git a/pontoon/base/migrations/0039_mark_system_users.py b/pontoon/base/migrations/0039_mark_system_users.py
index c98ca8d456..30c14f0c7c 100644
--- a/pontoon/base/migrations/0039_mark_system_users.py
+++ b/pontoon/base/migrations/0039_mark_system_users.py
@@ -24,7 +24,6 @@ def revert_mark_system_users(apps, schema_editor):
class Migration(migrations.Migration):
-
initial = True
dependencies = [
diff --git a/pontoon/base/migrations/0040_remove_changed_entity_locale_entries_for_repository_projects.py b/pontoon/base/migrations/0040_remove_changed_entity_locale_entries_for_repository_projects.py
index 989fadaefd..f5d4a4987f 100644
--- a/pontoon/base/migrations/0040_remove_changed_entity_locale_entries_for_repository_projects.py
+++ b/pontoon/base/migrations/0040_remove_changed_entity_locale_entries_for_repository_projects.py
@@ -1,6 +1,6 @@
# Generated by Django 3.2.15 on 2023-02-23 16:02
from django.db import migrations
-from pontoon.base.models import Project, Resource, Entity, ChangedEntityLocale
+from pontoon.base.models import Project, ChangedEntityLocale
def remove_changed_entity_locale_entries_for_repository_projects(apps, schema_editor):
@@ -10,7 +10,6 @@ def remove_changed_entity_locale_entries_for_repository_projects(apps, schema_ed
class Migration(migrations.Migration):
-
initial = True
dependencies = [
diff --git a/pontoon/base/migrations/0041_alter_userprofile_visibility_email.py b/pontoon/base/migrations/0041_alter_userprofile_visibility_email.py
index 737a279522..9dc3c4b8db 100644
--- a/pontoon/base/migrations/0041_alter_userprofile_visibility_email.py
+++ b/pontoon/base/migrations/0041_alter_userprofile_visibility_email.py
@@ -4,7 +4,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0040_remove_changed_entity_locale_entries_for_repository_projects"),
]
diff --git a/pontoon/base/migrations/0042_locale_accesskey_localization.py b/pontoon/base/migrations/0042_locale_accesskey_localization.py
index ade163fb35..bb354be0db 100644
--- a/pontoon/base/migrations/0042_locale_accesskey_localization.py
+++ b/pontoon/base/migrations/0042_locale_accesskey_localization.py
@@ -4,7 +4,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0041_alter_userprofile_visibility_email"),
]
diff --git a/pontoon/base/migrations/0043_alter_locale_accesskey_localization.py b/pontoon/base/migrations/0043_alter_locale_accesskey_localization.py
index 983f626944..1224a58fd8 100644
--- a/pontoon/base/migrations/0043_alter_locale_accesskey_localization.py
+++ b/pontoon/base/migrations/0043_alter_locale_accesskey_localization.py
@@ -4,7 +4,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0042_locale_accesskey_localization"),
]
diff --git a/pontoon/base/migrations/0044_delete_subpage.py b/pontoon/base/migrations/0044_delete_subpage.py
index 2970409ee8..c2475b7913 100644
--- a/pontoon/base/migrations/0044_delete_subpage.py
+++ b/pontoon/base/migrations/0044_delete_subpage.py
@@ -4,7 +4,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0043_alter_locale_accesskey_localization"),
]
diff --git a/pontoon/base/migrations/0045_drop_project_links_url_width.py b/pontoon/base/migrations/0045_drop_project_links_url_width.py
index 48f23394bf..96474e892e 100644
--- a/pontoon/base/migrations/0045_drop_project_links_url_width.py
+++ b/pontoon/base/migrations/0045_drop_project_links_url_width.py
@@ -4,7 +4,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0044_delete_subpage"),
]
diff --git a/pontoon/base/migrations/0046_projectslughistory.py b/pontoon/base/migrations/0046_projectslughistory.py
index 92fd763665..a92a88936e 100644
--- a/pontoon/base/migrations/0046_projectslughistory.py
+++ b/pontoon/base/migrations/0046_projectslughistory.py
@@ -5,7 +5,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0045_drop_project_links_url_width"),
]
diff --git a/pontoon/base/migrations/0047_fix_lt_plural_rule.py b/pontoon/base/migrations/0047_fix_lt_plural_rule.py
index c4d832fb37..344b07e611 100644
--- a/pontoon/base/migrations/0047_fix_lt_plural_rule.py
+++ b/pontoon/base/migrations/0047_fix_lt_plural_rule.py
@@ -13,7 +13,6 @@ def fix_lt_plural_rule(apps, schema_editor):
class Migration(migrations.Migration):
-
dependencies = [
("base", "0046_projectslughistory"),
]
diff --git a/pontoon/base/migrations/0048_userprofile_theme.py b/pontoon/base/migrations/0048_userprofile_theme.py
index 5ed5fd1196..7d67cf2036 100644
--- a/pontoon/base/migrations/0048_userprofile_theme.py
+++ b/pontoon/base/migrations/0048_userprofile_theme.py
@@ -4,7 +4,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0047_fix_lt_plural_rule"),
]
diff --git a/pontoon/base/migrations/0049_fix_pluralform_data.py b/pontoon/base/migrations/0049_fix_pluralform_data.py
index 93c794bd70..710c2777bb 100644
--- a/pontoon/base/migrations/0049_fix_pluralform_data.py
+++ b/pontoon/base/migrations/0049_fix_pluralform_data.py
@@ -10,7 +10,6 @@ def fix_gettext_plural_forms(apps, schema_editor):
class Migration(migrations.Migration):
-
dependencies = [
("base", "0048_userprofile_theme"),
]
diff --git a/pontoon/base/migrations/0050_strings_xml_apostrophes.py b/pontoon/base/migrations/0050_strings_xml_apostrophes.py
index 6c90e7bd4a..4e7f234d26 100644
--- a/pontoon/base/migrations/0050_strings_xml_apostrophes.py
+++ b/pontoon/base/migrations/0050_strings_xml_apostrophes.py
@@ -31,7 +31,6 @@ def unescape_strings_xml_apostrophes(apps, schema_editor):
class Migration(migrations.Migration):
-
dependencies = [
("base", "0049_fix_pluralform_data"),
]
diff --git a/pontoon/base/migrations/0051_localecodehistory.py b/pontoon/base/migrations/0051_localecodehistory.py
index cf23f0232e..95371b6401 100644
--- a/pontoon/base/migrations/0051_localecodehistory.py
+++ b/pontoon/base/migrations/0051_localecodehistory.py
@@ -5,7 +5,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0050_strings_xml_apostrophes"),
]
diff --git a/pontoon/base/migrations/0052_rename_logged_in_users.py b/pontoon/base/migrations/0052_rename_logged_in_users.py
index f9faed4ea1..0bf91828f7 100644
--- a/pontoon/base/migrations/0052_rename_logged_in_users.py
+++ b/pontoon/base/migrations/0052_rename_logged_in_users.py
@@ -11,7 +11,6 @@ def rename_logged_in_users(apps, schema_editor):
class Migration(migrations.Migration):
-
dependencies = [
("base", "0051_localecodehistory"),
]
diff --git a/pontoon/base/migrations/0053_alter_translation_index_together.py b/pontoon/base/migrations/0053_alter_translation_index_together.py
index 8f6bde78f1..109181ed20 100644
--- a/pontoon/base/migrations/0053_alter_translation_index_together.py
+++ b/pontoon/base/migrations/0053_alter_translation_index_together.py
@@ -5,7 +5,6 @@
class Migration(migrations.Migration):
-
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
("base", "0052_rename_logged_in_users"),
diff --git a/pontoon/base/migrations/0054_resource_order.py b/pontoon/base/migrations/0054_resource_order.py
index 622f2bf5af..a55cad020d 100644
--- a/pontoon/base/migrations/0054_resource_order.py
+++ b/pontoon/base/migrations/0054_resource_order.py
@@ -4,7 +4,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0053_alter_translation_index_together"),
]
diff --git a/pontoon/base/migrations/0055_populate_resource_order.py b/pontoon/base/migrations/0055_populate_resource_order.py
index cd3d62a483..1665ae6d1b 100644
--- a/pontoon/base/migrations/0055_populate_resource_order.py
+++ b/pontoon/base/migrations/0055_populate_resource_order.py
@@ -25,7 +25,6 @@ def reset_resource_order(apps, schema_editor):
class Migration(migrations.Migration):
-
dependencies = [
("base", "0054_resource_order"),
]
diff --git a/pontoon/base/migrations/0056_remove_fuzzy_and_non-approved_tm_entries.py b/pontoon/base/migrations/0056_remove_fuzzy_and_non-approved_tm_entries.py
index b58108ab8c..b46392e3f7 100644
--- a/pontoon/base/migrations/0056_remove_fuzzy_and_non-approved_tm_entries.py
+++ b/pontoon/base/migrations/0056_remove_fuzzy_and_non-approved_tm_entries.py
@@ -12,7 +12,6 @@ def remove_unused_tm_entries(apps, schema_editor):
class Migration(migrations.Migration):
-
dependencies = [
("base", "0055_populate_resource_order"),
]
diff --git a/pontoon/base/migrations/0057_remove_lang_format.py b/pontoon/base/migrations/0057_remove_lang_format.py
index 936291b346..8da48519f9 100644
--- a/pontoon/base/migrations/0057_remove_lang_format.py
+++ b/pontoon/base/migrations/0057_remove_lang_format.py
@@ -4,7 +4,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0056_remove_fuzzy_and_non-approved_tm_entries"),
]
diff --git a/pontoon/base/migrations/0058_remove_tr_tr_collation.py b/pontoon/base/migrations/0058_remove_tr_tr_collation.py
index 9a5c14fdfd..bac690c7dd 100644
--- a/pontoon/base/migrations/0058_remove_tr_tr_collation.py
+++ b/pontoon/base/migrations/0058_remove_tr_tr_collation.py
@@ -4,7 +4,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0057_remove_lang_format"),
]
diff --git a/pontoon/base/migrations/0059_alter_translation_machinery_sources.py b/pontoon/base/migrations/0059_alter_translation_machinery_sources.py
index 7fcb5ece61..6d845df6e5 100644
--- a/pontoon/base/migrations/0059_alter_translation_machinery_sources.py
+++ b/pontoon/base/migrations/0059_alter_translation_machinery_sources.py
@@ -5,7 +5,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0058_remove_tr_tr_collation"),
]
diff --git a/pontoon/base/migrations/0060_rename_entity_resource_obsolete_string_plural_base_entity_resourc_f99fa1_idx_and_more.py b/pontoon/base/migrations/0060_rename_entity_resource_obsolete_string_plural_base_entity_resourc_f99fa1_idx_and_more.py
index ae4ecd7b14..d02823c18e 100644
--- a/pontoon/base/migrations/0060_rename_entity_resource_obsolete_string_plural_base_entity_resourc_f99fa1_idx_and_more.py
+++ b/pontoon/base/migrations/0060_rename_entity_resource_obsolete_string_plural_base_entity_resourc_f99fa1_idx_and_more.py
@@ -4,7 +4,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0059_alter_translation_machinery_sources"),
]
diff --git a/pontoon/base/migrations/0061_userprofile_email_communications_enabled.py b/pontoon/base/migrations/0061_userprofile_email_communications_enabled.py
index a828704904..a4f43c036d 100644
--- a/pontoon/base/migrations/0061_userprofile_email_communications_enabled.py
+++ b/pontoon/base/migrations/0061_userprofile_email_communications_enabled.py
@@ -4,7 +4,6 @@
class Migration(migrations.Migration):
-
dependencies = [
(
"base",
diff --git a/pontoon/base/migrations/0062_userprofile_email_consent_dismissed_at.py b/pontoon/base/migrations/0062_userprofile_email_consent_dismissed_at.py
index 3a3fed8645..fb0cad06e9 100644
--- a/pontoon/base/migrations/0062_userprofile_email_consent_dismissed_at.py
+++ b/pontoon/base/migrations/0062_userprofile_email_consent_dismissed_at.py
@@ -4,7 +4,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0061_userprofile_email_communications_enabled"),
]
diff --git a/pontoon/base/migrations/0063_userprofile_unique_id.py b/pontoon/base/migrations/0063_userprofile_unique_id.py
index f34c28ef73..3e811058f5 100644
--- a/pontoon/base/migrations/0063_userprofile_unique_id.py
+++ b/pontoon/base/migrations/0063_userprofile_unique_id.py
@@ -5,7 +5,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0062_userprofile_email_consent_dismissed_at"),
]
diff --git a/pontoon/base/migrations/0064_populate_unique_id.py b/pontoon/base/migrations/0064_populate_unique_id.py
index 8d5e1e25c0..c655800691 100644
--- a/pontoon/base/migrations/0064_populate_unique_id.py
+++ b/pontoon/base/migrations/0064_populate_unique_id.py
@@ -13,7 +13,6 @@ def populate_unique_id(apps, schema_editor):
class Migration(migrations.Migration):
-
dependencies = [
("base", "0063_userprofile_unique_id"),
]
diff --git a/pontoon/base/models/translation_memory.py b/pontoon/base/models/translation_memory.py
index 1744f7029a..3a0b4fb516 100644
--- a/pontoon/base/models/translation_memory.py
+++ b/pontoon/base/models/translation_memory.py
@@ -109,7 +109,9 @@ def python_levenshtein_ratio(self, text, min_quality, min_dist, max_dist):
matches_pks.append(pk)
quality_sql_map.append(When(pk=pk, then=Value(quality * 100)))
- entries = self.filter(pk__in=matches_pks,).annotate(
+ entries = self.filter(
+ pk__in=matches_pks,
+ ).annotate(
quality=Case(
*quality_sql_map,
**dict(
diff --git a/pontoon/base/tests/models/test_repository.py b/pontoon/base/tests/models/test_repository.py
index 9530fb2b6b..ddd756e12c 100644
--- a/pontoon/base/tests/models/test_repository.py
+++ b/pontoon/base/tests/models/test_repository.py
@@ -131,9 +131,10 @@ def test_repo_url_for_path_no_match(repo_git, locale_a, settings):
@pytest.mark.django_db
def test_repo_pull(repo_git):
- with patch("pontoon.sync.repositories.update_from_vcs") as m_update_from_vcs, patch(
- "pontoon.sync.repositories.get_revision"
- ) as m_get_revision:
+ with (
+ patch("pontoon.sync.repositories.update_from_vcs") as m_update_from_vcs,
+ patch("pontoon.sync.repositories.get_revision") as m_get_revision,
+ ):
repo_git.url = "https://example.com"
m_get_revision.return_value = "asdf"
assert repo_git.pull() == {"single_locale": "asdf"}
diff --git a/pontoon/base/tests/models/test_stats.py b/pontoon/base/tests/models/test_stats.py
index 3f75613e89..2100e10728 100644
--- a/pontoon/base/tests/models/test_stats.py
+++ b/pontoon/base/tests/models/test_stats.py
@@ -1,6 +1,7 @@
"""
Test consistency of calculations between `calculate_stats` and `translation.save()`.
"""
+
import pytest
from pontoon.base.models import TranslatedResource
from pontoon.checks.models import (
diff --git a/pontoon/base/tests/views/test_ajax.py b/pontoon/base/tests/views/test_ajax.py
index 68b5f67809..d50e208ecb 100644
--- a/pontoon/base/tests/views/test_ajax.py
+++ b/pontoon/base/tests/views/test_ajax.py
@@ -9,9 +9,10 @@
def test_view_ajax_form(rf):
- with patch("pontoon.base.views.AjaxFormView.get_form") as form_m, patch(
- "pontoon.base.views.AjaxFormView.render_to_response"
- ) as response_m:
+ with (
+ patch("pontoon.base.views.AjaxFormView.get_form") as form_m,
+ patch("pontoon.base.views.AjaxFormView.render_to_response") as response_m,
+ ):
form_m.return_value = 7
response_m.return_value = 23
@@ -28,8 +29,9 @@ def test_view_ajax_form(rf):
def test_view_ajax_form_post(rf):
- with patch("pontoon.base.views.AjaxFormPostView.get_form") as form_m, patch(
- "pontoon.base.views.AjaxFormPostView.render_to_response"
+ with (
+ patch("pontoon.base.views.AjaxFormPostView.get_form") as form_m,
+ patch("pontoon.base.views.AjaxFormPostView.render_to_response"),
):
with pytest.raises(Http404):
AjaxFormPostView.as_view()(rf.get("/foo/bar"))
@@ -41,9 +43,10 @@ def test_view_ajax_form_post(rf):
def test_view_ajax_form_submit_bad(rf):
- with patch("pontoon.base.views.AjaxFormView.get_form") as form_m, patch(
- "pontoon.base.views.AjaxFormView.render_to_response"
- ) as response_m:
+ with (
+ patch("pontoon.base.views.AjaxFormView.get_form") as form_m,
+ patch("pontoon.base.views.AjaxFormView.render_to_response") as response_m,
+ ):
_form = MagicMock()
_form.is_valid.return_value = False
type(_form).errors = PropertyMock(return_value=["BAD", "STUFF"])
@@ -68,8 +71,9 @@ def test_view_ajax_form_submit_bad(rf):
def test_view_ajax_form_submit_success(rf):
- with patch("pontoon.base.views.AjaxFormView.get_form") as form_m, patch(
- "pontoon.base.views.AjaxFormView.render_to_response"
+ with (
+ patch("pontoon.base.views.AjaxFormView.get_form") as form_m,
+ patch("pontoon.base.views.AjaxFormView.render_to_response"),
):
_form = MagicMock()
_form.is_valid.return_value = True
diff --git a/pontoon/base/utils.py b/pontoon/base/utils.py
index 2c818257bb..96a58c8db6 100644
--- a/pontoon/base/utils.py
+++ b/pontoon/base/utils.py
@@ -470,7 +470,7 @@ def sanitize_xml_input_string(string):
"""
illegal_xml_chars_re = re.compile(
- "[\x00-\x08\x0b\x0c\x0e-\x1F\uD800-\uDFFF\uFFFE\uFFFF]"
+ "[\x00-\x08\x0b\x0c\x0e-\x1f\ud800-\udfff\ufffe\uffff]"
)
return illegal_xml_chars_re.sub("", string)
diff --git a/pontoon/checks/tests/test_pontoon_db.py b/pontoon/checks/tests/test_pontoon_db.py
index 266bdbf669..516f5c489a 100644
--- a/pontoon/checks/tests/test_pontoon_db.py
+++ b/pontoon/checks/tests/test_pontoon_db.py
@@ -58,50 +58,41 @@ def test_empty_translations(get_entity_mock):
== {}
)
- assert (
- run_checks(
- get_entity_mock("ftl", string="key =\n .attr = value"),
- "",
- """key =
+ assert run_checks(
+ get_entity_mock("ftl", string="key =\n .attr = value"),
+ "",
+ """key =
{ $var ->
[a] { "" }
*[b] { "" }
}
.attr = { "" }
""",
- )
- == {"pndbWarnings": ["Empty translation"]}
- )
+ ) == {"pndbWarnings": ["Empty translation"]}
- assert (
- run_checks(
- get_entity_mock("ftl", string="key =\n .attr = value"),
- "",
- """key =
+ assert run_checks(
+ get_entity_mock("ftl", string="key =\n .attr = value"),
+ "",
+ """key =
{ $var ->
[a] { "x" }
*[b] { "y" }
}
.attr = { "" }
""",
- )
- == {"pndbWarnings": ["Empty translation"]}
- )
+ ) == {"pndbWarnings": ["Empty translation"]}
- assert (
- run_checks(
- get_entity_mock("ftl", string="key =\n .attr = value"),
- "",
- """key =
+ assert run_checks(
+ get_entity_mock("ftl", string="key =\n .attr = value"),
+ "",
+ """key =
{ $var ->
[a] { "x" }
*[b] { "" }
}
.attr = { "y" }
""",
- )
- == {"pndbWarnings": ["Empty translation"]}
- )
+ ) == {"pndbWarnings": ["Empty translation"]}
assert (
run_checks(
diff --git a/pontoon/db/migrations.py b/pontoon/db/migrations.py
index 8b1be1c4f8..355a64b83f 100644
--- a/pontoon/db/migrations.py
+++ b/pontoon/db/migrations.py
@@ -5,6 +5,7 @@
Because of that I decided to implement our migrations with intent to drop it when django develops
its own solution.
"""
+
import copy
from django.db.migrations.operations.base import Operation
diff --git a/pontoon/db/tests/test_lookups.py b/pontoon/db/tests/test_lookups.py
index b49e512976..0c774ea3b7 100644
--- a/pontoon/db/tests/test_lookups.py
+++ b/pontoon/db/tests/test_lookups.py
@@ -1,6 +1,7 @@
"""
Collation lookups allow a user to set text-collation to search queries.
"""
+
import pytest
from pontoon.db import IContainsCollate # noqa
diff --git a/pontoon/homepage/migrations/0002_initial_data.py b/pontoon/homepage/migrations/0002_initial_data.py
index 28767f58cf..13e78d5f87 100644
--- a/pontoon/homepage/migrations/0002_initial_data.py
+++ b/pontoon/homepage/migrations/0002_initial_data.py
@@ -28,7 +28,6 @@ def remove_homepage_entry(apps, schema_editor):
class Migration(migrations.Migration):
-
dependencies = [
("homepage", "0001_squashed_0002_add_homepage_content"),
]
diff --git a/pontoon/insights/migrations/0001_initial.py b/pontoon/insights/migrations/0001_initial.py
index c7f56a84e5..0ae4dbcac7 100644
--- a/pontoon/insights/migrations/0001_initial.py
+++ b/pontoon/insights/migrations/0001_initial.py
@@ -7,7 +7,6 @@
class Migration(migrations.Migration):
-
initial = True
dependencies = [
diff --git a/pontoon/insights/migrations/0002_project_projectlocale.py b/pontoon/insights/migrations/0002_project_projectlocale.py
index 716f75218b..4b22944ea5 100644
--- a/pontoon/insights/migrations/0002_project_projectlocale.py
+++ b/pontoon/insights/migrations/0002_project_projectlocale.py
@@ -6,7 +6,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0012_auto_20201020_1830"),
("insights", "0001_initial"),
diff --git a/pontoon/insights/migrations/0003_project_insights.py b/pontoon/insights/migrations/0003_project_insights.py
index fffa0cefbe..8464a876bb 100644
--- a/pontoon/insights/migrations/0003_project_insights.py
+++ b/pontoon/insights/migrations/0003_project_insights.py
@@ -6,7 +6,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("insights", "0002_project_projectlocale"),
]
diff --git a/pontoon/insights/migrations/0004_project_insights_data.py b/pontoon/insights/migrations/0004_project_insights_data.py
index 530ed3a856..58ac592cf5 100644
--- a/pontoon/insights/migrations/0004_project_insights_data.py
+++ b/pontoon/insights/migrations/0004_project_insights_data.py
@@ -98,7 +98,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("insights", "0003_project_insights"),
]
diff --git a/pontoon/insights/migrations/0005_projectlocale_insights.py b/pontoon/insights/migrations/0005_projectlocale_insights.py
index b52d2efa8d..6023265999 100644
--- a/pontoon/insights/migrations/0005_projectlocale_insights.py
+++ b/pontoon/insights/migrations/0005_projectlocale_insights.py
@@ -6,7 +6,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("insights", "0004_project_insights_data"),
]
diff --git a/pontoon/insights/migrations/0006_projectlocale_insights_data.py b/pontoon/insights/migrations/0006_projectlocale_insights_data.py
index 7aa76f3b63..6fe2e3a968 100644
--- a/pontoon/insights/migrations/0006_projectlocale_insights_data.py
+++ b/pontoon/insights/migrations/0006_projectlocale_insights_data.py
@@ -100,7 +100,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("insights", "0005_projectlocale_insights"),
]
diff --git a/pontoon/insights/migrations/0007_time_to_review_suggestions.py b/pontoon/insights/migrations/0007_time_to_review_suggestions.py
index 4db6aafd69..ea8a873569 100644
--- a/pontoon/insights/migrations/0007_time_to_review_suggestions.py
+++ b/pontoon/insights/migrations/0007_time_to_review_suggestions.py
@@ -5,7 +5,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("insights", "0006_projectlocale_insights_data"),
]
diff --git a/pontoon/insights/migrations/0008_time_to_review_suggestions_data.py b/pontoon/insights/migrations/0008_time_to_review_suggestions_data.py
index 2053a69ea7..06f18306ba 100644
--- a/pontoon/insights/migrations/0008_time_to_review_suggestions_data.py
+++ b/pontoon/insights/migrations/0008_time_to_review_suggestions_data.py
@@ -1,6 +1,6 @@
# Generated by Django 3.2.4 on 2021-11-30 19:56
-from datetime import datetime, timedelta
+from datetime import timedelta
from django.db import migrations
from django.db.models import F
@@ -68,7 +68,6 @@ def reset_time_to_review_suggestions(apps, schema_editor):
class Migration(migrations.Migration):
-
dependencies = [
("insights", "0007_time_to_review_suggestions"),
]
diff --git a/pontoon/insights/migrations/0009_fix_projectlocale_insights_data.py b/pontoon/insights/migrations/0009_fix_projectlocale_insights_data.py
index 81fdce9ed7..28f8bd405c 100644
--- a/pontoon/insights/migrations/0009_fix_projectlocale_insights_data.py
+++ b/pontoon/insights/migrations/0009_fix_projectlocale_insights_data.py
@@ -100,7 +100,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("insights", "0008_time_to_review_suggestions_data"),
]
diff --git a/pontoon/insights/migrations/0010_fuzzy_to_pretranslated_strings.py b/pontoon/insights/migrations/0010_fuzzy_to_pretranslated_strings.py
index 071e21f6f7..9dbdc14653 100644
--- a/pontoon/insights/migrations/0010_fuzzy_to_pretranslated_strings.py
+++ b/pontoon/insights/migrations/0010_fuzzy_to_pretranslated_strings.py
@@ -4,7 +4,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("base", "0024_fuzzy_to_pretranslated_strings"),
("insights", "0009_fix_projectlocale_insights_data"),
diff --git a/pontoon/insights/migrations/0011_time_to_review_pretranslations.py b/pontoon/insights/migrations/0011_time_to_review_pretranslations.py
index 96195354a7..b522c95659 100644
--- a/pontoon/insights/migrations/0011_time_to_review_pretranslations.py
+++ b/pontoon/insights/migrations/0011_time_to_review_pretranslations.py
@@ -4,7 +4,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("insights", "0010_fuzzy_to_pretranslated_strings"),
]
diff --git a/pontoon/insights/migrations/0012_time_to_review_pretranslations_data.py b/pontoon/insights/migrations/0012_time_to_review_pretranslations_data.py
index 229da51840..e8ff56ce4d 100644
--- a/pontoon/insights/migrations/0012_time_to_review_pretranslations_data.py
+++ b/pontoon/insights/migrations/0012_time_to_review_pretranslations_data.py
@@ -1,6 +1,6 @@
# Generated by Django 3.2.4 on 2021-11-30 19:56
-from datetime import datetime, timedelta
+from datetime import timedelta
from django.db import migrations
from django.db.models import F
@@ -73,7 +73,6 @@ def reset_time_to_review_pretranslations(apps, schema_editor):
class Migration(migrations.Migration):
-
dependencies = [
("insights", "0011_time_to_review_pretranslations"),
]
diff --git a/pontoon/insights/migrations/0013_pretranslation_quality.py b/pontoon/insights/migrations/0013_pretranslation_quality.py
index 3a2e1b57bb..d601733dbc 100644
--- a/pontoon/insights/migrations/0013_pretranslation_quality.py
+++ b/pontoon/insights/migrations/0013_pretranslation_quality.py
@@ -4,7 +4,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("insights", "0012_time_to_review_pretranslations_data"),
]
diff --git a/pontoon/insights/migrations/0014_pretranslation_quality_data.py b/pontoon/insights/migrations/0014_pretranslation_quality_data.py
index 88b029da77..ecec5b14cd 100644
--- a/pontoon/insights/migrations/0014_pretranslation_quality_data.py
+++ b/pontoon/insights/migrations/0014_pretranslation_quality_data.py
@@ -2,7 +2,6 @@
import statistics
-from datetime import datetime, timedelta
from django.db import migrations
from django.db.models import F
from sacrebleu.metrics import CHRF
@@ -177,7 +176,6 @@ def reset_pretranslation_quality(apps, schema_editor):
class Migration(migrations.Migration):
-
dependencies = [
("insights", "0013_pretranslation_quality"),
]
diff --git a/pontoon/insights/migrations/0015_fix_projectlocale_insights_data.py b/pontoon/insights/migrations/0015_fix_projectlocale_insights_data.py
index f0738a825c..8ded574d26 100644
--- a/pontoon/insights/migrations/0015_fix_projectlocale_insights_data.py
+++ b/pontoon/insights/migrations/0015_fix_projectlocale_insights_data.py
@@ -100,7 +100,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("insights", "0014_pretranslation_quality_data"),
]
diff --git a/pontoon/insights/utils.py b/pontoon/insights/utils.py
index 8fa3b075b5..d6a03f2260 100644
--- a/pontoon/insights/utils.py
+++ b/pontoon/insights/utils.py
@@ -60,7 +60,8 @@ def get_time_to_review_12_month_avg(category, query_filters=None):
.values(
"month",
f"time_to_review_{category}_avg",
- ).order_by("month")
+ )
+ .order_by("month")
)
times_to_review = [x[f"time_to_review_{category}_avg"] for x in insights]
diff --git a/pontoon/messaging/tests/test_views.py b/pontoon/messaging/tests/test_views.py
index 2ae8ac0c39..6e208266ad 100644
--- a/pontoon/messaging/tests/test_views.py
+++ b/pontoon/messaging/tests/test_views.py
@@ -7,14 +7,14 @@
def test_dismiss_email_consent(member):
"""Test if dismiss_email_consent view works and fails as expected."""
params = {}
- response = member.client.post(f"/dismiss-email-consent/", params)
+ response = member.client.post("/dismiss-email-consent/", params)
assert response.status_code == 400
assert response.json()["message"] == "Bad Request: Value not set"
params = {
"value": "false",
}
- response = member.client.post(f"/dismiss-email-consent/", params)
+ response = member.client.post("/dismiss-email-consent/", params)
profile = User.objects.get(pk=member.user.pk).profile
assert profile.email_communications_enabled is False
assert profile.email_consent_dismissed_at is not None
@@ -24,7 +24,7 @@ def test_dismiss_email_consent(member):
params = {
"value": "true",
}
- response = member.client.post(f"/dismiss-email-consent/", params)
+ response = member.client.post("/dismiss-email-consent/", params)
profile = User.objects.get(pk=member.user.pk).profile
assert profile.email_communications_enabled is True
assert profile.email_consent_dismissed_at is not None
diff --git a/pontoon/settings/base.py b/pontoon/settings/base.py
index 6a741520a4..879d43fde5 100644
--- a/pontoon/settings/base.py
+++ b/pontoon/settings/base.py
@@ -1,4 +1,5 @@
"""Django settings for Pontoon."""
+
import re
import os
import socket
diff --git a/pontoon/settings/dev.py b/pontoon/settings/dev.py
index 80b6b08120..57897519dd 100644
--- a/pontoon/settings/dev.py
+++ b/pontoon/settings/dev.py
@@ -1,5 +1,5 @@
-"""A various settings that enable additional packages that are helpful in day to day development.
-"""
+"""A various settings that enable additional packages that are helpful in day to day development."""
+
import copy
import re
from . import base
diff --git a/pontoon/sync/formats/__init__.py b/pontoon/sync/formats/__init__.py
index 9a8c0444e7..60e84cdf08 100644
--- a/pontoon/sync/formats/__init__.py
+++ b/pontoon/sync/formats/__init__.py
@@ -3,6 +3,7 @@
See base.py for the ParsedResource base class.
"""
+
import os.path
import fnmatch
diff --git a/pontoon/sync/formats/json_extensions.py b/pontoon/sync/formats/json_extensions.py
index 50c91afcd3..833696ad41 100644
--- a/pontoon/sync/formats/json_extensions.py
+++ b/pontoon/sync/formats/json_extensions.py
@@ -5,6 +5,7 @@
See also:
https://www.chromium.org/developers/design-documents/extensions/how-the-extension-system-works/i18n
"""
+
import copy
import logging
diff --git a/pontoon/sync/formats/json_keyvalue.py b/pontoon/sync/formats/json_keyvalue.py
index 811cd355a5..8802826cf0 100644
--- a/pontoon/sync/formats/json_keyvalue.py
+++ b/pontoon/sync/formats/json_keyvalue.py
@@ -8,6 +8,7 @@
A key can contain any character.
Nested keys are internally stored as a JSON array.
"""
+
import json
import logging
@@ -109,7 +110,7 @@ def traverse_json(self, data, function, keys=[]):
currentKey.append(key)
if isinstance(value, dict):
self.traverse_json(value, function, keys=currentKey)
- elif type(value) == str:
+ elif isinstance(value, str):
internal_key = json.dumps(currentKey)
dot_key = ".".join(currentKey)
function(internal_key, dot_key, value)
diff --git a/pontoon/sync/formats/po.py b/pontoon/sync/formats/po.py
index 95b4d59d35..ba3651ea12 100644
--- a/pontoon/sync/formats/po.py
+++ b/pontoon/sync/formats/po.py
@@ -1,6 +1,7 @@
"""
Parser for to pofile translation format.
"""
+
from datetime import datetime
from django.utils import timezone
@@ -90,9 +91,9 @@ def save(self, locale):
"%Y-%m-%d %H:%M%z"
)
if latest_translation.last_translator:
- metadata[
- "Last-Translator"
- ] = latest_translation.last_translator.display_name_and_email
+ metadata["Last-Translator"] = (
+ latest_translation.last_translator.display_name_and_email
+ )
metadata.update(
{
diff --git a/pontoon/sync/formats/silme.py b/pontoon/sync/formats/silme.py
index ae990aa434..9d984eae77 100644
--- a/pontoon/sync/formats/silme.py
+++ b/pontoon/sync/formats/silme.py
@@ -1,6 +1,7 @@
"""
Parser for silme-compatible translation formats.
"""
+
import codecs
import silme
@@ -120,7 +121,6 @@ def __init__(self, parser, path, source_resource=None):
current_order = 0
for obj in self.structure:
if isinstance(obj, silme.core.entity.Entity):
-
if self.escape_quotes_on:
obj.value = unescape_quotes(obj.value)
diff --git a/pontoon/sync/formats/xliff.py b/pontoon/sync/formats/xliff.py
index b7c47941e0..89ec1af39e 100644
--- a/pontoon/sync/formats/xliff.py
+++ b/pontoon/sync/formats/xliff.py
@@ -1,6 +1,7 @@
"""
Parser for the xliff translation format.
"""
+
from lxml import etree
from translate.storage import xliff
import copy
diff --git a/pontoon/sync/formats/xml.py b/pontoon/sync/formats/xml.py
index f54456027f..853cb73414 100644
--- a/pontoon/sync/formats/xml.py
+++ b/pontoon/sync/formats/xml.py
@@ -1,6 +1,7 @@
"""
Parser for the strings.xml file format.
"""
+
import logging
from collections import OrderedDict
diff --git a/pontoon/sync/migrations/0001_squashed_0004_add-sync-system-user.py b/pontoon/sync/migrations/0001_squashed_0004_add-sync-system-user.py
index 3342e05206..8b1022a846 100644
--- a/pontoon/sync/migrations/0001_squashed_0004_add-sync-system-user.py
+++ b/pontoon/sync/migrations/0001_squashed_0004_add-sync-system-user.py
@@ -5,7 +5,6 @@
class Migration(migrations.Migration):
-
initial = True
dependencies = [
diff --git a/pontoon/sync/migrations/0002_change_pontoon_sync_email.py b/pontoon/sync/migrations/0002_change_pontoon_sync_email.py
index eb3ebd385e..810b67fcfb 100644
--- a/pontoon/sync/migrations/0002_change_pontoon_sync_email.py
+++ b/pontoon/sync/migrations/0002_change_pontoon_sync_email.py
@@ -32,7 +32,6 @@ def remove_sync_user(apps, schema_editor):
class Migration(migrations.Migration):
-
initial = True
dependencies = [
diff --git a/pontoon/sync/repositories/svn.py b/pontoon/sync/repositories/svn.py
index 6ceef60acd..496a00963f 100644
--- a/pontoon/sync/repositories/svn.py
+++ b/pontoon/sync/repositories/svn.py
@@ -85,9 +85,9 @@ def get_svn_env():
"""Return an environment dict for running SVN in."""
if settings.SVN_LD_LIBRARY_PATH:
env = environ.copy()
- env[
- "LD_LIBRARY_PATH"
- ] = f"{settings.SVN_LD_LIBRARY_PATH}:{env['LD_LIBRARY_PATH']}"
+ env["LD_LIBRARY_PATH"] = (
+ f"{settings.SVN_LD_LIBRARY_PATH}:{env['LD_LIBRARY_PATH']}"
+ )
return env
else:
return None
diff --git a/pontoon/sync/tests/formats/test_ftl.py b/pontoon/sync/tests/formats/test_ftl.py
index f52846dca4..b4eeeeb387 100644
--- a/pontoon/sync/tests/formats/test_ftl.py
+++ b/pontoon/sync/tests/formats/test_ftl.py
@@ -269,9 +269,7 @@ def test_save_translation_missing(self):
"""
String = Translated String
{expected_translation}
- """.format(
- expected_translation=expected_translation
- )
+ """.format(expected_translation=expected_translation)
)
self.run_save_translation_missing(
diff --git a/pontoon/sync/tests/test_vcs_models.py b/pontoon/sync/tests/test_vcs_models.py
index b672ee5830..b8bb3a32c8 100644
--- a/pontoon/sync/tests/test_vcs_models.py
+++ b/pontoon/sync/tests/test_vcs_models.py
@@ -230,13 +230,15 @@ def vcs_resource_constructor(project, path, locales=None):
return "successful resource"
changed_vcs_resources = {"success": [], "failure": []}
- with patch("pontoon.sync.vcs.project.VCSResource") as MockVCSResource, patch(
- "pontoon.sync.vcs.project.log"
- ) as mock_log, patch.object(
- VCSProject,
- "changed_files",
- new_callable=PropertyMock,
- return_value=changed_vcs_resources,
+ with (
+ patch("pontoon.sync.vcs.project.VCSResource") as MockVCSResource,
+ patch("pontoon.sync.vcs.project.log") as mock_log,
+ patch.object(
+ VCSProject,
+ "changed_files",
+ new_callable=PropertyMock,
+ return_value=changed_vcs_resources,
+ ),
):
MockVCSResource.side_effect = vcs_resource_constructor
@@ -281,8 +283,9 @@ def test_resource_paths_without_config_region_properties(
self.project.repositories.all().delete()
self.project.repositories.add(RepositoryFactory.create(url=url))
- with patch("pontoon.sync.vcs.project.os", wraps=os) as mock_os, patch(
- "pontoon.sync.vcs.project.MOZILLA_REPOS", [url]
+ with (
+ patch("pontoon.sync.vcs.project.os", wraps=os) as mock_os,
+ patch("pontoon.sync.vcs.project.MOZILLA_REPOS", [url]),
):
mock_os.walk.return_value = [
("/root", [], ["foo.pot", "region.properties"])
@@ -580,14 +583,17 @@ class VCSChangedConfigFilesTests(FakeCheckoutTestCase):
def test_no_config_changes(self):
changed_source_files = {"file1.po": [], "test.toml": []}
- with patch.object(
- self.vcs_project, "configuration"
- ) as changed_config_files_mock, patch.object(
- self.vcs_project, "changed_source_files", return_value=changed_source_files
- ) as changed_source_files_mock:
- changed_config_files_mock.parsed_configuration.configs.__iter__.return_value = (
- set()
- )
+ with (
+ patch.object(
+ self.vcs_project, "configuration"
+ ) as changed_config_files_mock,
+ patch.object(
+ self.vcs_project,
+ "changed_source_files",
+ return_value=changed_source_files,
+ ) as changed_source_files_mock,
+ ):
+ changed_config_files_mock.parsed_configuration.configs.__iter__.return_value = set()
changed_source_files_mock.__getitem__.return_value = changed_source_files
self.assertSetEqual(self.vcs_project.changed_config_files, set())
@@ -604,14 +610,17 @@ def test_changed_config_files(self):
"test-l10n.toml": [],
}
- with patch.object(
- self.vcs_project, "configuration"
- ) as changed_config_files_mock, patch.object(
- self.vcs_project, "changed_source_files", return_value=changed_source_files
- ) as changed_source_files_mock:
- changed_config_files_mock.parsed_configuration.configs.__iter__.return_value = (
- changed_config_files
- )
+ with (
+ patch.object(
+ self.vcs_project, "configuration"
+ ) as changed_config_files_mock,
+ patch.object(
+ self.vcs_project,
+ "changed_source_files",
+ return_value=changed_source_files,
+ ) as changed_source_files_mock,
+ ):
+ changed_config_files_mock.parsed_configuration.configs.__iter__.return_value = changed_config_files
changed_source_files_mock.__getitem__.return_value = changed_source_files
self.assertSetEqual(
diff --git a/pontoon/sync/vcs/resource.py b/pontoon/sync/vcs/resource.py
index e5377fb37c..e31fc6334f 100644
--- a/pontoon/sync/vcs/resource.py
+++ b/pontoon/sync/vcs/resource.py
@@ -127,9 +127,9 @@ def __init__(self, vcs_project, path, locales=None):
for translation in resource_file.translations:
try:
- self.entities[translation.key].translations[
- locale.code
- ] = translation
+ self.entities[translation.key].translations[locale.code] = (
+ translation
+ )
except KeyError:
# If the source is missing an entity, we consider it
# deleted and don't add it.
diff --git a/pontoon/tags/migrations/0001_squashed_0002_set_tag_priority_choices.py b/pontoon/tags/migrations/0001_squashed_0002_set_tag_priority_choices.py
index 6f9ba92f5c..6dd4b89115 100644
--- a/pontoon/tags/migrations/0001_squashed_0002_set_tag_priority_choices.py
+++ b/pontoon/tags/migrations/0001_squashed_0002_set_tag_priority_choices.py
@@ -4,7 +4,6 @@
class Migration(migrations.Migration):
-
initial = True
dependencies = [
diff --git a/pontoon/teams/tests/test_utils.py b/pontoon/teams/tests/test_utils.py
index a5719c5738..ea70dd1205 100644
--- a/pontoon/teams/tests/test_utils.py
+++ b/pontoon/teams/tests/test_utils.py
@@ -1,6 +1,7 @@
"""
Tests related to the utils provided in pontoon.teams.libraries
"""
+
import pytest
from pontoon.base.models import PermissionChangelog
diff --git a/pontoon/terminology/migrations/0001_initial.py b/pontoon/terminology/migrations/0001_initial.py
index 31fbca2d29..fc31d0f4c4 100644
--- a/pontoon/terminology/migrations/0001_initial.py
+++ b/pontoon/terminology/migrations/0001_initial.py
@@ -5,7 +5,6 @@
class Migration(migrations.Migration):
-
initial = True
dependencies = [
diff --git a/pontoon/terminology/migrations/0002_term_entity.py b/pontoon/terminology/migrations/0002_term_entity.py
index 8bf3df8dfc..1f4713cf8b 100644
--- a/pontoon/terminology/migrations/0002_term_entity.py
+++ b/pontoon/terminology/migrations/0002_term_entity.py
@@ -5,7 +5,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("terminology", "0001_initial"),
]
diff --git a/pontoon/terminology/migrations/0003_auto_20200703_0710.py b/pontoon/terminology/migrations/0003_auto_20200703_0710.py
index a15ee47d90..fb5bd01dc4 100644
--- a/pontoon/terminology/migrations/0003_auto_20200703_0710.py
+++ b/pontoon/terminology/migrations/0003_auto_20200703_0710.py
@@ -6,7 +6,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("terminology", "0002_term_entity"),
]
diff --git a/pontoon/terminology/migrations/0004_remove_term_exact_match.py b/pontoon/terminology/migrations/0004_remove_term_exact_match.py
index ee510feb8b..c1c13ce77f 100644
--- a/pontoon/terminology/migrations/0004_remove_term_exact_match.py
+++ b/pontoon/terminology/migrations/0004_remove_term_exact_match.py
@@ -4,7 +4,6 @@
class Migration(migrations.Migration):
-
dependencies = [
("terminology", "0003_auto_20200703_0710"),
]
diff --git a/pontoon/tour/migrations/0002_make_tutorial_public.py b/pontoon/tour/migrations/0002_make_tutorial_public.py
index cb248a3651..3a68749e3a 100644
--- a/pontoon/tour/migrations/0002_make_tutorial_public.py
+++ b/pontoon/tour/migrations/0002_make_tutorial_public.py
@@ -11,7 +11,6 @@ def make_tutorial_public(apps, schema_editor):
class Migration(migrations.Migration):
-
dependencies = [
("tour", "0001_squashed_0001_initial"),
]
diff --git a/pontoon/translate/views.py b/pontoon/translate/views.py
index bddd920a04..f1b2ae0422 100644
--- a/pontoon/translate/views.py
+++ b/pontoon/translate/views.py
@@ -2,7 +2,6 @@
from django.contrib import messages
from django.http import Http404, HttpResponseRedirect
from django.shortcuts import (
- get_object_or_404,
render,
)
from django.views.decorators.csrf import (
@@ -10,9 +9,6 @@
ensure_csrf_cookie,
)
-from pontoon.base.models import (
- Locale,
-)
from pontoon.base.utils import get_project_or_redirect, get_locale_or_redirect
diff --git a/pontoon/uxactionlog/migrations/0001_initial.py b/pontoon/uxactionlog/migrations/0001_initial.py
index 99576035a9..6e74295c15 100644
--- a/pontoon/uxactionlog/migrations/0001_initial.py
+++ b/pontoon/uxactionlog/migrations/0001_initial.py
@@ -4,7 +4,6 @@
class Migration(migrations.Migration):
-
initial = True
dependencies = []
diff --git a/pontoon/wsgi.py b/pontoon/wsgi.py
index a61919f420..400b3e88df 100644
--- a/pontoon/wsgi.py
+++ b/pontoon/wsgi.py
@@ -4,6 +4,7 @@
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
+
import os
import dotenv
diff --git a/requirements/lint.in b/requirements/lint.in
index 381e70e008..5a507e99e6 100644
--- a/requirements/lint.in
+++ b/requirements/lint.in
@@ -14,6 +14,4 @@
# The dependencies are sorted by alphabetical order.
# Dependencies that do not come from pypi (eg. eggs from github) are listed at the end of the list.
# -------------------------------------------------------------------------------------------------
-black==22.12.0
-flake8==3.7.7
-pyupgrade==3.15.2
+ruff==0.4.6
diff --git a/requirements/lint.txt b/requirements/lint.txt
index 83ce23e28f..91050b92a4 100644
--- a/requirements/lint.txt
+++ b/requirements/lint.txt
@@ -4,61 +4,22 @@
#
# ./docker/compile_requirements.sh
#
-black==22.12.0 \
- --hash=sha256:101c69b23df9b44247bd88e1d7e90154336ac4992502d4197bdac35dd7ee3320 \
- --hash=sha256:159a46a4947f73387b4d83e87ea006dbb2337eab6c879620a3ba52699b1f4351 \
- --hash=sha256:1f58cbe16dfe8c12b7434e50ff889fa479072096d79f0a7f25e4ab8e94cd8350 \
- --hash=sha256:229351e5a18ca30f447bf724d007f890f97e13af070bb6ad4c0a441cd7596a2f \
- --hash=sha256:436cc9167dd28040ad90d3b404aec22cedf24a6e4d7de221bec2730ec0c97bcf \
- --hash=sha256:559c7a1ba9a006226f09e4916060982fd27334ae1998e7a38b3f33a37f7a2148 \
- --hash=sha256:7412e75863aa5c5411886804678b7d083c7c28421210180d67dfd8cf1221e1f4 \
- --hash=sha256:77d86c9f3db9b1bf6761244bc0b3572a546f5fe37917a044e02f3166d5aafa7d \
- --hash=sha256:82d9fe8fee3401e02e79767016b4907820a7dc28d70d137eb397b92ef3cc5bfc \
- --hash=sha256:9eedd20838bd5d75b80c9f5487dbcb06836a43833a37846cf1d8c1cc01cef59d \
- --hash=sha256:c116eed0efb9ff870ded8b62fe9f28dd61ef6e9ddd28d83d7d264a38417dcee2 \
- --hash=sha256:d30b212bffeb1e252b31dd269dfae69dd17e06d92b87ad26e23890f3efea366f
+ruff==0.4.6 \
+ --hash=sha256:04a80acfc862e0e1630c8b738e70dcca03f350bad9e106968a8108379e12b31f \
+ --hash=sha256:0cf5cc02d3ae52dfb0c8a946eb7a1d6ffe4d91846ffc8ce388baa8f627e3bd50 \
+ --hash=sha256:1fa8561489fadf483ffbb091ea94b9c39a00ed63efacd426aae2f197a45e67fc \
+ --hash=sha256:1ff930d6e05f444090a0139e4e13e1e2e1f02bd51bb4547734823c760c621e79 \
+ --hash=sha256:3a6a0a4f4b5f54fff7c860010ab3dd81425445e37d35701a965c0248819dde7a \
+ --hash=sha256:3f9ced5cbb7510fd7525448eeb204e0a22cabb6e99a3cb160272262817d49786 \
+ --hash=sha256:4d5b914818d8047270308fe3e85d9d7f4a31ec86c6475c9f418fbd1624d198e0 \
+ --hash=sha256:4f02284335c766678778475e7698b7ab83abaf2f9ff0554a07b6f28df3b5c259 \
+ --hash=sha256:602ebd7ad909eab6e7da65d3c091547781bb06f5f826974a53dbe563d357e53c \
+ --hash=sha256:735a16407a1a8f58e4c5b913ad6102722e80b562dd17acb88887685ff6f20cf6 \
+ --hash=sha256:9018bf59b3aa8ad4fba2b1dc0299a6e4e60a4c3bc62bbeaea222679865453062 \
+ --hash=sha256:a769ae07ac74ff1a019d6bd529426427c3e30d75bdf1e08bb3d46ac8f417326a \
+ --hash=sha256:a797a87da50603f71e6d0765282098245aca6e3b94b7c17473115167d8dfb0b7 \
+ --hash=sha256:be47700ecb004dfa3fd4dcdddf7322d4e632de3c06cd05329d69c45c0280e618 \
+ --hash=sha256:ea3424793c29906407e3cf417f28fc33f689dacbbadfb52b7e9a809dd535dcef \
+ --hash=sha256:ef995583a038cd4a7edf1422c9e19118e2511b8ba0b015861b4abd26ec5367c5 \
+ --hash=sha256:f13410aabd3b5776f9c5699f42b37a3a348d65498c4310589bc6e5c548dc8a2f
# via -r requirements/lint.in
-click==8.1.7 \
- --hash=sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28 \
- --hash=sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de
- # via black
-entrypoints==0.3 \
- --hash=sha256:589f874b313739ad35be6e0cd7efde2a4e9b6fea91edcc34e58ecbb8dbe56d19 \
- --hash=sha256:c70dd71abe5a8c85e55e12c19bd91ccfeec11a6e99044204511f9ed547d48451
- # via flake8
-flake8==3.7.7 \
- --hash=sha256:859996073f341f2670741b51ec1e67a01da142831aa1fdc6242dbf88dffbe661 \
- --hash=sha256:a796a115208f5c03b18f332f7c11729812c8c3ded6c46319c59b53efd3819da8
- # via -r requirements/lint.in
-mccabe==0.6.1 \
- --hash=sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42 \
- --hash=sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f
- # via flake8
-mypy-extensions==1.0.0 \
- --hash=sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d \
- --hash=sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782
- # via black
-pathspec==0.12.1 \
- --hash=sha256:a0d503e138a4c123b27490a4f7beda6a01c6f288df0e4a8b79c7eb0dc7b4cc08 \
- --hash=sha256:a482d51503a1ab33b1c67a6c3813a26953dbdc71c31dacaef9a838c4e29f5712
- # via black
-platformdirs==4.2.0 \
- --hash=sha256:0614df2a2f37e1a662acbd8e2b25b92ccf8632929bc6d43467e17fe89c75e068 \
- --hash=sha256:ef0cc731df711022c174543cb70a9b5bd22e5a9337c8624ef2c2ceb8ddad8768
- # via black
-pycodestyle==2.5.0 \
- --hash=sha256:95a2219d12372f05704562a14ec30bc76b05a5b297b21a5dfe3f6fac3491ae56 \
- --hash=sha256:e40a936c9a450ad81df37f549d676d127b1b66000a6c500caa2b085bc0ca976c
- # via flake8
-pyflakes==2.1.1 \
- --hash=sha256:17dbeb2e3f4d772725c777fabc446d5634d1038f234e77343108ce445ea69ce0 \
- --hash=sha256:d976835886f8c5b31d47970ed689944a0262b5f3afa00a5a7b4dc81e5449f8a2
- # via flake8
-pyupgrade==3.15.2 \
- --hash=sha256:c488d6896c546d25845712ef6402657123008d56c1063174e27aabe15bd6b4e5 \
- --hash=sha256:ce309e0ff8ecb73f56a45f12570be84bbbde9540d13697cacb261a7f595fb1f5
- # via -r requirements/lint.in
-tokenize-rt==5.2.0 \
- --hash=sha256:9fe80f8a5c1edad2d3ede0f37481cc0cc1538a2f442c9c2f9e4feacd2792d054 \
- --hash=sha256:b79d41a65cfec71285433511b50271b05da3584a1da144a0752e9c621a285289
- # via pyupgrade
diff --git a/ruff.toml b/ruff.toml
new file mode 100644
index 0000000000..8831b64288
--- /dev/null
+++ b/ruff.toml
@@ -0,0 +1,24 @@
+line-length = 88
+indent-width = 4
+
+# Assume Python 3.11
+target-version = "py311"
+
+[lint]
+ignore = [
+ "E501", # Line too long
+]
+select = [
+ "E", # pycodestyle errors
+ "F", # pyflakes
+ "W", # pycodestyle warnings
+]
+
+[format]
+quote-style = "double"
+indent-style = "space"
+skip-magic-trailing-comma = false
+line-ending = "lf"
+
+docstring-code-format = false
+docstring-code-line-length = "dynamic"