Commit b86f7b50 authored by Gallacchi Mattia's avatar Gallacchi Mattia
Browse files

Merge branch '3-fix-no-args' into 'main'

Fix no arguments in command string

Closes #3

See merge request igib/public/rsvp/rsvp-python!3
parents 7f9e11b1 7df6c6c5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
[tool.poetry]
name = "pyrsvp"
version = "0.2.0"
version = "0.2.1"
description = "Implements RSVP communication protocol in Python"
authors = ["Mattia Gallacchi <mattia.gallacchi@he-arc.ch>"]
readme = "README.md"
+9 −10
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ class RsvpClient:

        return cmd_str[:-1] + "\r\n"

    def _check_response(self, cmd_name: str, resp: str) -> list:
    def _check_response(self, cmd_name: str, resp: str) -> dict:
        """Check the server response and process it

        Params
@@ -75,7 +75,7 @@ class RsvpClient:
        cmd, status = cmd_reply.split("=")

        if len(tokens) < 2:
            return None
            return {}

        # You expect to have a REPLY-{cmd_name}
        if cmd_name in cmd:
@@ -139,8 +139,8 @@ class RsvpClientTcp(RsvpClient):

    @typechecked
    def send_command(
        self, cmd_name: str, args: list[RsvpBaseType] = None, callback=None
    ) -> list:
        self, cmd_name: str, args: list[RsvpBaseType] = [], callback=None
    ) -> dict:
        """Send a command to the RSVP server and wait for a reply.

        Params
@@ -185,10 +185,9 @@ class RsvpClientTcp(RsvpClient):
        if callback:
            try:
                callback(data)
                return []
            except Exception as ex:
                raise RsvpClientInvalidCallback(ex) from ex
        else:

        return data


@@ -213,8 +212,8 @@ class RsvpClientSerial(RsvpClient):

    @typechecked
    def send_command(
        self, cmd_name: str, args: list[RsvpBaseType] = None, callback=None
    ) -> list:
        self, cmd_name: str, args: list[RsvpBaseType] = [], callback=None
    ) -> dict:
        """Send a command to the RSVP server and wait for a reply.

        Params
@@ -261,7 +260,7 @@ class RsvpClientSerial(RsvpClient):
        if callback:
            try:
                callback(data)
                return []
                return {}
            except Exception as ex:
                raise RsvpClientInvalidCallback(ex) from ex
        else:
+1 −1
Original line number Diff line number Diff line
@@ -99,7 +99,7 @@ class RsvpServer:

    @typechecked
    @staticmethod
    def reply(ack: bool, args: list[RsvpBaseType] = None) -> str:
    def reply(ack: bool, args: list[RsvpBaseType] = []) -> str:
        """Build a reply string

        Params