Skip to content

Commit

Permalink
removed Optional on the specified datakey fields
Browse files Browse the repository at this point in the history
  • Loading branch information
evalott100 committed Sep 17, 2024
1 parent a2f134c commit 1e3f44a
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 65 deletions.
6 changes: 3 additions & 3 deletions event_model/documents/event_descriptor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, Dict, List, Optional
from typing import Any, Dict, List

from typing_extensions import Annotated, Literal, NotRequired, TypedDict

Expand Down Expand Up @@ -41,7 +41,7 @@ class DataKey(TypedDict):
]
precision: NotRequired[
Annotated[
Optional[int],
int,
Field(
description="Number of digits after decimal place if "
"a floating point number"
Expand All @@ -56,7 +56,7 @@ class DataKey(TypedDict):
str, Field(description="The source (ex piece of hardware) of the data.")
]
units: NotRequired[
Annotated[Optional[str], Field(description="Engineering units of the value")]
Annotated[str, Field(description="Engineering units of the value")]
]


Expand Down
6 changes: 1 addition & 5 deletions event_model/schemas/datum_page.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@
"properties": {
"datum_id": {
"description": "Array unique identifiers for each Datum (akin to 'uid' for other Document types), typically formatted as '<resource>/<integer>'",
"allOf": [
{
"$ref": "#/$defs/DataFrameForDatumPage"
}
]
"$ref": "#/$defs/DataFrameForDatumPage"
},
"datum_kwargs": {
"title": "Datum Kwargs",
Expand Down
18 changes: 2 additions & 16 deletions event_model/schemas/event_descriptor.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,7 @@
"precision": {
"title": "Precision",
"description": "Number of digits after decimal place if a floating point number",
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
]
"type": "integer"
},
"shape": {
"title": "Shape",
Expand All @@ -91,14 +84,7 @@
"units": {
"title": "Units",
"description": "Engineering units of the value",
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
"type": "string"
}
},
"required": [
Expand Down
18 changes: 3 additions & 15 deletions event_model/schemas/event_page.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,7 @@
"properties": {
"data": {
"description": "The actual measurement data",
"allOf": [
{
"$ref": "#/$defs/DataFrameForEventPage"
}
]
"$ref": "#/$defs/DataFrameForEventPage"
},
"descriptor": {
"title": "Descriptor",
Expand All @@ -45,11 +41,7 @@
},
"filled": {
"description": "Mapping each of the keys of externally-stored data to an array containing the boolean False, indicating that the data has not been loaded, or to foreign keys (moved here from 'data' when the data was loaded)",
"allOf": [
{
"$ref": "#/$defs/DataFrameForFilled"
}
]
"$ref": "#/$defs/DataFrameForFilled"
},
"seq_num": {
"title": "Seq Num",
Expand All @@ -69,11 +61,7 @@
},
"timestamps": {
"description": "The timestamps of the individual measurement data",
"allOf": [
{
"$ref": "#/$defs/DataFrameForEventPage"
}
]
"$ref": "#/$defs/DataFrameForEventPage"
},
"uid": {
"title": "Uid",
Expand Down
12 changes: 2 additions & 10 deletions event_model/schemas/run_start.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,7 @@
"calculation": {
"title": "calculation properties",
"description": "required fields if type is calculated",
"allOf": [
{
"$ref": "#/$defs/Calculation"
}
]
"$ref": "#/$defs/Calculation"
},
"config_device": {
"title": "Config Device",
Expand Down Expand Up @@ -289,11 +285,7 @@
},
"data_type": {
"description": "",
"allOf": [
{
"$ref": "#/$defs/DataType"
}
]
"$ref": "#/$defs/DataType"
},
"group": {
"title": "Group",
Expand Down
6 changes: 1 addition & 5 deletions event_model/schemas/run_stop.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@
"properties": {
"data_type": {
"description": "data_type",
"allOf": [
{
"$ref": "#/$defs/DataType"
}
]
"$ref": "#/$defs/DataType"
},
"exit_status": {
"title": "Exit Status",
Expand Down
12 changes: 2 additions & 10 deletions event_model/schemas/stream_datum.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,11 @@
},
"indices": {
"description": "A slice object passed to the StreamResource handler so it can hand back data and timestamps",
"allOf": [
{
"$ref": "#/$defs/StreamRange"
}
]
"$ref": "#/$defs/StreamRange"
},
"seq_nums": {
"description": "A slice object showing the Event numbers the resource corresponds to",
"allOf": [
{
"$ref": "#/$defs/StreamRange"
}
]
"$ref": "#/$defs/StreamRange"
},
"stream_resource": {
"title": "Stream Resource",
Expand Down
2 changes: 1 addition & 1 deletion event_model/tests/test_em.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def test_compose_run():
assert bundle.compose_stop is compose_stop
bundle = compose_descriptor(
data_keys={
"motor": {"shape": [], "dtype": "number", "source": "...", "units": None},
"motor": {"shape": [], "dtype": "number", "source": "...", "units": "s"},
"image": {
"shape": [512, 512],
"dtype": "number",
Expand Down

0 comments on commit 1e3f44a

Please sign in to comment.