Skip to content

Commit 93e67a8

Browse files
committed
Update scripts
1 parent ab92680 commit 93e67a8

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

python-packages/input4MIPs-CVs/src/input4MIPs_CVs/db_changes.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,21 @@ def diff_db_to_changes_comment(
115115
],
116116
]
117117

118+
# Workaround https://github.com/esgf2-us/esgf-1.5-design/issues/86
119+
def fix_timestamp(v: str | list | None) -> str | None:
120+
if isinstance(v, str) or v is None:
121+
return v
122+
123+
if isinstance(v, list) and len(v) == 1:
124+
return v[0]
125+
126+
raise AssertionError(v)
127+
128+
if "timestamp" in summary_table_columns:
129+
diffs_incl_source_id["timestamp"] = [
130+
fix_timestamp(v) for v in diffs_incl_source_id["timestamp"]
131+
]
132+
118133
summary_table = (
119134
diffs_incl_source_id[summary_table_columns]
120135
.fillna("None")

python-packages/input4MIPs-CVs/src/input4MIPs_CVs/html_generation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ def get_files_view(
186186
]
187187
)
188188

189+
# Workaround https://github.com/esgf2-us/esgf-1.5-design/issues/86
189190
def fix_timestamp(v: str | list | None) -> str | None:
190191
if isinstance(v, str) or v is None:
191192
return v
@@ -195,7 +196,6 @@ def fix_timestamp(v: str | list | None) -> str | None:
195196

196197
raise AssertionError(v)
197198

198-
# Workaround https://github.com/esgf2-us/esgf-1.5-design/issues/86
199199
if "timestamp" in col_order:
200200
db["timestamp"] = [fix_timestamp(v) for v in db["timestamp"]]
201201

0 commit comments

Comments
 (0)