Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Signal/SignalBackend args #562

Closed
evalott100 opened this issue Sep 9, 2024 · 0 comments · Fixed by #594
Closed

Change Signal/SignalBackend args #562

evalott100 opened this issue Sep 9, 2024 · 0 comments · Fixed by #594

Comments

@evalott100
Copy link
Contributor

evalott100 commented Sep 9, 2024

We should alter the kwargs of Signal/SignalBackend such that

  • Signal takes an optional datatype in __init__ and do some validation on it
  • EpicsSignalBackend takes datatype in __init__
  • SignalBackend.connect now takes datatype instead
  • On both Signal and SignalBackend __init__ and connect arg to kwarg inference is prevented
# Signal
    def __init__(
        self,
        *,
        backend: Optional[SignalBackend[T]] = None,
        datatype: Optional[SignalDataType] = None,
        timeout: Optional[float] = DEFAULT_TIMEOUT,
        name: str = "",
    ) -> None:
        #: If set, then the datatype of the value is guaranteed to be this type
        self.datatype = datatype
        ....

    async def connect(
        self,
        *,
        mock=False,
        timeout=DEFAULT_TIMEOUT,
        force_reconnect: bool = False,
        backend: Optional[SignalBackend[T]] = None,
    ):
        ....

# Signal backend

@abstractmethod
async def connect(
    self,
    *,
    datatype: Optional[type] = None,
    timeout: float = DEFAULT_TIMEOUT
):
    ....

Part of this change will be getting rid of conversion in mock signal backend.

Originally posted by @coretl in #310 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant