Skip to content

Commit 0127ece

Browse files
committed
style: Automatic code formatting
1 parent b8f5451 commit 0127ece

File tree

7 files changed

+24
-28
lines changed

7 files changed

+24
-28
lines changed

analyzer/windows/analyzer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ def run(self):
510510
log.warning('Unable to import the auxiliary module "%s": %s', name, e)
511511

512512
def configure_aux_from_data(instance):
513-
# Do auxiliary module configuration stored in 'data/auxiliary/<package_name>'
513+
# Do auxiliary module configuration stored in 'data/auxiliary/<package_name>'
514514
_class = type(instance)
515515
try:
516516
log.debug("attempting to configure '%s' from data", _class.__name__)

lib/cuckoo/common/utils.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -343,15 +343,15 @@ def convert_to_printable_and_truncate(s: str, buf: int, cache=None):
343343

344344

345345
def truncate_str(s: str, max_length: int, marker=" <truncated>"):
346-
"""Truncate a string if its length exceeds the configured `max_length`.
347-
348-
If `max_length` is less than or equal to 0, the string is not modified.
349-
If the string is truncated, `marker` is added to the end."""
350-
truncate_size = min(max_length, len(s))
351-
if truncate_size > 0 and truncate_size < len(s):
352-
return f"{s[:truncate_size]}{marker}"
353-
else:
354-
return s
346+
"""Truncate a string if its length exceeds the configured `max_length`.
347+
348+
If `max_length` is less than or equal to 0, the string is not modified.
349+
If the string is truncated, `marker` is added to the end."""
350+
truncate_size = min(max_length, len(s))
351+
if truncate_size > 0 and truncate_size < len(s):
352+
return f"{s[:truncate_size]}{marker}"
353+
else:
354+
return s
355355

356356

357357
def convert_filename_char(c):

web/analysis/views.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -535,11 +535,7 @@ def pending(request):
535535
}
536536
)
537537

538-
data = {
539-
"tasks": pending,
540-
"count": len(pending),
541-
"title": "Pending Tasks"
542-
}
538+
data = {"tasks": pending, "count": len(pending), "title": "Pending Tasks"}
543539
return render(request, "analysis/pending.html", data)
544540

545541

@@ -2190,7 +2186,12 @@ def search(request, searched=""):
21902186
return render(
21912187
request,
21922188
"analysis/search.html",
2193-
{"title": "Search", "analyses": None, "term": searched, "error": "Search term too short, minimum 3 characters required"},
2189+
{
2190+
"title": "Search",
2191+
"analyses": None,
2192+
"term": searched,
2193+
"error": "Search term too short, minimum 3 characters required",
2194+
},
21942195
)
21952196

21962197
# name:foo or name: foo
@@ -2469,7 +2470,9 @@ def statistics_data(request, days=7):
24692470
# psycopg2.OperationalError
24702471
print(e)
24712472
return render(
2472-
request, "error.html", {"title": "Statistics", "error": "Please restart your database. Probably it had an update or it just down"}
2473+
request,
2474+
"error.html",
2475+
{"title": "Statistics", "error": "Please restart your database. Probably it had an update or it just down"},
24732476
)
24742477
return render(request, "statistics.html", {"title": "Statistics", "statistics": details, "days": days})
24752478
return render(request, "error.html", {"title": "Statistics", "error": "Provide days as number"})

web/apiv2/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def index(request):
170170
parsed[key]["rps"] = "None"
171171
parsed[key]["rpm"] = "None"
172172

173-
return render(request, "apiv2/index.html", {"title":"API", "config": parsed})
173+
return render(request, "apiv2/index.html", {"title": "API", "config": parsed})
174174

175175

176176
@csrf_exempt

web/compare/views.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,7 @@ def left(request, left_id):
8484
for item in results:
8585
records.append(item["_source"])
8686

87-
data = {
88-
"title": "Compare",
89-
"left": left,
90-
"records": records
91-
}
87+
data = {"title": "Compare", "left": left, "records": records}
9288
return render(request, "compare/left.html", data)
9389

9490

web/dashboard/views.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,5 @@ def index(request):
9191
report["estimate_day"] = format_number_with_space(int(24 * hourly))
9292
report["top_detections"] = top_detections()
9393

94-
data = {
95-
"title": "Dashboard",
96-
"report": report
97-
}
94+
data = {"title": "Dashboard", "report": report}
9895
return render(request, "dashboard/index.html", data)

web/submission/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ def index(request, task_id=None, resubmit_hash=None):
658658
err_data = {
659659
"error": "Error adding task(s) to CAPE's database.",
660660
"errors": details["errors"],
661-
"title": "Submission Failure"
661+
"title": "Submission Failure",
662662
}
663663
return render(request, "error.html", err_data)
664664
else:

0 commit comments

Comments
 (0)