16
16
import logging
17
17
from typing import List
18
18
19
+ import pytz
19
20
from django .conf import settings
20
- from django .utils import timezone
21
21
from django .utils .translation import ugettext_lazy as _
22
22
from pipeline .core .data .var import LazyVariable , RegisterVariableMeta , SpliceVariable
23
23
from pipeline .core .flow .io import IntItemSchema , StringItemSchema
@@ -75,7 +75,9 @@ class Datetime(CommonPlainVariable, SelfExplainVariable):
75
75
76
76
@classmethod
77
77
def _self_explain (cls , ** kwargs ) -> List [FieldExplain ]:
78
- return [FieldExplain (key = "${KEY}" , type = Type .STRING , description = "用户选择的时间,输出格式: 2000-04-19 14:45:16" )]
78
+ return [
79
+ FieldExplain (key = "${KEY}" , type = Type .STRING , description = "用户选择的时间,输出格式: 2000-04-19 14:45:16" )
80
+ ]
79
81
80
82
81
83
class Int (CommonPlainVariable , SelfExplainVariable ):
@@ -116,11 +118,17 @@ class Select(LazyVariable, SelfExplainVariable):
116
118
meta_tag = "select.select_meta"
117
119
form = "%svariables/%s.js" % (settings .STATIC_URL , code )
118
120
schema = StringItemSchema (description = _ ("下拉框变量" ))
119
- desc = _ ("单选模式下输出选中的 value,多选模式下输出选中 value 以 ',' 拼接的字符串\n 该变量默认不支持输入任意值,仅在子流程节点配置填参时支持输入任意值" )
121
+ desc = _ (
122
+ "单选模式下输出选中的 value,多选模式下输出选中 value 以 ',' 拼接的字符串\n 该变量默认不支持输入任意值,仅在子流程节点配置填参时支持输入任意值"
123
+ )
120
124
121
125
@classmethod
122
126
def _self_explain (cls , ** kwargs ) -> List [FieldExplain ]:
123
- return [FieldExplain (key = "${KEY}" , type = Type .STRING , description = "选中的 value,多选模式下输出选中 value 以 ',' 拼接的字符串" )]
127
+ return [
128
+ FieldExplain (
129
+ key = "${KEY}" , type = Type .STRING , description = "选中的 value,多选模式下输出选中 value 以 ',' 拼接的字符串"
130
+ )
131
+ ]
124
132
125
133
def get_value (self ):
126
134
# multiple select
@@ -151,11 +159,17 @@ class TextValueSelect(LazyVariable, SelfExplainVariable):
151
159
@classmethod
152
160
def _self_explain (cls , ** kwargs ) -> List [FieldExplain ]:
153
161
return [
154
- FieldExplain (key = "${KEY}" , type = Type .DICT , description = "用户选择的选项的text与value以及未选中的text与value" ),
162
+ FieldExplain (
163
+ key = "${KEY}" , type = Type .DICT , description = "用户选择的选项的text与value以及未选中的text与value"
164
+ ),
155
165
FieldExplain (key = '${KEY["value"]}' , type = Type .STRING , description = "用户选中选项的value,多个以,分隔" ),
156
166
FieldExplain (key = '${KEY["text"]}' , type = Type .STRING , description = "用户选中选项的text,多个以,分隔" ),
157
- FieldExplain (key = '${KEY["value_not_selected"]}' , type = Type .STRING , description = "用户未选中选项的value,多个以,分隔" ),
158
- FieldExplain (key = '${KEY["text_not_selected"]}' , type = Type .STRING , description = "用户未选中选项的text,多个以,分隔" ),
167
+ FieldExplain (
168
+ key = '${KEY["value_not_selected"]}' , type = Type .STRING , description = "用户未选中选项的value,多个以,分隔"
169
+ ),
170
+ FieldExplain (
171
+ key = '${KEY["text_not_selected"]}' , type = Type .STRING , description = "用户未选中选项的text,多个以,分隔"
172
+ ),
159
173
]
160
174
161
175
def get_value (self ):
@@ -213,7 +227,7 @@ def _self_explain(cls, **kwargs) -> List[FieldExplain]:
213
227
def get_value (self ):
214
228
time_format = self .value .get ("time_format" , "%Y-%m-%d %H:%M:%S" ).strip ()
215
229
time_zone = self .value .get ("time_zone" , "Asia/Shanghai" )
216
- now = datetime .datetime .now (timezone . pytz .timezone (time_zone ))
230
+ now = datetime .datetime .now (pytz .timezone (time_zone ))
217
231
current_time = now .strftime (time_format )
218
232
return current_time
219
233
@@ -233,7 +247,7 @@ def _self_explain(cls, **kwargs) -> List[FieldExplain]:
233
247
def get_value (self ):
234
248
time_units = self .value .get ("time_unit" ) or ["year" , "month" , "day" , "hour" , "minute" , "second" ]
235
249
time_zone = self .value .get ("time_zone" , "Asia/Shanghai" )
236
- now = datetime .datetime .now (timezone . pytz .timezone (time_zone ))
250
+ now = datetime .datetime .now (pytz .timezone (time_zone ))
237
251
current_time = now .strftime (self ._generate_time_format (time_units ))
238
252
return current_time
239
253
@@ -321,7 +335,10 @@ class StaffGroupSelector(LazyVariable, SelfExplainVariable):
321
335
type = "dynamic"
322
336
tag = "staff_group_multi_selector.staff_group_selector"
323
337
form = "%svariables/staff_group_multi_selector.js" % settings .STATIC_URL
324
- desc = _ ("可选cc业务固定的四个人员分组(运维人员、产品人员、开发人员、测试人员)和标准运维【项目管理】中配置的人员分组\n " "输出格式为选中人员用户名以 ',' 拼接的字符串" )
338
+ desc = _ (
339
+ "可选cc业务固定的四个人员分组(运维人员、产品人员、开发人员、测试人员)和标准运维【项目管理】中配置的人员分组\n "
340
+ "输出格式为选中人员用户名以 ',' 拼接的字符串"
341
+ )
325
342
326
343
@classmethod
327
344
def _self_explain (cls , ** kwargs ) -> List [FieldExplain ]:
0 commit comments