diff --git a/ioc/modules/devshell.nix b/ioc/modules/devshell.nix index 744a160b..3a8716da 100644 --- a/ioc/modules/devshell.nix +++ b/ioc/modules/devshell.nix @@ -295,7 +295,7 @@ in { # set to empty if unset : "''${EPICS_COMPONENTS=}" - IFS=: read -ra components <<<$EPICS_COMPONENTS + IFS=: read -ra components <<<"$EPICS_COMPONENTS" for component in "''${components[@]}"; do echo "$component" diff --git a/ioc/tests/support/StreamDevice/simple/mock-server/mock_server/__init__.py b/ioc/tests/support/StreamDevice/simple/mock-server/mock_server/__init__.py index 0086e403..92fb10c6 100644 --- a/ioc/tests/support/StreamDevice/simple/mock-server/mock_server/__init__.py +++ b/ioc/tests/support/StreamDevice/simple/mock-server/mock_server/__init__.py @@ -1,21 +1,25 @@ -import sys +"""A simple server mocking an ASCII communication.""" +import sys -__version__ = '0.1.0' +__version__ = "0.1.0" -def log(*args, **kwargs): +def log(*args: str, **kwargs: str) -> None: + """Print a message to stderr.""" print(*args, file=sys.stderr, **kwargs) -def send(*args, **kwargs): - print(*args, end='\r\n', flush=True, **kwargs) +def send(*args: str, **kwargs: str) -> None: + """Send a message.""" + print(*args, end="\r\n", flush=True, **kwargs) -def main(): - log('received connection') +def main() -> None: + """Start the mock server.""" + log("received connection") - varfloat = 0. + varfloat = 0.0 scalc = "" while True: @@ -24,20 +28,23 @@ def main(): if not data: break - log('received command:', data) - - if data == 'FLOAT': - send('42.1234') - elif data == 'FLOAT_WITH_PREFIX': - send('VALUE: 69.1337') - elif data == 'ENUM': - send('TWO') - elif data.startswith('SET_VARFLOAT '): - varfloat = float(data.split(' ', maxsplit=1)[1]) - elif data == 'GET_VARFLOAT': + log("received command:", data) + + # TODO(minijackson): change that with a command-line parsing tool? + + if data == "FLOAT": + send("42.1234") + elif data == "FLOAT_WITH_PREFIX": + send("VALUE: 69.1337") + elif data == "ENUM": + send("TWO") + elif data.startswith("SET_VARFLOAT "): + varfloat = float(data.split(" ", maxsplit=1)[1]) + elif data == "GET_VARFLOAT": send(str(varfloat)) elif data == "REGEX_TITLE": - send(""" + send( + """ Hello, World! @@ -46,13 +53,14 @@ def main():

Hello, World!

-""") +""", + ) elif data == "REGEX_SUB": send("abcabcabcabc") - elif data.startswith('SET_SCALC '): - send('sent') - scalc = data.split(' ', maxsplit=1)[1] - elif data == 'GET_SCALC': + elif data.startswith("SET_SCALC "): + send("sent") + scalc = data.split(" ", maxsplit=1)[1] + elif data == "GET_SCALC": send(scalc) else: - log('unknown command') + log("unknown command") diff --git a/ioc/tests/support/StreamDevice/simple/mock-server/pyproject.toml b/ioc/tests/support/StreamDevice/simple/mock-server/pyproject.toml index 351e4b8c..d248b538 100644 --- a/ioc/tests/support/StreamDevice/simple/mock-server/pyproject.toml +++ b/ioc/tests/support/StreamDevice/simple/mock-server/pyproject.toml @@ -10,3 +10,6 @@ mock_server = "mock_server:main" [build-system] requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" + +[tool.ruff] +select = ["ALL"] diff --git a/pkgs/epnix/support/calc/default.nix b/pkgs/epnix/support/calc/default.nix index 3ad56b87..e3a4cb8a 100644 --- a/pkgs/epnix/support/calc/default.nix +++ b/pkgs/epnix/support/calc/default.nix @@ -1,5 +1,4 @@ { - lib, epnixLib, mkEpicsPackage, fetchFromGitHub,