From e0b087295d05588b4aa99410911ea5faa42d036a Mon Sep 17 00:00:00 2001 From: Eva Lott Date: Thu, 9 Jan 2025 12:01:28 +0000 Subject: [PATCH] cleaned up after rebase --- src/event_model/basemodels/__init__.py | 20 +++--- .../basemodels/partial_resource.py | 33 --------- src/event_model/documents/__init__.py | 20 +++--- src/event_model/documents/event_descriptor.py | 70 +++++++------------ src/event_model/documents/partial_resource.py | 31 -------- 5 files changed, 42 insertions(+), 132 deletions(-) delete mode 100644 src/event_model/basemodels/partial_resource.py delete mode 100644 src/event_model/documents/partial_resource.py diff --git a/src/event_model/basemodels/__init__.py b/src/event_model/basemodels/__init__.py index 32f48d81..43b59b12 100644 --- a/src/event_model/basemodels/__init__.py +++ b/src/event_model/basemodels/__init__.py @@ -9,7 +9,6 @@ from .event import * # noqa: F403 from .event_descriptor import * # noqa: F403 from .event_page import * # noqa: F403 -from .partial_resource import * # noqa: F403 from .resource import * # noqa: F403 from .run_start import * # noqa: F403 from .run_stop import * # noqa: F403 @@ -18,32 +17,31 @@ BasemodelType = Union[ Type[BulkDatum], # noqa: F405, - Type[BulkEvents], # noqa: F405, Type[Datum], # noqa: F405, Type[DatumPage], # noqa: F405, - Type[Event], # noqa: F405, Type[EventDescriptor], # noqa: F405, - Type[EventPage], # noqa: F405, - Type[PartialResource], # noqa: F405, - Type[RunStart], # noqa: F405, Type[RunStop], # noqa: F405, Type[StreamDatum], # noqa: F405, Type[StreamResource], # noqa: F405, + Type[BulkEvents], # noqa: F405, + Type[Event], # noqa: F405, + Type[EventPage], # noqa: F405, Type[Resource], # noqa: F405, + Type[RunStart], # noqa: F405, ] ALL_BASEMODELS: Tuple[BasemodelType, ...] = ( BulkDatum, # noqa: F405 - BulkEvents, # noqa: F405 Datum, # noqa: F405 DatumPage, # noqa: F405 - Event, # noqa: F405 EventDescriptor, # noqa: F405 - EventPage, # noqa: F405 - PartialResource, # noqa: F405 - RunStart, # noqa: F405 RunStop, # noqa: F405 StreamDatum, # noqa: F405 StreamResource, # noqa: F405 + BulkEvents, # noqa: F405 + Event, # noqa: F405 + EventPage, # noqa: F405 Resource, # noqa: F405 + RunStart, # noqa: F405 ) + diff --git a/src/event_model/basemodels/partial_resource.py b/src/event_model/basemodels/partial_resource.py deleted file mode 100644 index 53b4324d..00000000 --- a/src/event_model/basemodels/partial_resource.py +++ /dev/null @@ -1,33 +0,0 @@ -# ruff: noqa -# type: ignore -# generated by datamodel-codegen: -# filename: partial_resource.json - -from __future__ import annotations - -from typing import Any, Dict - -from pydantic import BaseModel, Field - - -class PartialResource(BaseModel): - spec: str = Field(..., title="spec") - """ - String identifying the format/type of this Resource, used to identify a compatible Handler - """ - resource_kwargs: Dict[str, Any] = Field(..., title="resource_kwargs") - """ - Additional argument to pass to the Handler to read a Resource - """ - resource_path: str = Field(..., title="resource_path") - """ - Filepath or URI for locating this resource - """ - root: str = Field(..., title="root") - """ - Subset of resource_path that is a local detail, not semantic. - """ - uid: str = Field(..., title="uid") - """ - Globally unique identifier for this Resource - """ diff --git a/src/event_model/documents/__init__.py b/src/event_model/documents/__init__.py index 01c4d869..f8b3c21d 100644 --- a/src/event_model/documents/__init__.py +++ b/src/event_model/documents/__init__.py @@ -9,7 +9,6 @@ from .event import * # noqa: F403 from .event_descriptor import * # noqa: F403 from .event_page import * # noqa: F403 -from .partial_resource import * # noqa: F403 from .resource import * # noqa: F403 from .run_start import * # noqa: F403 from .run_stop import * # noqa: F403 @@ -20,30 +19,29 @@ Type[BulkDatum], # noqa: F405, Type[Datum], # noqa: F405, Type[DatumPage], # noqa: F405, + Type[EventDescriptor], # noqa: F405, Type[RunStop], # noqa: F405, Type[StreamDatum], # noqa: F405, Type[StreamResource], # noqa: F405, - Type[EventPage], # noqa: F405, - Type[Event], # noqa: F405, - Type[EventDescriptor], # noqa: F405, Type[BulkEvents], # noqa: F405, - Type[RunStart], # noqa: F405, - Type[PartialResource], # noqa: F405, + Type[Event], # noqa: F405, + Type[EventPage], # noqa: F405, Type[Resource], # noqa: F405, + Type[RunStart], # noqa: F405, ] ALL_DOCUMENTS: Tuple[DocumentType, ...] = ( BulkDatum, # noqa: F405 Datum, # noqa: F405 DatumPage, # noqa: F405 + EventDescriptor, # noqa: F405 RunStop, # noqa: F405 StreamDatum, # noqa: F405 StreamResource, # noqa: F405 - EventPage, # noqa: F405 - Event, # noqa: F405 - EventDescriptor, # noqa: F405 BulkEvents, # noqa: F405 - RunStart, # noqa: F405 - PartialResource, # noqa: F405 + Event, # noqa: F405 + EventPage, # noqa: F405 Resource, # noqa: F405 + RunStart, # noqa: F405 ) + diff --git a/src/event_model/documents/event_descriptor.py b/src/event_model/documents/event_descriptor.py index fcf9c21a..69c26e81 100644 --- a/src/event_model/documents/event_descriptor.py +++ b/src/event_model/documents/event_descriptor.py @@ -15,35 +15,6 @@ DtypeNumpyItem = List -class RdsRange(TypedDict): - """RDS (Read different than set) parameters range. - - - https://tango-controls.readthedocs.io/en/latest/development/device-api/attribute-alarms.html#the-read-different-than-set-rds-alarm - """ - - time_difference: Annotated[ - float, - Field( - description=( - "ms since last update to fail after if set point and " - "read point are not within `value_difference` of each other." - ) - ), - ] - value_difference: NotRequired[ - Annotated[ - float, - Field( - description=( - "Allowed difference in value between set point and read point " - "after `time_difference`." - ) - ), - ] - ] - - class LimitsRange(TypedDict): high: Optional[float] low: Optional[float] @@ -93,23 +64,30 @@ class Limits(TypedDict): https://tango-controls.readthedocs.io/en/latest/development/device-api/attribute-alarms.html """ - control: NotRequired[Annotated[LimitsRange, Field(description="Control limits.")]] - display: NotRequired[Annotated[LimitsRange, Field(description="Display limits.")]] - warning: NotRequired[Annotated[LimitsRange, Field(description="Warning limits.")]] - alarm: NotRequired[Annotated[LimitsRange, Field(description="Alarm limits.")]] - hysteresis: NotRequired[Annotated[float, Field(description="Hysteresis.")]] - rds: NotRequired[Annotated[RdsRange, Field(description="RDS parameters.")]] - - -_ConstrainedDtype = Annotated[ - str, - Field( - description="A numpy dtype e.g `