From c980567fee84f34f45d66a12246947339e011995 Mon Sep 17 00:00:00 2001 From: "R. Miles McCain" Date: Sat, 31 Jul 2021 23:44:05 +0000 Subject: [PATCH] Formatting --- .../management/commands/startup_checks.py | 4 +-- shynet/core/models.py | 6 ++-- shynet/dashboard/mixins.py | 36 +++++++++---------- shynet/dashboard/templatetags/helpers.py | 6 ++-- 4 files changed, 25 insertions(+), 27 deletions(-) diff --git a/shynet/core/management/commands/startup_checks.py b/shynet/core/management/commands/startup_checks.py index 1ed107b..d32842d 100644 --- a/shynet/core/management/commands/startup_checks.py +++ b/shynet/core/management/commands/startup_checks.py @@ -45,6 +45,4 @@ class Command(BaseCommand): .exists() ) - self.stdout.write( - self.style.SUCCESS(f"{migration} {admin} {whitelabel}") - ) + self.stdout.write(self.style.SUCCESS(f"{migration} {admin} {whitelabel}")) diff --git a/shynet/core/models.py b/shynet/core/models.py index 54f057e..9568f58 100644 --- a/shynet/core/models.py +++ b/shynet/core/models.py @@ -304,9 +304,9 @@ class Service(models.Model): chart_data = sorted(chart_data.items(), key=lambda k: k[0]) chart_data = { - 'sessions': [v['sessions'] for k, v in chart_data], - 'hits': [v['hits'] for k, v in chart_data], - 'labels': [str(k) for k, v in chart_data], + "sessions": [v["sessions"] for k, v in chart_data], + "hits": [v["hits"] for k, v in chart_data], + "labels": [str(k) for k, v in chart_data], } return chart_data, chart_tooltip_format, chart_granularity diff --git a/shynet/dashboard/mixins.py b/shynet/dashboard/mixins.py index d1409f5..e86d425 100644 --- a/shynet/dashboard/mixins.py +++ b/shynet/dashboard/mixins.py @@ -26,34 +26,34 @@ class DateRangeMixin: now = timezone.now() return [ { - 'name': 'Last 3 days', - 'start': now - timezone.timedelta(days=2), - 'end': now, + "name": "Last 3 days", + "start": now - timezone.timedelta(days=2), + "end": now, }, { - 'name': 'Last 30 days', - 'start': now - timezone.timedelta(days=29), - 'end': now, + "name": "Last 30 days", + "start": now - timezone.timedelta(days=29), + "end": now, }, { - 'name': 'Last 90 days', - 'start': now - timezone.timedelta(days=89), - 'end': now, + "name": "Last 90 days", + "start": now - timezone.timedelta(days=89), + "end": now, }, { - 'name': 'This month', - 'start': now.replace(day=1), - 'end': now, + "name": "This month", + "start": now.replace(day=1), + "end": now, }, { - 'name': 'Last month', - 'start': now.replace(day=1, month=now.month - 1), - 'end': now.replace(day=1, month=now.month) - timezone.timedelta(days=1), + "name": "Last month", + "start": now.replace(day=1, month=now.month - 1), + "end": now.replace(day=1, month=now.month) - timezone.timedelta(days=1), }, { - 'name': 'This year', - 'start': now.replace(day=1, month=1), - 'end': now, + "name": "This year", + "start": now.replace(day=1, month=1), + "end": now, }, ] diff --git a/shynet/dashboard/templatetags/helpers.py b/shynet/dashboard/templatetags/helpers.py index 7e9ba63..582d196 100644 --- a/shynet/dashboard/templatetags/helpers.py +++ b/shynet/dashboard/templatetags/helpers.py @@ -228,7 +228,7 @@ class ContextualURLNode(template.Node): if self.urlnode.asvar: context[self.urlnode.asvar] = url_final - return '' + return "" else: return url_final @@ -256,7 +256,7 @@ def percent(value, total): if percent < 0.001: return "<0.1%" - return f'{percent:.1%}' + return f"{percent:.1%}" @register.simple_tag @@ -272,4 +272,4 @@ def bar_width(count, max, total): if percent < 0.001: return "0" - return f'{percent:.1%}' + return f"{percent:.1%}"