From 6e76a35acf71069671d0c19b2110eca2e89d876f Mon Sep 17 00:00:00 2001 From: Dan Allan Date: Fri, 20 Sep 2024 10:37:00 -0400 Subject: [PATCH] Add dtype_numpy with medium-effort validation --- event_model/documents/event_descriptor.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/event_model/documents/event_descriptor.py b/event_model/documents/event_descriptor.py index 26f6d447..cb0c8225 100644 --- a/event_model/documents/event_descriptor.py +++ b/event_model/documents/event_descriptor.py @@ -1,4 +1,4 @@ -from typing import Any, Dict, List, Optional +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated, Literal, NotRequired, TypedDict @@ -42,7 +42,20 @@ class DataKey(TypedDict): ] dtype: Annotated[ Dtype, - Field(description="The type of the data in the event."), + Field(description="The type of the data in the event, given as a broad JSON schema type."), + ] + dtype_numpy: NotRequired[ + Annotated[ + Union[ + str, # e.g. "