From 7272f9b9ef6a8bb08ed232fee6958a12ae0d7345 Mon Sep 17 00:00:00 2001 From: Paul Nation Date: Wed, 6 Nov 2024 20:36:26 -0500 Subject: [PATCH] parsing datetime in py<3.11 --- mthree/mitigation.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mthree/mitigation.py b/mthree/mitigation.py index 1624cc1..4da60f3 100644 --- a/mthree/mitigation.py +++ b/mthree/mitigation.py @@ -771,7 +771,10 @@ def _job_thread(jobs, mit, qubits, num_cal_qubits, generator): timestamp = timestamp.isoformat() # Go to UTC times because we are going to use this for # resultsDB storage as well - dt = datetime.datetime.fromisoformat(timestamp) + try: + dt = datetime.datetime.fromisoformat(timestamp) + except ValueError: + dt = datetime.datetime.strptime(timestamp, "%Y-%m-%dT%H:%M:%S.%fZ") dt_utc = dt.astimezone(datetime.timezone.utc) mit.cal_timestamp = dt_utc.isoformat() # A list of qubits with bad meas cals