Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruff: add and fix COM #10086

Merged
merged 1 commit into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion docker/install_chrome_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,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
Loading