aboutsummaryrefslogtreecommitdiff
path: root/uploader/datautils.py
diff options
context:
space:
mode:
Diffstat (limited to 'uploader/datautils.py')
-rw-r--r--uploader/datautils.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/uploader/datautils.py b/uploader/datautils.py
index b95a9e0..2c2a3dc 100644
--- a/uploader/datautils.py
+++ b/uploader/datautils.py
@@ -1,7 +1,14 @@
"""Generic data utilities: Rename module."""
import math
+from typing import Sequence
from functools import reduce
+def enumerate_sequence(seq: Sequence[dict]) -> Sequence[dict]:
+ """Enumerate sequence beginning at 1"""
+ return tuple({**item, "sequence_number": seqno}
+ for seqno, item in enumerate(seq, start=1))
+
+
def order_by_family(items: tuple[dict, ...],
family_key: str = "Family",
order_key: str = "FamilyOrderId") -> list: