From 37175e54fba36285a22c89bf2cf96bf66386ab63 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Sat, 5 Sep 2020 09:09:59 +0200 Subject: [PATCH] Upgrade black --- .pre-commit-config.yaml | 2 +- .../management/commands/check_pending_comments.py | 13 ++++++++----- articles/migrations/0001_initial.py | 2 +- articles/migrations/0002_article.py | 2 +- articles/migrations/0007_auto_20200817_0941.py | 4 ++-- articles/migrations/0010_auto_20200818_1825.py | 2 +- articles/migrations/0011_auto_20200818_1829.py | 2 +- articles/migrations/0012_auto_20200818_1845.py | 2 +- articles/migrations/0015_auto_20200818_2138.py | 2 +- articles/migrations/0017_auto_20200820_1606.py | 2 +- articles/migrations/0020_auto_20200903_2157.py | 2 +- articles/views/html.py | 4 +--- attachments/migrations/0003_auto_20200826_1843.py | 9 +++++++-- attachments/migrations/0004_auto_20200903_2116.py | 3 ++- attachments/models.py | 2 +- blog/settings.py | 8 ++++---- 16 files changed, 34 insertions(+), 27 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 81e74b5..b7599d9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: - id: isort types: [python] - repo: https://github.com/psf/black - rev: 19.10b0 + rev: 20.8b1 hooks: - id: black types: [python] diff --git a/articles/management/commands/check_pending_comments.py b/articles/management/commands/check_pending_comments.py index c35a8d3..c168215 100644 --- a/articles/management/commands/check_pending_comments.py +++ b/articles/management/commands/check_pending_comments.py @@ -17,9 +17,12 @@ class Command(BaseCommand): url = (settings.BLOG["base_url"] + url).replace( "//", "/" ) + "?status__exact=pending" - message = ngettext( - "There is %(count)d comment pending review.\n%(url)s", - "There are %(count)d comments pending review.\n%(url)s", - count, - ) % {"count": count, "url": url} + message = ( + ngettext( + "There is %(count)d comment pending review.\n%(url)s", + "There are %(count)d comments pending review.\n%(url)s", + count, + ) + % {"count": count, "url": url} + ) mail_admins("Comments pending review", message) diff --git a/articles/migrations/0001_initial.py b/articles/migrations/0001_initial.py index 8880233..538760a 100644 --- a/articles/migrations/0001_initial.py +++ b/articles/migrations/0001_initial.py @@ -125,6 +125,6 @@ class Migration(migrations.Migration): "verbose_name_plural": "users", "abstract": False, }, - managers=[("objects", django.contrib.auth.models.UserManager()),], + managers=[("objects", django.contrib.auth.models.UserManager())], ), ] diff --git a/articles/migrations/0002_article.py b/articles/migrations/0002_article.py index 2029669..e1ec46a 100644 --- a/articles/migrations/0002_article.py +++ b/articles/migrations/0002_article.py @@ -45,6 +45,6 @@ class Migration(migrations.Migration): ), ), ], - options={"ordering": ["-published_at"],}, + options={"ordering": ["-published_at"]}, ), ] diff --git a/articles/migrations/0007_auto_20200817_0941.py b/articles/migrations/0007_auto_20200817_0941.py index 3699b39..46e698e 100644 --- a/articles/migrations/0007_auto_20200817_0941.py +++ b/articles/migrations/0007_auto_20200817_0941.py @@ -11,9 +11,9 @@ class Migration(migrations.Migration): operations = [ migrations.AlterModelOptions( - name="page", options={"ordering": ["position", "-published_at"]}, + name="page", options={"ordering": ["position", "-published_at"]} ), migrations.AddField( - model_name="page", name="position", field=models.IntegerField(default=0), + model_name="page", name="position", field=models.IntegerField(default=0) ), ] diff --git a/articles/migrations/0010_auto_20200818_1825.py b/articles/migrations/0010_auto_20200818_1825.py index 19ac146..9415a02 100644 --- a/articles/migrations/0010_auto_20200818_1825.py +++ b/articles/migrations/0010_auto_20200818_1825.py @@ -11,7 +11,7 @@ class Migration(migrations.Migration): operations = [ migrations.AlterModelOptions( - name="comment", options={"ordering": ["-created_at"]}, + name="comment", options={"ordering": ["-created_at"]} ), migrations.AddField( model_name="comment", diff --git a/articles/migrations/0011_auto_20200818_1829.py b/articles/migrations/0011_auto_20200818_1829.py index 92d823f..97a4297 100644 --- a/articles/migrations/0011_auto_20200818_1829.py +++ b/articles/migrations/0011_auto_20200818_1829.py @@ -11,6 +11,6 @@ class Migration(migrations.Migration): operations = [ migrations.RenameField( - model_name="comment", old_name="active", new_name="approved", + model_name="comment", old_name="active", new_name="approved" ), ] diff --git a/articles/migrations/0012_auto_20200818_1845.py b/articles/migrations/0012_auto_20200818_1845.py index 9ca121b..6ed455a 100644 --- a/articles/migrations/0012_auto_20200818_1845.py +++ b/articles/migrations/0012_auto_20200818_1845.py @@ -11,7 +11,7 @@ class Migration(migrations.Migration): operations = [ migrations.AlterModelOptions( - name="comment", options={"ordering": ["created_at"]}, + name="comment", options={"ordering": ["created_at"]} ), migrations.AlterField( model_name="comment", diff --git a/articles/migrations/0015_auto_20200818_2138.py b/articles/migrations/0015_auto_20200818_2138.py index 9922d95..39475b0 100644 --- a/articles/migrations/0015_auto_20200818_2138.py +++ b/articles/migrations/0015_auto_20200818_2138.py @@ -10,7 +10,7 @@ class Migration(migrations.Migration): ] operations = [ - migrations.RemoveField(model_name="comment", name="approved",), + migrations.RemoveField(model_name="comment", name="approved"), migrations.AddField( model_name="comment", name="status", diff --git a/articles/migrations/0017_auto_20200820_1606.py b/articles/migrations/0017_auto_20200820_1606.py index 16bd5b7..4b85a44 100644 --- a/articles/migrations/0017_auto_20200820_1606.py +++ b/articles/migrations/0017_auto_20200820_1606.py @@ -11,6 +11,6 @@ class Migration(migrations.Migration): operations = [ migrations.AlterModelOptions( - name="comment", options={"ordering": ["-created_at"]}, + name="comment", options={"ordering": ["-created_at"]} ), ] diff --git a/articles/migrations/0020_auto_20200903_2157.py b/articles/migrations/0020_auto_20200903_2157.py index 9c3ca5a..e4fba50 100644 --- a/articles/migrations/0020_auto_20200903_2157.py +++ b/articles/migrations/0020_auto_20200903_2157.py @@ -11,6 +11,6 @@ class Migration(migrations.Migration): operations = [ migrations.AlterModelOptions( - name="comment", options={"ordering": ["created_at"]}, + name="comment", options={"ordering": ["created_at"]} ), ] diff --git a/articles/views/html.py b/articles/views/html.py index a303957..86ceb35 100644 --- a/articles/views/html.py +++ b/articles/views/html.py @@ -89,9 +89,7 @@ class ArticleDetailView(FormMixin, generic.DetailView): comment = form.save(commit=False) comment.article = self.object comment.save() - messages.success( - self.request, "Comment successfully saved, pending review.", - ) + messages.success(self.request, "Comment successfully saved, pending review.") return super().form_valid(form) def get_success_url(self): diff --git a/attachments/migrations/0003_auto_20200826_1843.py b/attachments/migrations/0003_auto_20200826_1843.py index dfe08ed..dfed6b4 100644 --- a/attachments/migrations/0003_auto_20200826_1843.py +++ b/attachments/migrations/0003_auto_20200826_1843.py @@ -11,9 +11,14 @@ class Migration(migrations.Migration): operations = [ migrations.RenameField( - model_name="attachment", old_name="file", new_name="original_file", + model_name="attachment", + old_name="file", + new_name="original_file", + ), + migrations.RemoveField( + model_name="attachment", + name="processed", ), - migrations.RemoveField(model_name="attachment", name="processed",), migrations.AddField( model_name="attachment", name="processed_file", diff --git a/attachments/migrations/0004_auto_20200903_2116.py b/attachments/migrations/0004_auto_20200903_2116.py index f059f12..b84143c 100644 --- a/attachments/migrations/0004_auto_20200903_2116.py +++ b/attachments/migrations/0004_auto_20200903_2116.py @@ -11,6 +11,7 @@ class Migration(migrations.Migration): operations = [ migrations.AlterModelOptions( - name="attachment", options={"ordering": ["description"]}, + name="attachment", + options={"ordering": ["description"]}, ), ] diff --git a/attachments/models.py b/attachments/models.py index 50159c0..89cea32 100644 --- a/attachments/models.py +++ b/attachments/models.py @@ -65,7 +65,7 @@ class Attachment(models.Model): } check_data = {**base_data, **post_data} while res_data["Status"]["Code"] == "1": - response = requests.post(url=url, data=check_data,) + response = requests.post(url=url, data=check_data) res_data = response.json()[0] # Download image diff --git a/blog/settings.py b/blog/settings.py index b1c2c5b..3bf4d19 100644 --- a/blog/settings.py +++ b/blog/settings.py @@ -130,11 +130,11 @@ DATABASES = { AUTH_PASSWORD_VALIDATORS = [ { - "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator", + "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator" }, - {"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",}, - {"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",}, - {"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",}, + {"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator"}, + {"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator"}, + {"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator"}, ]