From 413a2f210e701f0beccfafb627f937f2c7372d08 Mon Sep 17 00:00:00 2001 From: abaisero Date: Sun, 10 Apr 2022 00:08:43 -0400 Subject: [PATCH] fix: fix black pre-commit hook import error Problem: Older versions of `black` were (for some reason) importing internal modules from the `click` package. Recent internal updates to the `click` package now cause `black` to fail (see https://github.com/psf/black/issues/2964). Solution: Two approaches exist. Either fix the version of `click` to a previous version, or update the version of `black`. This commit updates the version of `black`, and reruns black on all files. --- .pre-commit-config.yaml | 2 +- agagd/agagd_core/jinga2.py | 6 +++--- agagd/agagd_core/tables/core.py | 2 +- agagd/agagd_core/views/players_profile.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b27cf2c8..e932ada5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,7 +6,7 @@ repos: - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/psf/black - rev: 19.3b0 + rev: 22.3.0 hooks: - id: black - repo: https://github.com/pycqa/isort diff --git a/agagd/agagd_core/jinga2.py b/agagd/agagd_core/jinga2.py index d0096005..2265a373 100644 --- a/agagd/agagd_core/jinga2.py +++ b/agagd/agagd_core/jinga2.py @@ -7,9 +7,9 @@ def get_members_name_and_id(value): """ - Provides jinja2 custom filter which returns - the members information as - "[member's full name] (member_id)". + Provides jinja2 custom filter which returns + the members information as + "[member's full name] (member_id)". """ try: member = agagd_models.Member.objects.values("full_name", "member_id").get( diff --git a/agagd/agagd_core/tables/core.py b/agagd/agagd_core/tables/core.py index 28d0bff5..59ad8a13 100644 --- a/agagd/agagd_core/tables/core.py +++ b/agagd/agagd_core/tables/core.py @@ -65,7 +65,7 @@ def render(self, value): "{}".format(chapter_url, chapter_name) ) except: - chapter_html = u"\u2014" + chapter_html = "\u2014" return chapter_html diff --git a/agagd/agagd_core/views/players_profile.py b/agagd/agagd_core/views/players_profile.py index 728f9f8a..9e717cbd 100644 --- a/agagd/agagd_core/views/players_profile.py +++ b/agagd/agagd_core/views/players_profile.py @@ -60,7 +60,7 @@ def get(self, request, *args, **kwargs): game_date = None # Check for 0000-00-00 dates - if game.game_date != u"0000-00-00": + if game.game_date != "0000-00-00": game_date = game.game_date t_dat["date"] = t_dat.get("date", game_date)