Skip to content

Commit

Permalink
Ruff: add and fix COM
Browse files Browse the repository at this point in the history
  • Loading branch information
kiblik committed May 4, 2024
1 parent 6fd7eda commit 58a321a
Show file tree
Hide file tree
Showing 335 changed files with 2,119 additions and 2,119 deletions.
2 changes: 1 addition & 1 deletion docker/install_chrome_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def ldd(file_path):
# For simplicity, I'm assuming if we get an error, the code is non-zero.
try:
result = subprocess.run(
["ldd", file_path], capture_output=True, text=True
["ldd", file_path], capture_output=True, text=True,
)
stdout = result.stdout
code = result.returncode
Expand Down
2 changes: 1 addition & 1 deletion dojo/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class QuestionParentAdmin(PolymorphicParentModelAdmin):
base_model = Question
child_models = (
TextQuestion,
ChoiceQuestion
ChoiceQuestion,
)


Expand Down
8 changes: 4 additions & 4 deletions dojo/announcement/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ def add_announcement_to_new_user(sender, instance, **kwargs):
)
if not cloud_announcement or settings.CREATE_CLOUD_BANNER:
user_announcements = UserAnnouncement.objects.filter(
user=dojo_user, announcement=announcement
user=dojo_user, announcement=announcement,
)
if user_announcements.count() == 0:
UserAnnouncement.objects.get_or_create(
user=dojo_user, announcement=announcement
user=dojo_user, announcement=announcement,
)


Expand All @@ -31,8 +31,8 @@ def announcement_post_save(sender, instance, created, **kwargs):
UserAnnouncement.objects.bulk_create(
[
UserAnnouncement(
user=user_id, announcement=instance
user=user_id, announcement=instance,
)
for user_id in Dojo_User.objects.all()
]
],
)
6 changes: 3 additions & 3 deletions dojo/announcement/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def configure_announcement(request):
"message": announcement.message,
"style": announcement.style,
"dismissable": announcement.dismissable,
}
},
)
remove = True
except Announcement.DoesNotExist:
Expand Down Expand Up @@ -64,14 +64,14 @@ def configure_announcement(request):
request=request,
)
return render(
request, "dojo/announcement.html", {"form": form, "remove": remove}
request, "dojo/announcement.html", {"form": form, "remove": remove},
)


def dismiss_announcement(request):
if request.method == "POST":
deleted_count, _objects_deleted = UserAnnouncement.objects.filter(
user=request.user, announcement=1
user=request.user, announcement=1,
).delete()
if deleted_count > 0:
messages.add_message(
Expand Down
2 changes: 1 addition & 1 deletion dojo/api_v2/exception_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def custom_exception_handler(exc, context):
# message, if it is different from the detail that is already
# in the response.
if isinstance(response.data, dict) and str(
exc
exc,
) != response.data.get("detail", ""):
response.data["message"] = str(exc)
else:
Expand Down
2 changes: 1 addition & 1 deletion dojo/api_v2/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class DeletePreviewModelMixin:
@extend_schema(
methods=["GET"],
responses={
status.HTTP_200_OK: serializers.DeletePreviewSerializer(many=True)
status.HTTP_200_OK: serializers.DeletePreviewSerializer(many=True),
},
)
@action(detail=True, methods=["get"], filter_backends=[], suffix="List")
Expand Down
Loading

0 comments on commit 58a321a

Please sign in to comment.