From 7ccb4e98f7fea8b567b3d4c10ca3cb7c74bc5e95 Mon Sep 17 00:00:00 2001 From: huangpixu Date: Mon, 9 Dec 2024 16:25:21 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8F=96=E6=B6=88signal()=E7=9A=84provi?= =?UTF-8?q?ding=5Fargs=E5=8F=82=E6=95=B0=E4=BC=A0=E5=85=A5=E3=80=81force?= =?UTF-8?q?=5Ftext=E4=BF=AE=E6=94=B9=E4=B8=BAforce=5Fstr=20#7625?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gcloud/common_template/signals.py | 2 +- gcloud/conf/__init__.py | 16 ++++++++-------- gcloud/contrib/cleaner/signals.py | 3 +-- gcloud/core/signals/__init__.py | 2 +- .../iam_auth/resource_creator_action/signals.py | 2 +- gcloud/taskflow3/signals/__init__.py | 8 ++++---- gcloud/tasktmpl3/signals.py | 2 +- pipeline_web/core/signals/__init__.py | 6 +++--- 8 files changed, 20 insertions(+), 21 deletions(-) diff --git a/gcloud/common_template/signals.py b/gcloud/common_template/signals.py index b7d563aeac..8951ab836a 100644 --- a/gcloud/common_template/signals.py +++ b/gcloud/common_template/signals.py @@ -16,4 +16,4 @@ # 项目模板保存后可见的信号,在模板保存事务提交后发出 # template_id: 模板 ID # is_deleted: 模板是否被删除 -post_template_save_commit = Signal(providing_args=["template_id", "is_deleted"]) +post_template_save_commit = Signal() # providing_args=["template_id", "is_deleted"] diff --git a/gcloud/conf/__init__.py b/gcloud/conf/__init__.py index 0739f6e060..03d2052a9f 100644 --- a/gcloud/conf/__init__.py +++ b/gcloud/conf/__init__.py @@ -16,11 +16,11 @@ import uuid import ujson as json -from django.utils.functional import Promise -from django.utils.encoding import force_text +from django.conf import settings as django_settings from django.core.serializers.json import DjangoJSONEncoder +from django.utils.encoding import force_str +from django.utils.functional import Promise from django.utils.timezone import is_aware -from django.conf import settings as django_settings from gcloud.conf import default_settings @@ -34,7 +34,7 @@ def __getattr__(self, key): if hasattr(default_settings, key): return getattr(default_settings, key) - raise AttributeError('Settings object has no attribute %s' % key) + raise AttributeError("Settings object has no attribute %s" % key) settings = GcloudSettings() @@ -43,13 +43,13 @@ def __getattr__(self, key): def default(self, o): # See "Date Time String Format" in the ECMA-262 specification. if isinstance(o, Promise): - return force_text(o) + return force_str(o) elif isinstance(o, datetime.datetime): r = o.isoformat() if o.microsecond: r = r[:23] + r[26:] - if r.endswith('+00:00'): - r = r[:-6] + 'Z' + if r.endswith("+00:00"): + r = r[:-6] + "Z" return r elif isinstance(o, datetime.date): return o.isoformat() @@ -63,7 +63,7 @@ def default(self, o): elif isinstance(o, (decimal.Decimal, uuid.UUID)): return str(o) elif isinstance(o, bytes): - return o.decode('utf-8') + return o.decode("utf-8") else: try: return super(DjangoJSONEncoder, self).default(o) diff --git a/gcloud/contrib/cleaner/signals.py b/gcloud/contrib/cleaner/signals.py index 408bc8e243..5f7e170191 100644 --- a/gcloud/contrib/cleaner/signals.py +++ b/gcloud/contrib/cleaner/signals.py @@ -12,5 +12,4 @@ """ from django.dispatch import Signal - -pre_delete_pipeline_instance_data = Signal(providing_args=["data"]) +pre_delete_pipeline_instance_data = Signal() # providing_args=["data"] diff --git a/gcloud/core/signals/__init__.py b/gcloud/core/signals/__init__.py index 6671033fc9..134ea89f36 100644 --- a/gcloud/core/signals/__init__.py +++ b/gcloud/core/signals/__init__.py @@ -13,4 +13,4 @@ from django.dispatch import Signal -user_enter = Signal(providing_args=["username"]) +user_enter = Signal() # providing_args=["username"] diff --git a/gcloud/iam_auth/resource_creator_action/signals.py b/gcloud/iam_auth/resource_creator_action/signals.py index a5a2ee9672..1afc40d6ca 100644 --- a/gcloud/iam_auth/resource_creator_action/signals.py +++ b/gcloud/iam_auth/resource_creator_action/signals.py @@ -13,4 +13,4 @@ from django.dispatch import Signal # defining custom signal -batch_create = Signal(providing_args=["instance_list", "creator"]) +batch_create = Signal() # providing_args=["instance_list", "creator"] diff --git a/gcloud/taskflow3/signals/__init__.py b/gcloud/taskflow3/signals/__init__.py index e9a94b74af..2bdefa952b 100644 --- a/gcloud/taskflow3/signals/__init__.py +++ b/gcloud/taskflow3/signals/__init__.py @@ -13,7 +13,7 @@ from django.dispatch import Signal -pre_taskflow_start = Signal(providing_args=["task_id", "executor"]) -taskflow_started = Signal(providing_args=["task_id"]) -taskflow_finished = Signal(providing_args=["task_id"]) -taskflow_revoked = Signal(providing_args=["task_id"]) +pre_taskflow_start = Signal() # providing_args=["task_id", "executor"] +taskflow_started = Signal() # providing_args=["task_id"] +taskflow_finished = Signal() # providing_args=["task_id"] +taskflow_revoked = Signal() # providing_args=["task_id"] diff --git a/gcloud/tasktmpl3/signals.py b/gcloud/tasktmpl3/signals.py index fe8882100c..d7affe2f09 100644 --- a/gcloud/tasktmpl3/signals.py +++ b/gcloud/tasktmpl3/signals.py @@ -17,4 +17,4 @@ # project_id: 模板对应的项目 ID # template_id: 模板 ID # is_deleted: 模板是否被删除 -post_template_save_commit = Signal(providing_args=["project_id", "template_id", "is_deleted"]) +post_template_save_commit = Signal() # providing_args=["project_id", "template_id", "is_deleted"] diff --git a/pipeline_web/core/signals/__init__.py b/pipeline_web/core/signals/__init__.py index 3c0f075707..876f46cb07 100644 --- a/pipeline_web/core/signals/__init__.py +++ b/pipeline_web/core/signals/__init__.py @@ -13,7 +13,7 @@ from django.dispatch import Signal -node_in_template_post_save = Signal(providing_args=['nodes_objs', 'nodes_info']) -node_in_template_delete = Signal(providing_args=['nodes_objs']) +node_in_template_post_save = Signal() # providing_args=['nodes_objs', 'nodes_info'] +node_in_template_delete = Signal() # providing_args=['nodes_objs'] -node_in_instance_post_save = Signal(providing_args=['nodes_objs', 'nodes_info']) +node_in_instance_post_save = Signal() # providing_args=['nodes_objs', 'nodes_info']