Skip to content

Commit

Permalink
Merge branch 'main' into remove-bg-thread
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelldls authored Jan 23, 2025
2 parents c3993ea + cf891fe commit 93140b8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
7 changes: 3 additions & 4 deletions src/fastcs/attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,9 @@ def __init__(
allowed_values: list[T] | None = None,
description: str | None = None,
) -> None:
assert datatype.dtype in ATTRIBUTE_TYPES, (
f"Attr type must be one of {ATTRIBUTE_TYPES}"
f", received type {datatype.dtype}"
)
assert (
datatype.dtype in ATTRIBUTE_TYPES
), f"Attr type must be one of {ATTRIBUTE_TYPES}, received type {datatype.dtype}"
self._datatype: DataType[T] = datatype
self._access_mode: AttrMode = access_mode
self._group = group
Expand Down
6 changes: 5 additions & 1 deletion src/fastcs/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,13 @@ def _get_periodic_scan_coros(scan_dict: dict[float, list[Callable]]) -> list[Cal


def _create_periodic_scan_coro(period, methods: list[Callable]) -> Callable:
async def _sleep():
await asyncio.sleep(period)

methods.append(_sleep) # Create periodic behavior

async def scan_coro() -> None:
while True:
await asyncio.gather(*[method() for method in methods])
await asyncio.sleep(period)

return scan_coro
2 changes: 1 addition & 1 deletion src/fastcs/transport/epics/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def create_gui(self, options: EpicsGUIOptions | None = None) -> None:
device = Device(label=options.title, children=components)

formatter = DLSFormatter()
formatter.format(device, options.output_path)
formatter.format(device, options.output_path.resolve())

def extract_mapping_components(self, mapping: SingleMapping) -> Tree:
components: Tree = []
Expand Down
4 changes: 2 additions & 2 deletions src/fastcs/transport/epics/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

@dataclass
class EpicsDocsOptions:
path: Path = Path.cwd()
path: Path = Path(".")
depth: int | None = None


Expand All @@ -16,7 +16,7 @@ class EpicsGUIFormat(Enum):

@dataclass
class EpicsGUIOptions:
output_path: Path = Path.cwd() / "output.bob"
output_path: Path = Path(".") / "output.bob"
file_format: EpicsGUIFormat = EpicsGUIFormat.bob
title: str = "Simple Device"

Expand Down

0 comments on commit 93140b8

Please sign in to comment.