Skip to content

Commit

Permalink
new lint thx vitalik
Browse files Browse the repository at this point in the history
  • Loading branch information
c4ffein committed Aug 23, 2024
1 parent 3ec05e4 commit 33889c2
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 11 deletions.
10 changes: 8 additions & 2 deletions accounts/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ class Migration(migrations.Migration):
"is_active",
models.BooleanField(
default=True,
help_text="Designates whether this user should be treated as active. Unselect this instead of deleting accounts.",
help_text=(
"Designates whether this user should be treated as active. "
"Unselect this instead of deleting accounts."
),
verbose_name="active",
),
),
Expand All @@ -53,7 +56,10 @@ class Migration(migrations.Migration):
"groups",
models.ManyToManyField(
blank=True,
help_text="The groups this user belongs to. A user will get all permissions granted to each of their groups.",
help_text=(
"The groups this user belongs to. "
"A user will get all permissions granted to each of their groups."
),
related_name="user_set",
related_query_name="user",
to="auth.group",
Expand Down
6 changes: 3 additions & 3 deletions articles/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ def unfavorite(request, slug):
@router.get("/articles/feed", auth=AuthJWT(), response={200: Any, 404: Any})
def feed(request):
followed_authors = User.objects.filter(followers=request.user)
articles = [
a for a in Article.objects.with_favorites(request.user).filter(author__in=followed_authors).order_by("-created")
]
articles = list(
Article.objects.with_favorites(request.user).filter(author__in=followed_authors).order_by("-created")
)
return {
"articlesCount": len(articles),
"articles": [ArticleOutSchema.from_orm(a, context={"request": request}) for a in articles],
Expand Down
10 changes: 5 additions & 5 deletions articles/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def test_create_article(self):
},
)
self._valid_timestamps_in_output_dict(response.data["article"])
(self.assertEqual(set(response.data["article"]["tagList"]), set(["tag", "taag", "taaag"])),)
self.assertEqual(set(response.data["article"]["tagList"]), {"tag", "taag", "taaag"})
self.assertEqual(Article.objects.count(), 3)
self.assertEqual(
Article.objects.values().last(),
Expand All @@ -155,7 +155,7 @@ def test_create_article(self):
"updated": mock.ANY,
},
)
self.assertEqual(set(t.name for t in Article.objects.last().tags.all()), {"tag", "taag", "taaag"})
self.assertEqual({t.name for t in Article.objects.last().tags.all()}, {"tag", "taag", "taaag"})

def test_create_article_without_tag_field(self):
new_article_data = {
Expand Down Expand Up @@ -200,7 +200,7 @@ def test_create_article_without_tag_field(self):
"updated": mock.ANY,
},
)
self.assertEqual(set(t.name for t in Article.objects.last().tags.all()), set())
self.assertEqual({t.name for t in Article.objects.last().tags.all()}, set())

def test_create_article_invalid_data_0_len_title(self):
new_article_data = {
Expand Down Expand Up @@ -280,7 +280,7 @@ def test_update_article(self):
},
)
self._valid_timestamps_in_output_dict(response.data["article"])
(self.assertEqual(set(response.data["article"]["tagList"]), set([])),)
self.assertEqual(set(response.data["article"]["tagList"]), set())
self.assertEqual(
Article.objects.values().filter(title="New Test Title").last(),
{
Expand Down Expand Up @@ -320,7 +320,7 @@ def test_update_article_only_one_field(self, updated_db_key, updated_json_key, u
},
)
self._valid_timestamps_in_output_dict(response.data["article"])
(self.assertEqual(set(response.data["article"]["tagList"]), set([])),)
self.assertEqual(set(response.data["article"]["tagList"]), set())
self.assertEqual(
Article.objects.values().filter(slug=expected_slug).last(),
{
Expand Down
12 changes: 11 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,14 @@ exclude = [
line-length = 120

[tool.ruff.lint]
select = ["I"]
select = [
"B", # flake8-bugbear
"C", # flake8-comprehensions
"E", # pycodestyle errors
"F", # pyflakes
"FURB", # refurb
"I", # isort
"PTH", # flake8-use-pathlib
"UP", # pyupgrade
"W", # pycodestyle warnings
]

0 comments on commit 33889c2

Please sign in to comment.