From 9004f15eea6cd7545651c8ad802e63d1ea62bb9e Mon Sep 17 00:00:00 2001 From: Ehco1996 Date: Wed, 11 Nov 2020 06:26:09 +0800 Subject: [PATCH] format code --- .../0001_squashed_0055_auto_20200726_0847.py | 63 +++++-------------- .../migrations/0004_auto_20201108_0400.py | 8 +-- .../migrations/0005_auto_20201110_2208.py | 10 +-- apps/sspanel/models.py | 9 +-- apps/sspanel/tasks.py | 9 +-- 5 files changed, 23 insertions(+), 76 deletions(-) diff --git a/apps/sspanel/migrations/0001_squashed_0055_auto_20200726_0847.py b/apps/sspanel/migrations/0001_squashed_0055_auto_20200726_0847.py index 11d2570ec9..ca7c454cd2 100644 --- a/apps/sspanel/migrations/0001_squashed_0055_auto_20200726_0847.py +++ b/apps/sspanel/migrations/0001_squashed_0055_auto_20200726_0847.py @@ -298,9 +298,7 @@ class Migration(migrations.Migration): "verbose_name_plural": "用户", "abstract": False, }, - managers=[ - ("objects", django.contrib.auth.models.UserManager()), - ], + managers=[("objects", django.contrib.auth.models.UserManager()),], ), migrations.CreateModel( name="Announcement", @@ -317,10 +315,7 @@ class Migration(migrations.Migration): ("time", models.DateTimeField(auto_now_add=True, verbose_name="时间")), ("body", models.TextField(verbose_name="主体")), ], - options={ - "verbose_name_plural": "系统公告", - "ordering": ("-time",), - }, + options={"verbose_name_plural": "系统公告", "ordering": ("-time",),}, ), migrations.CreateModel( name="Donate", @@ -361,10 +356,7 @@ class Migration(migrations.Migration): ), ), ], - options={ - "verbose_name_plural": "捐赠记录", - "ordering": ("-time",), - }, + options={"verbose_name_plural": "捐赠记录", "ordering": ("-time",),}, ), migrations.CreateModel( name="Goods", @@ -438,10 +430,7 @@ class Migration(migrations.Migration): models.PositiveSmallIntegerField(default=1, verbose_name="排序"), ), ], - options={ - "verbose_name_plural": "商品", - "ordering": ["order"], - }, + options={"verbose_name_plural": "商品", "ordering": ["order"],}, ), migrations.CreateModel( name="InviteCode", @@ -517,10 +506,7 @@ class Migration(migrations.Migration): ), ("isused", models.BooleanField(default=False, verbose_name="是否使用")), ], - options={ - "verbose_name_plural": "充值码", - "ordering": ("isused",), - }, + options={"verbose_name_plural": "充值码", "ordering": ("isused",),}, ), migrations.CreateModel( name="PurchaseHistory", @@ -557,10 +543,7 @@ class Migration(migrations.Migration): ), ), ], - options={ - "verbose_name_plural": "购买记录", - "ordering": ("-created_at",), - }, + options={"verbose_name_plural": "购买记录", "ordering": ("-created_at",),}, ), migrations.CreateModel( name="RebateRecord", @@ -597,10 +580,7 @@ class Migration(migrations.Migration): ), ), ], - options={ - "ordering": ("-created_at",), - "verbose_name_plural": "返利记录", - }, + options={"ordering": ("-created_at",), "verbose_name_plural": "返利记录",}, ), migrations.CreateModel( name="Ticket", @@ -632,10 +612,7 @@ class Migration(migrations.Migration): ), ), ], - options={ - "verbose_name_plural": "工单", - "ordering": ("-time",), - }, + options={"verbose_name_plural": "工单", "ordering": ("-time",),}, ), migrations.CreateModel( name="UserOrder", @@ -839,9 +816,7 @@ class Migration(migrations.Migration): ), ), ], - options={ - "verbose_name_plural": "邮件发送记录", - }, + options={"verbose_name_plural": "邮件发送记录",}, ), migrations.CreateModel( name="NodeOnlineLog", @@ -1032,9 +1007,7 @@ class Migration(migrations.Migration): ), ), ], - options={ - "verbose_name_plural": "Vmess节点", - }, + options={"verbose_name_plural": "Vmess节点",}, ), migrations.CreateModel( name="SSNode", @@ -1180,9 +1153,7 @@ class Migration(migrations.Migration): ), ), ], - options={ - "verbose_name_plural": "SS节点", - }, + options={"verbose_name_plural": "SS节点",}, ), migrations.CreateModel( name="RelayNode", @@ -1300,9 +1271,7 @@ class Migration(migrations.Migration): ), ("level", models.PositiveIntegerField(default=0)), ], - options={ - "verbose_name_plural": "中转节点", - }, + options={"verbose_name_plural": "中转节点",}, ), migrations.CreateModel( name="SSRelayRule", @@ -1356,9 +1325,7 @@ class Migration(migrations.Migration): ), ), ], - options={ - "verbose_name_plural": "SS转发规则", - }, + options={"verbose_name_plural": "SS转发规则",}, ), migrations.CreateModel( name="VmessRelayRule", @@ -1412,8 +1379,6 @@ class Migration(migrations.Migration): ), ), ], - options={ - "verbose_name_plural": "Vmess转发规则", - }, + options={"verbose_name_plural": "Vmess转发规则",}, ), ] diff --git a/apps/sspanel/migrations/0004_auto_20201108_0400.py b/apps/sspanel/migrations/0004_auto_20201108_0400.py index 0c9e620f7f..04e00ec6f0 100644 --- a/apps/sspanel/migrations/0004_auto_20201108_0400.py +++ b/apps/sspanel/migrations/0004_auto_20201108_0400.py @@ -192,9 +192,7 @@ class Migration(migrations.Migration): ), ), ], - options={ - "verbose_name_plural": "Trojan节点", - }, + options={"verbose_name_plural": "Trojan节点",}, ), migrations.AddField( model_name="relaynode", @@ -285,8 +283,6 @@ class Migration(migrations.Migration): ), ), ], - options={ - "verbose_name_plural": "Trojan转发规则", - }, + options={"verbose_name_plural": "Trojan转发规则",}, ), ] diff --git a/apps/sspanel/migrations/0005_auto_20201110_2208.py b/apps/sspanel/migrations/0005_auto_20201110_2208.py index a7691f0ff9..41f17e5be8 100644 --- a/apps/sspanel/migrations/0005_auto_20201110_2208.py +++ b/apps/sspanel/migrations/0005_auto_20201110_2208.py @@ -10,14 +10,8 @@ class Migration(migrations.Migration): ] operations = [ - migrations.RemoveField( - model_name="trojannode", - name="certificateFile", - ), - migrations.RemoveField( - model_name="trojannode", - name="keyFile", - ), + migrations.RemoveField(model_name="trojannode", name="certificateFile",), + migrations.RemoveField(model_name="trojannode", name="keyFile",), migrations.AddField( model_name="trojannode", name="certificate_file", diff --git a/apps/sspanel/models.py b/apps/sspanel/models.py index 4c19280182..b5283fcdfb 100644 --- a/apps/sspanel/models.py +++ b/apps/sspanel/models.py @@ -684,10 +684,7 @@ class BaseAbstractNode(models.Model): total_traffic = models.BigIntegerField("总流量", default=settings.GB) enable = models.BooleanField("是否开启", default=True, db_index=True) enlarge_scale = models.DecimalField( - "倍率", - default=Decimal("1.0"), - decimal_places=2, - max_digits=10, + "倍率", default=Decimal("1.0"), decimal_places=2, max_digits=10, ) ehco_listen_host = models.CharField("隧道监听地址", max_length=64, blank=True, null=True) @@ -1167,9 +1164,7 @@ def trojan_inbound(self): "protocol": "trojan", "listen": self.listen_host, "tag": self.inbound_tag, - "settings": { - "clients": [], - }, + "settings": {"clients": [],}, "streamSettings": { "network": self.network, "security": self.security, diff --git a/apps/sspanel/tasks.py b/apps/sspanel/tasks.py index 365a39f59e..efc6203f6b 100644 --- a/apps/sspanel/tasks.py +++ b/apps/sspanel/tasks.py @@ -68,8 +68,7 @@ def sync_user_ss_traffic_task(node_id, data): # 用户流量 m.User.objects.bulk_update( - user_model_list, - ["download_traffic", "upload_traffic", "last_use_time"], + user_model_list, ["download_traffic", "upload_traffic", "last_use_time"], ) # 节点流量记录 m.SSNode.increase_used_traffic(node_id, node_total_traffic) @@ -130,8 +129,7 @@ def sync_user_vmess_traffic_task(node_id, data): m.UserTrafficLog.objects.bulk_create(trafficlog_model_list) # 个人流量记录 m.User.objects.bulk_update( - user_model_list, - ["download_traffic", "upload_traffic", "last_use_time"], + user_model_list, ["download_traffic", "upload_traffic", "last_use_time"], ) # 节点在线人数 m.NodeOnlineLog.add_log(m.NodeOnlineLog.NODE_TYPE_VMESS, node_id, len(data)) @@ -184,8 +182,7 @@ def sync_user_trojan_traffic_task(node_id, data): m.UserTrafficLog.objects.bulk_create(trafficlog_model_list) # 个人流量记录 m.User.objects.bulk_update( - user_model_list, - ["download_traffic", "upload_traffic", "last_use_time"], + user_model_list, ["download_traffic", "upload_traffic", "last_use_time"], ) # 节点在线人数 m.NodeOnlineLog.add_log(m.NodeOnlineLog.NODE_TYPE_TROJAN, node_id, len(data))