-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #73 from tangkong/enh_unify_data
ENH: Unify data handling under `EpicsData`
- Loading branch information
Showing
9 changed files
with
132 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
73 enh_unify_data | ||
################# | ||
|
||
API Breaks | ||
---------- | ||
- N/A | ||
|
||
Features | ||
-------- | ||
- Standardize data handling to create and expect EpicsData instead of backend-specific data types. | ||
|
||
Bugfixes | ||
-------- | ||
- N/A | ||
|
||
Maintenance | ||
----------- | ||
- Adjust Status, Severity enums to start at 0, matching EPICS | ||
|
||
Contributors | ||
------------ | ||
- tangkong |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
from ._base_shim import EpicsData # noqa | ||
from .core import ControlLayer # noqa | ||
from .status import TaskStatus # noqa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,32 @@ | ||
""" | ||
Base shim abstract base class | ||
""" | ||
from typing import Any, Callable | ||
from __future__ import annotations | ||
|
||
from dataclasses import dataclass, field | ||
from datetime import datetime | ||
from typing import Any, Callable, Optional | ||
|
||
from superscore.model import Severity, Status | ||
from superscore.type_hints import AnyEpicsType | ||
from superscore.utils import utcnow | ||
|
||
|
||
class _BaseShim: | ||
async def get(self, address: str) -> AnyEpicsType: | ||
async def get(self, address: str) -> EpicsData: | ||
raise NotImplementedError | ||
|
||
async def put(self, address: str, value: Any): | ||
raise NotImplementedError | ||
|
||
def monitor(self, address: str, callback: Callable): | ||
raise NotImplementedError | ||
|
||
|
||
@dataclass | ||
class EpicsData: | ||
"""Unified EPICS data type for holding data and relevant metadata""" | ||
data: Optional[AnyEpicsType] | ||
status: Severity = Status.UDF | ||
severity: Status = Severity.INVALID | ||
timestamp: datetime = field(default_factory=utcnow) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters