Skip to content

Commit 5fda156

Browse files
committed
fixed black isort
1 parent 576395f commit 5fda156

File tree

7 files changed

+17
-13
lines changed

7 files changed

+17
-13
lines changed

.github/workflows/checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
- uses: isort/isort-action@master
6363
with:
6464
requirementsFiles: "requirements.txt requirements.dev.txt"
65-
- uses: psf/black@stable
65+
- uses: psf/black@23.11.0
6666
- name: Comment if linting failed
6767
if: ${{ failure() }}
6868
uses: thollander/actions-comment-pull-request@v2

rating_api/routes/comment.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ async def get_comment(uuid: UUID, user=Depends(UnionAuth(auto_error=False, allow
172172
raise ObjectNotFound(Comment, uuid)
173173
base_data = CommentGet.model_validate(comment)
174174
if user:
175-
base_data.is_liked=comment.has_reaction(user.get("id"), Reaction.LIKE)
176-
base_data.is_disliked=comment.has_reaction(user.get("id"), Reaction.DISLIKE)
175+
base_data.is_liked = comment.has_reaction(user.get("id"), Reaction.LIKE)
176+
base_data.is_disliked = comment.has_reaction(user.get("id"), Reaction.DISLIKE)
177177
return base_data
178178

179179

@@ -267,8 +267,8 @@ async def get_comments(
267267
base_data = comment_validator.model_validate(comment)
268268
if current_user_id:
269269
reaction = user_reactions.get(comment.uuid)
270-
base_data.is_liked = (reaction == Reaction.LIKE)
271-
base_data.is_disliked = (reaction == Reaction.DISLIKE)
270+
base_data.is_liked = reaction == Reaction.LIKE
271+
base_data.is_disliked = reaction == Reaction.DISLIKE
272272
comments_with_like.append(base_data)
273273

274274
result.comments = comments_with_like
@@ -320,8 +320,8 @@ async def update_comment(uuid: UUID, comment_update: CommentUpdate, user=Depends
320320
)
321321

322322
updated_comment = CommentGet.model_validate(updated_comment)
323-
updated_comment.is_liked=comment.has_reaction(user.get("id"), Reaction.LIKE)
324-
updated_comment.is_disliked=comment.has_reaction(user.get("id"), Reaction.DISLIKE)
323+
updated_comment.is_liked = comment.has_reaction(user.get("id"), Reaction.LIKE)
324+
updated_comment.is_disliked = comment.has_reaction(user.get("id"), Reaction.DISLIKE)
325325
return updated_comment
326326

327327

@@ -387,9 +387,9 @@ async def like_comment(
387387
)
388388
.first()
389389
)
390-
391-
comment.is_liked = (reaction == Reaction.LIKE)
392-
comment.is_disliked = (reaction == Reaction.DISLIKE)
390+
391+
comment.is_liked = reaction == Reaction.LIKE
392+
comment.is_disliked = reaction == Reaction.DISLIKE
393393

394394
if existing_reaction and existing_reaction.reaction != reaction:
395395
new_reaction = CommentReaction.update(session=db.session, id=existing_reaction.uuid, reaction=reaction)

rating_api/routes/lecturer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ async def update_lecturer_rating(
9090

9191
return response_validated
9292

93+
9394
@lecturer.get("/timetable-id/{timetable_id}", response_model=LecturerGet)
9495
async def get_lecturer_by_timetable_id(timetable_id: int) -> LecturerGet:
9596
"""

requirements.dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
autoflake
2-
black
2+
black==23.11.0
33
httpx
44
isort
55
pytest

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def _create_reaction(user_id: int, react: Reaction):
148148
dbsession.add(reaction)
149149
dbsession.commit()
150150
created_reactions.append(reaction)
151-
151+
152152
yield _create_reaction
153153

154154
for reaction in created_reactions:

tests/test_routes/test_comment.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,9 @@ def test_create_comment(client, dbsession, lecturers, body, lecturer_n, response
210210
(None, None, None), # anonymous
211211
],
212212
)
213-
def test_get_comment_with_reaction(client, comment, reaction_data, expected_reaction, comment_user_id, comment_reaction):
213+
def test_get_comment_with_reaction(
214+
client, comment, reaction_data, expected_reaction, comment_user_id, comment_reaction
215+
):
214216
comment.user_id = comment_user_id
215217

216218
if reaction_data:

tests/test_routes/test_lecturer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def test_create_lecturer(client, dbsession, response_status):
2929
lecturer = dbsession.query(Lecturer).filter(Lecturer.timetable_id == 0).one_or_none()
3030
assert lecturer is None
3131

32+
3233
@pytest.mark.parametrize(
3334
'lecturer_n, response_status',
3435
[

0 commit comments

Comments
 (0)