Source code for ophyd_async.core._providers

from abc import abstractmethod
from dataclasses import dataclass
from typing import Protocol, Sequence


[docs] @dataclass class DirectoryInfo: directory_path: str filename_prefix: str
[docs] class DirectoryProvider(Protocol):
[docs] @abstractmethod def __call__(self) -> DirectoryInfo: """Get the current directory to write files into"""
[docs] class StaticDirectoryProvider(DirectoryProvider): def __init__(self, directory_path: str, filename_prefix: str) -> None: self._directory_info = DirectoryInfo(directory_path, filename_prefix) def __call__(self) -> DirectoryInfo: return self._directory_info
[docs] class NameProvider(Protocol):
[docs] @abstractmethod def __call__(self) -> str: """Get the name to be used as a data_key in the descriptor document"""
[docs] class ShapeProvider(Protocol):
[docs] @abstractmethod async def __call__(self) -> Sequence[int]: """Get the shape of the data collection"""