Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
csst-cicd
csst-dag
Commits
b18ad976
Commit
b18ad976
authored
Oct 14, 2025
by
BO ZHANG
🏀
Browse files
refactor: force_string -> force_string_and_int
parent
d27a7df3
Changes
2
Hide whitespace changes
Inline
Side-by-side
csst_dag/dag/_base_dag.py
View file @
b18ad976
...
@@ -7,7 +7,7 @@ from astropy import table, time
...
@@ -7,7 +7,7 @@ from astropy import table, time
from
._dispatcher
import
Dispatcher
from
._dispatcher
import
Dispatcher
from
..dag_utils
import
(
from
..dag_utils
import
(
force_string
,
force_string
_and_int
,
override_common_keys
,
override_common_keys
,
generate_sha1_from_time
,
generate_sha1_from_time
,
)
)
...
@@ -72,8 +72,8 @@ class BaseDAG:
...
@@ -72,8 +72,8 @@ class BaseDAG:
)
)
@
staticmethod
@
staticmethod
def
force_string
(
d
:
dict
):
def
force_string
_and_int
(
d
:
dict
):
return
force_string
(
d
)
return
force_string
_and_int
(
d
)
class
Level2DAG
(
BaseDAG
):
class
Level2DAG
(
BaseDAG
):
...
@@ -364,5 +364,5 @@ class Level1DAG(BaseDAG):
...
@@ -364,5 +364,5 @@ class Level1DAG(BaseDAG):
# It seems that the dag_run_template is already stringified,
# It seems that the dag_run_template is already stringified,
# so we don't need to force_string here.
# so we don't need to force_string here.
# force values to be string
# force values to be string
dag_run
=
self
.
force_string
(
dag_run
)
dag_run
=
self
.
force_string
_and_int
(
dag_run
)
return
dag_run
return
dag_run
csst_dag/dag_utils.py
View file @
b18ad976
...
@@ -68,14 +68,16 @@ def generate_uuid():
...
@@ -68,14 +68,16 @@ def generate_uuid():
return
str
(
uuid
.
uuid4
())
return
str
(
uuid
.
uuid4
())
def
force_string
(
d
):
def
force_string
_and_int
(
d
):
"""更通用的递归字符串转换"""
"""更通用的递归字符串转换"""
if
isinstance
(
d
,
dict
):
if
isinstance
(
d
,
dict
):
return
{
k
:
force_string
(
v
)
for
k
,
v
in
d
.
items
()}
return
{
k
:
force_string
_and_int
(
v
)
for
k
,
v
in
d
.
items
()}
elif
isinstance
(
d
,
Iterable
)
and
not
isinstance
(
d
,
(
str
,
bytes
)):
elif
isinstance
(
d
,
Iterable
)
and
not
isinstance
(
d
,
(
str
,
bytes
)):
return
[
force_string
(
item
)
for
item
in
d
]
return
[
force_string
_and_int
(
item
)
for
item
in
d
]
elif
isinstance
(
d
,
(
str
,
bytes
)):
elif
isinstance
(
d
,
(
str
,
bytes
)):
return
str
(
d
)
return
str
(
d
)
elif
type
(
d
)
in
(
np
.
int32
,
np
.
int64
):
return
int
(
d
)
else
:
else
:
return
d
return
d
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment