Loading csst_dag/dag/_base_dag.py +4 −4 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ from astropy import table, time from ._dispatcher import Dispatcher from ..dag_utils import ( force_string, force_string_and_int, override_common_keys, generate_sha1_from_time, ) Loading Loading @@ -72,8 +72,8 @@ class BaseDAG: ) @staticmethod def force_string(d: dict): return force_string(d) def force_string_and_int(d: dict): return force_string_and_int(d) class Level2DAG(BaseDAG): Loading Loading @@ -364,5 +364,5 @@ class Level1DAG(BaseDAG): # It seems that the dag_run_template is already stringified, # so we don't need to force_string here. # force values to be string dag_run = self.force_string(dag_run) dag_run = self.force_string_and_int(dag_run) return dag_run csst_dag/dag_utils.py +5 −3 Original line number Diff line number Diff line Loading @@ -68,14 +68,16 @@ def generate_uuid(): return str(uuid.uuid4()) def force_string(d): def force_string_and_int(d): """更通用的递归字符串转换""" 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)): return [force_string(item) for item in d] return [force_string_and_int(item) for item in d] elif isinstance(d, (str, bytes)): return str(d) elif type(d) in (np.int32, np.int64): return int(d) else: return d Loading Loading
csst_dag/dag/_base_dag.py +4 −4 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ from astropy import table, time from ._dispatcher import Dispatcher from ..dag_utils import ( force_string, force_string_and_int, override_common_keys, generate_sha1_from_time, ) Loading Loading @@ -72,8 +72,8 @@ class BaseDAG: ) @staticmethod def force_string(d: dict): return force_string(d) def force_string_and_int(d: dict): return force_string_and_int(d) class Level2DAG(BaseDAG): Loading Loading @@ -364,5 +364,5 @@ class Level1DAG(BaseDAG): # It seems that the dag_run_template is already stringified, # so we don't need to force_string here. # force values to be string dag_run = self.force_string(dag_run) dag_run = self.force_string_and_int(dag_run) return dag_run
csst_dag/dag_utils.py +5 −3 Original line number Diff line number Diff line Loading @@ -68,14 +68,16 @@ def generate_uuid(): return str(uuid.uuid4()) def force_string(d): def force_string_and_int(d): """更通用的递归字符串转换""" 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)): return [force_string(item) for item in d] return [force_string_and_int(item) for item in d] elif isinstance(d, (str, bytes)): return str(d) elif type(d) in (np.int32, np.int64): return int(d) else: return d Loading