Skip to content

Commit

Permalink
Allow export of cast_string_to_type
Browse files Browse the repository at this point in the history
  • Loading branch information
bbrondel committed Aug 23, 2024
1 parent 4fdd35e commit 5cabebc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion python/lsst/ts/vent/controller/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@

from .config import Config
from .controller import Controller
from .dispatcher import Dispatcher
from .dispatcher import Dispatcher, cast_string_to_type
4 changes: 2 additions & 2 deletions python/lsst/ts/vent/controller/dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from .controller import Controller, VentGateState


def _cast_string_to_type(new_type: type, value: str):
def cast_string_to_type(new_type: type, value: str):
"""Converts the value string to the specified type. In the case of boolean,
"True" or "T" or "1" is ``True`` and everything else is ``False``. Other
cases are handled by cast.
Expand Down Expand Up @@ -150,7 +150,7 @@ async def read_and_dispatch(self) -> None:

try:
# Convert the arguments to their expected type.
args = [_cast_string_to_type(t, arg) for t, arg in zip(types, args)]
args = [cast_string_to_type(t, arg) for t, arg in zip(types, args)]
# Call the method with the specified arguments.
await getattr(self, command)(*args)
# Send back a success response.
Expand Down

0 comments on commit 5cabebc

Please sign in to comment.