Skip to content

Commit

Permalink
Merge pull request #1089 from qiboteam/Update-serialize.load
Browse files Browse the repository at this point in the history
Update in serialize.load method.
  • Loading branch information
andrea-pasquale authored Feb 19, 2025
2 parents cc2da88 + 0def436 commit 5520bba
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/qibocal/auto/serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,15 @@ def serialize(raw: dict):
}


def _nested_list_to_tuples(raw):
"""Convert nested lists to nested tuples."""
if isinstance(raw, list):
return tuple([_nested_list_to_tuples(item) for item in raw])
return raw


# TODO: distinguish between tuples and strings
def load(key):
"""Evaluate key converting string of lists to tuples."""
raw_load = json.loads(key)
if isinstance(raw_load, list):
return tuple(raw_load)
return raw_load
return _nested_list_to_tuples(raw_load)

0 comments on commit 5520bba

Please sign in to comment.