Skip to content

Commit f534771

Browse files
authored
fix: change datafiles naming pattern (#22)
Datafiles created with the old pattern had the following drawbacks: - They were not sorted in any meaningful way in the file tree. - They contained ":" which are considered invalid characters on Windows.
1 parent 888021e commit f534771

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

prompterator/main.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,9 +374,13 @@ def set_up_ui_saved_datafiles():
374374

375375
# prettify the timestamp
376376
input_timestamp = metadata[c.TIMESTAMP_COL]
377-
input_format = "%m-%d-%y_%H:%M:%S"
377+
input_format = "%Y-%m-%d-%H-%M-%S"
378+
fallback_input_format = "%m-%d-%y_%H:%M:%S"
378379
output_format = "%I:%M %p — %b %d, %Y"
379-
timestamp = datetime.strptime(input_timestamp, input_format)
380+
try:
381+
timestamp = datetime.strptime(input_timestamp, input_format)
382+
except ValueError:
383+
timestamp = datetime.strptime(input_timestamp, fallback_input_format)
380384

381385
st.markdown(
382386
f"""

prompterator/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ def get_correctness_summary(df):
218218

219219

220220
def save_labelled_data():
221-
ts = datetime.now().strftime("%-m-%-d-%y_%-H:%M:%S")
221+
ts = datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
222222
file_name = f"{c.DATA_STORE_DIR}/{ts}.json"
223223
model = st.session_state[c.MODEL_KEY]
224224
configurable_params = {name: st.session_state[name] for name in model.configurable_params}

0 commit comments

Comments
 (0)