From f132162a0175527b61710cc50fb0428f0e12930e Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Thu, 4 May 2023 12:15:08 +0100 Subject: [PATCH 1/5] Run pre-commit autoupdate --- .pre-commit-config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 60d0600b..7cc6bf8f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.2.0 + rev: v4.4.0 hooks: # - id: trailing-whitespace # - id: end-of-file-fixer @@ -8,17 +8,17 @@ repos: - id: check-added-large-files - repo: https://github.com/asottile/pyupgrade - rev: v2.38.4 + rev: v3.3.2 hooks: - id: pyupgrade args: [--py36-plus] - repo: https://github.com/pycqa/isort - rev: "5.10.1" + rev: "5.12.0" hooks: - id: isort - repo: https://github.com/psf/black - rev: "22.8.0" + rev: "23.3.0" hooks: - id: black From 866ed4ba64376e02bf1cb5d91edc4ac64d6403a4 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Thu, 4 May 2023 12:16:11 +0100 Subject: [PATCH 2/5] Reformat files with Black --- django_countries/data.py | 1 - django_countries/tests/test_countries.py | 1 - django_countries/tests/test_tags.py | 1 - 3 files changed, 3 deletions(-) diff --git a/django_countries/data.py b/django_countries/data.py index dda83769..8fc33f07 100755 --- a/django_countries/data.py +++ b/django_countries/data.py @@ -563,7 +563,6 @@ def self_generate( # Sort countries. def sort_key(row): - return ( unicodedata.normalize("NFKD", row[0]) .encode("ascii", "ignore") diff --git a/django_countries/tests/test_countries.py b/django_countries/tests/test_countries.py index 612ad3d5..2502ba3a 100644 --- a/django_countries/tests/test_countries.py +++ b/django_countries/tests/test_countries.py @@ -398,7 +398,6 @@ def test_translation_fallback_override_names(self): } } ): - lang = translation.get_language() try: translation.activate("eo") diff --git a/django_countries/tests/test_tags.py b/django_countries/tests/test_tags.py index 1848da21..71669efc 100644 --- a/django_countries/tests/test_tags.py +++ b/django_countries/tests/test_tags.py @@ -8,7 +8,6 @@ class TestCountriesTags(TestCase): - TEMPLATE_COUNTRY = Template( "{% load countries %}{% get_country code as country %}{{ country }}" ) From 248c228a1f44c28b30edf604cfa1ccf59874e72d Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Thu, 4 May 2023 12:16:39 +0100 Subject: [PATCH 3/5] Lint on CI using pre-commit --- .github/workflows/tests.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b1f06674..1e97128b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,6 +8,17 @@ on: - pull_request jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: "3.11" + - uses: pre-commit/action@v3.0.0 + - uses: pre-commit-ci/lite-action@v1.0.1 + if: always() + tests: runs-on: ubuntu-latest strategy: From eb01660853aba38baa47472f95759ef43fcbc85e Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Thu, 4 May 2023 12:19:27 +0100 Subject: [PATCH 4/5] Quote all versions to make sure they won't be treated as float --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7cc6bf8f..65c34ec4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: "v4.4.0" hooks: # - id: trailing-whitespace # - id: end-of-file-fixer @@ -8,7 +8,7 @@ repos: - id: check-added-large-files - repo: https://github.com/asottile/pyupgrade - rev: v3.3.2 + rev: "v3.3.2" hooks: - id: pyupgrade args: [--py36-plus] From 64a5ed03d684fe76eb70d28ee1befd6ed137e5a7 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Thu, 4 May 2023 12:21:19 +0100 Subject: [PATCH 5/5] Update pyupgrade to reflect minimum Python version --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 65c34ec4..11b83cab 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,7 +11,7 @@ repos: rev: "v3.3.2" hooks: - id: pyupgrade - args: [--py36-plus] + args: [--py37-plus] - repo: https://github.com/pycqa/isort rev: "5.12.0"