Loading examples/tcpclient.py +10 −7 Original line number Diff line number Diff line Loading @@ -11,13 +11,16 @@ if __name__ == "__main__": client = RsvpClientTcp() args = [ RsvpInteger("INTEGER", 1), RsvpDouble("DOUBLE", 2.0), RsvpBool("BOOL", True), RsvpString("STRING", "hello world"), RsvpVectorDouble("DOUBLE_VEC", {"X": 1.0, "Y": 2.0, "Z": 3.0}), RsvpStringVector("STRING_VEC", ["Hello", "World"]) RsvpInteger("ARG1", 1), RsvpDouble("ARG2", 2.0), RsvpBool("ARG3", True), RsvpString("ARG4", "hello world"), RsvpVectorDouble("ARG5", {"X": 1.0, "Y": 2.0, "Z": 3.0}), RsvpStringVector("ARG6", ["Hello", "World"]) ] client.send_command("START", args, callback=start_cb) try: print(client.send_command("STOP", args)) except Exception as ex: print(f"[{type(ex).__name__}] Error: {ex}") No newline at end of file examples/tcpserver.py +48 −5 Original line number Diff line number Diff line from pyrsvp.rsvpserver import RsvpServer, RsvpServerTcp from pyrsvp.rsvptypes import * import argparse # class handles: # @RsvpServer.Command("START") # def start(self, values : dict): # print(values) # return RsvpServer.reply(True, [RsvpString("STATUS", "PASS")]) # @RsvpServer.Command("EXCEPTION") # def handle_exception(ex : Exception) -> str: # error =f"{type(ex).__name__} {ex}" # try: # raise ex # except Exception as ex: # print(f"{type(ex).__name__}: {ex}") # return RsvpServer.reply(False, [RsvpString("ERROR", error)]) #Define commands and their callbacks @RsvpServer.Command("START") def start(a: int, b: float, c: bool, d: str, e: dict, f: list) -> str: def start(values : dict) -> str: print(values) return RsvpServer.reply(True, [RsvpInteger("CODE", 1)]) print(f"a: {a}, b: {b}, c: {c}, d: {d}, e: {e}, f: {f}") return f"REPLY-START=ACK;STATUS=PASS" if __name__ == "__main__": srv = RsvpServerTcp() parser = argparse.ArgumentParser( prog="Tcp Server", description="This is a TCP server for RSVP" ) parser.add_argument("-i", "--ip_address", help="IP address of the server") parser.add_argument("-p", "--port", help="Port used by the server") args = parser.parse_args() ip = "localhost" port = 8080 if args.ip_address: ip = args.ip_address if args.port: port = args.port srv = RsvpServerTcp(ip, port) srv.run() poetry.lock +152 −2 Original line number Diff line number Diff line [[package]] name = "altgraph" version = "0.17.4" description = "Python graph (network) package" category = "dev" optional = false python-versions = "*" [[package]] name = "colorama" version = "0.4.6" Loading Loading @@ -25,6 +33,17 @@ category = "dev" optional = false python-versions = ">=3.7" [[package]] name = "macholib" version = "1.16.3" description = "Mach-O header analysis and editing" category = "dev" optional = false python-versions = "*" [package.dependencies] altgraph = ">=0.17" [[package]] name = "packaging" version = "23.2" Loading @@ -33,6 +52,14 @@ category = "dev" optional = false python-versions = ">=3.7" [[package]] name = "pefile" version = "2023.2.7" description = "Python PE parsing module" category = "dev" optional = false python-versions = ">=3.6.0" [[package]] name = "pluggy" version = "1.3.0" Loading @@ -45,6 +72,39 @@ python-versions = ">=3.8" dev = ["pre-commit", "tox"] testing = ["pytest", "pytest-benchmark"] [[package]] name = "pyinstaller" version = "6.3.0" description = "PyInstaller bundles a Python application and all its dependencies into a single package." category = "dev" optional = false python-versions = "<3.13,>=3.8" [package.dependencies] altgraph = "*" macholib = {version = ">=1.8", markers = "sys_platform == \"darwin\""} packaging = ">=22.0" pefile = {version = ">=2022.5.30", markers = "sys_platform == \"win32\""} pyinstaller-hooks-contrib = ">=2021.4" pywin32-ctypes = {version = ">=0.2.1", markers = "sys_platform == \"win32\""} setuptools = ">=42.0.0" [package.extras] completion = ["argcomplete"] hook_testing = ["execnet (>=1.5.0)", "psutil", "pytest (>=2.7.3)"] [[package]] name = "pyinstaller-hooks-contrib" version = "2023.12" description = "Community maintained hooks for PyInstaller" category = "dev" optional = false python-versions = ">=3.7" [package.dependencies] packaging = ">=22.0" setuptools = ">=42.0.0" [[package]] name = "pyserial" version = "3.5" Loading Loading @@ -75,6 +135,27 @@ tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} [package.extras] testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] [[package]] name = "pywin32-ctypes" version = "0.2.2" description = "A (partial) reimplementation of pywin32 using ctypes/cffi" category = "dev" optional = false python-versions = ">=3.6" [[package]] name = "setuptools" version = "69.0.3" description = "Easily download, build, install, upgrade, and uninstall Python packages" category = "dev" optional = false python-versions = ">=3.8" [package.extras] docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "rst.linker (>=1.9)", "sphinx (<7.2.5)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (>=1,<2)", "sphinx-reredirects", "sphinxcontrib-towncrier"] testing = ["build[virtualenv]", "filelock (>=3.4.0)", "flake8-2020", "ini2toml[lite] (>=0.9)", "jaraco.develop (>=7.21)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pip (>=19.1)", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-mypy (>=0.9.1)", "pytest-perf", "pytest-ruff", "pytest-timeout", "pytest-xdist", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] testing-integration = ["build[virtualenv] (>=1.0.3)", "filelock (>=3.4.0)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "packaging (>=23.1)", "pytest", "pytest-enabler", "pytest-xdist", "tomli", "virtualenv (>=13.0.0)", "wheel"] [[package]] name = "tomli" version = "2.0.1" Loading @@ -83,12 +164,39 @@ category = "dev" optional = false python-versions = ">=3.7" [[package]] name = "typeguard" version = "4.1.5" description = "Run-time type checker for Python" category = "main" optional = false python-versions = ">=3.8" [package.dependencies] typing-extensions = {version = ">=4.7.0", markers = "python_version < \"3.12\""} [package.extras] doc = ["Sphinx (>=7)", "packaging", "sphinx-autodoc-typehints (>=1.2.0)"] test = ["coverage[toml] (>=7)", "mypy (>=1.2.0)", "pytest (>=7)"] [[package]] name = "typing-extensions" version = "4.9.0" description = "Backported and Experimental Type Hints for Python 3.8+" category = "main" optional = false python-versions = ">=3.8" [metadata] lock-version = "1.1" python-versions = "^3.10" content-hash = "6d413f6dd3e7271659a47c02ba0a6715d2c5511894de71fc24c0a061d11a9ab5" python-versions = ">=3.10,<3.13" content-hash = "eb5574af099481673174dc0ff232f98027db90bc29bb3e7642fe52da84696f04" [metadata.files] altgraph = [ {file = "altgraph-0.17.4-py2.py3-none-any.whl", hash = "sha256:642743b4750de17e655e6711601b077bc6598dbfa3ba5fa2b2a35ce12b508dff"}, {file = "altgraph-0.17.4.tar.gz", hash = "sha256:1b5afbb98f6c4dcadb2e2ae6ab9fa994bbb8c1d75f4fa96d340f9437ae454406"}, ] colorama = [ {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, Loading @@ -101,14 +209,40 @@ iniconfig = [ {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, ] macholib = [ {file = "macholib-1.16.3-py2.py3-none-any.whl", hash = "sha256:0e315d7583d38b8c77e815b1ecbdbf504a8258d8b3e17b61165c6feb60d18f2c"}, {file = "macholib-1.16.3.tar.gz", hash = "sha256:07ae9e15e8e4cd9a788013d81f5908b3609aa76f9b1421bae9c4d7606ec86a30"}, ] packaging = [ {file = "packaging-23.2-py3-none-any.whl", hash = "sha256:8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7"}, {file = "packaging-23.2.tar.gz", hash = "sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5"}, ] pefile = [ {file = "pefile-2023.2.7-py3-none-any.whl", hash = "sha256:da185cd2af68c08a6cd4481f7325ed600a88f6a813bad9dea07ab3ef73d8d8d6"}, {file = "pefile-2023.2.7.tar.gz", hash = "sha256:82e6114004b3d6911c77c3953e3838654b04511b8b66e8583db70c65998017dc"}, ] pluggy = [ {file = "pluggy-1.3.0-py3-none-any.whl", hash = "sha256:d89c696a773f8bd377d18e5ecda92b7a3793cbe66c87060a6fb58c7b6e1061f7"}, {file = "pluggy-1.3.0.tar.gz", hash = "sha256:cf61ae8f126ac6f7c451172cf30e3e43d3ca77615509771b3a984a0730651e12"}, ] pyinstaller = [ {file = "pyinstaller-6.3.0-py3-none-macosx_10_13_universal2.whl", hash = "sha256:75a6f2a6f835a2e6e0899d10e60c10caf5defd25aced38b1dd48fbbabc89de07"}, {file = "pyinstaller-6.3.0-py3-none-manylinux2014_aarch64.whl", hash = "sha256:de25beb176f73a944758553caacec46cc665bf3910ad8a174706d79cf6e95340"}, {file = "pyinstaller-6.3.0-py3-none-manylinux2014_i686.whl", hash = "sha256:e436fcc0ea87c3f132baac916d508c24c84a8f6d8a06c3154fbc753f169b76c7"}, {file = "pyinstaller-6.3.0-py3-none-manylinux2014_ppc64le.whl", hash = "sha256:b721d793a33b6d9946c7dd95d3ea7589c0424b51cf1b9fe580f03c544f1336b2"}, {file = "pyinstaller-6.3.0-py3-none-manylinux2014_s390x.whl", hash = "sha256:96c37a1ee5b2fd5bb25c098ef510661d6d17b6515d0b86d8fc93727dd2475ba3"}, {file = "pyinstaller-6.3.0-py3-none-manylinux2014_x86_64.whl", hash = "sha256:abe91106a3bbccc3f3a27af4325676ecdb6f46cb842ac663625002a870fc503b"}, {file = "pyinstaller-6.3.0-py3-none-musllinux_1_1_aarch64.whl", hash = "sha256:41c937fe8f07ae02009b3b5a96ac3eb0800a4f8a97af142d4100060fe2135bb9"}, {file = "pyinstaller-6.3.0-py3-none-musllinux_1_1_x86_64.whl", hash = "sha256:886b3b995b674905a20ad5b720b47cc395897d7b391117831027a4c8c5d67a58"}, {file = "pyinstaller-6.3.0-py3-none-win32.whl", hash = "sha256:0597fb04337695e5cc5250253e0655530bf14f264b7a5b7d219cc65f6889c4bd"}, {file = "pyinstaller-6.3.0-py3-none-win_amd64.whl", hash = "sha256:156b32ba943e0090bcc68e40ae1cb68fd92b7f1ab6fe0bdf8faf3d3cfc4e12dd"}, {file = "pyinstaller-6.3.0-py3-none-win_arm64.whl", hash = "sha256:1eadbd1fae84e2e6c678d8b4ed6a232ec5c8fe3a839aea5a3071c4c0282f98cc"}, {file = "pyinstaller-6.3.0.tar.gz", hash = "sha256:914d4c96cc99472e37ac552fdd82fbbe09e67bb592d0717fcffaa99ea74273df"}, ] pyinstaller-hooks-contrib = [ {file = "pyinstaller-hooks-contrib-2023.12.tar.gz", hash = "sha256:11a9d59d903723dd693e8c10b054f3ea1ecad390623c9fa527c731d715fc5b3f"}, {file = "pyinstaller_hooks_contrib-2023.12-py2.py3-none-any.whl", hash = "sha256:6a601a0d783fa725327fc6ac712779475dc8979f639419c7fcd460dd8d0a6d2a"}, ] pyserial = [ {file = "pyserial-3.5-py2.py3-none-any.whl", hash = "sha256:c4451db6ba391ca6ca299fb3ec7bae67a5c55dde170964c7a14ceefec02f2cf0"}, {file = "pyserial-3.5.tar.gz", hash = "sha256:3c77e014170dfffbd816e6ffc205e9842efb10be9f58ec16d3e8675b4925cddb"}, Loading @@ -117,7 +251,23 @@ pytest = [ {file = "pytest-7.4.4-py3-none-any.whl", hash = "sha256:b090cdf5ed60bf4c45261be03239c2c1c22df034fbffe691abe93cd80cea01d8"}, {file = "pytest-7.4.4.tar.gz", hash = "sha256:2cf0005922c6ace4a3e2ec8b4080eb0d9753fdc93107415332f50ce9e7994280"}, ] pywin32-ctypes = [ {file = "pywin32-ctypes-0.2.2.tar.gz", hash = "sha256:3426e063bdd5fd4df74a14fa3cf80a0b42845a87e1d1e81f6549f9daec593a60"}, {file = "pywin32_ctypes-0.2.2-py3-none-any.whl", hash = "sha256:bf490a1a709baf35d688fe0ecf980ed4de11d2b3e37b51e5442587a75d9957e7"}, ] setuptools = [ {file = "setuptools-69.0.3-py3-none-any.whl", hash = "sha256:385eb4edd9c9d5c17540511303e39a147ce2fc04bc55289c322b9e5904fe2c05"}, {file = "setuptools-69.0.3.tar.gz", hash = "sha256:be1af57fc409f93647f2e8e4573a142ed38724b8cdd389706a867bb4efcf1e78"}, ] tomli = [ {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, ] typeguard = [ {file = "typeguard-4.1.5-py3-none-any.whl", hash = "sha256:8923e55f8873caec136c892c3bed1f676eae7be57cdb94819281b3d3bc9c0953"}, {file = "typeguard-4.1.5.tar.gz", hash = "sha256:ea0a113bbc111bcffc90789ebb215625c963411f7096a7e9062d4e4630c155fd"}, ] typing-extensions = [ {file = "typing_extensions-4.9.0-py3-none-any.whl", hash = "sha256:af72aea155e91adfc61c3ae9e0e342dbc0cba726d6cba4b6c72c1f34e47291cd"}, {file = "typing_extensions-4.9.0.tar.gz", hash = "sha256:23478f88c37f27d76ac8aee6c905017a143b0b1b886c3c9f66bc2fd94f9f5783"}, ] pyproject.toml +6 −1 Original line number Diff line number Diff line Loading @@ -6,13 +6,18 @@ authors = ["Mattia Gallacchi"] readme = "README.md" [tool.poetry.dependencies] python = "^3.10" python = ">=3.10,<3.13" pyserial = "^3.5" typeguard = "^4.1.5" [tool.poetry.group.test.dependencies] pytest = "^7.4.4" [tool.poetry.group.dev.dependencies] pyinstaller = "^6.3.0" [build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" pyrsvp/rsvpclient.py +5 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ This file contains the client definition import socket from pyrsvp.rsvptypes import RsvpBaseType, process_data_types from typeguard import typechecked class RsvpClientConnectionFailed(Exception): pass Loading Loading @@ -67,6 +68,9 @@ class RsvpClient: cmd_reply = tokens[0] cmd, status = cmd_reply.split("=") if len(tokens) < 2: return None # You expect to have a REPLY-{cmd_name} if cmd_name in cmd: if status == "NACK": Loading Loading @@ -119,6 +123,7 @@ class RsvpClientTcp(RsvpClient): except Exception as ex: raise RsvpClientConnectionFailed(f"Failed to connect: {ex}") @typechecked def send_command(self, cmd_name : str, args : list[RsvpBaseType] = None, callback = None) -> list: """Send a command to the RSVP server and wait for a reply. Loading Loading
examples/tcpclient.py +10 −7 Original line number Diff line number Diff line Loading @@ -11,13 +11,16 @@ if __name__ == "__main__": client = RsvpClientTcp() args = [ RsvpInteger("INTEGER", 1), RsvpDouble("DOUBLE", 2.0), RsvpBool("BOOL", True), RsvpString("STRING", "hello world"), RsvpVectorDouble("DOUBLE_VEC", {"X": 1.0, "Y": 2.0, "Z": 3.0}), RsvpStringVector("STRING_VEC", ["Hello", "World"]) RsvpInteger("ARG1", 1), RsvpDouble("ARG2", 2.0), RsvpBool("ARG3", True), RsvpString("ARG4", "hello world"), RsvpVectorDouble("ARG5", {"X": 1.0, "Y": 2.0, "Z": 3.0}), RsvpStringVector("ARG6", ["Hello", "World"]) ] client.send_command("START", args, callback=start_cb) try: print(client.send_command("STOP", args)) except Exception as ex: print(f"[{type(ex).__name__}] Error: {ex}") No newline at end of file
examples/tcpserver.py +48 −5 Original line number Diff line number Diff line from pyrsvp.rsvpserver import RsvpServer, RsvpServerTcp from pyrsvp.rsvptypes import * import argparse # class handles: # @RsvpServer.Command("START") # def start(self, values : dict): # print(values) # return RsvpServer.reply(True, [RsvpString("STATUS", "PASS")]) # @RsvpServer.Command("EXCEPTION") # def handle_exception(ex : Exception) -> str: # error =f"{type(ex).__name__} {ex}" # try: # raise ex # except Exception as ex: # print(f"{type(ex).__name__}: {ex}") # return RsvpServer.reply(False, [RsvpString("ERROR", error)]) #Define commands and their callbacks @RsvpServer.Command("START") def start(a: int, b: float, c: bool, d: str, e: dict, f: list) -> str: def start(values : dict) -> str: print(values) return RsvpServer.reply(True, [RsvpInteger("CODE", 1)]) print(f"a: {a}, b: {b}, c: {c}, d: {d}, e: {e}, f: {f}") return f"REPLY-START=ACK;STATUS=PASS" if __name__ == "__main__": srv = RsvpServerTcp() parser = argparse.ArgumentParser( prog="Tcp Server", description="This is a TCP server for RSVP" ) parser.add_argument("-i", "--ip_address", help="IP address of the server") parser.add_argument("-p", "--port", help="Port used by the server") args = parser.parse_args() ip = "localhost" port = 8080 if args.ip_address: ip = args.ip_address if args.port: port = args.port srv = RsvpServerTcp(ip, port) srv.run()
poetry.lock +152 −2 Original line number Diff line number Diff line [[package]] name = "altgraph" version = "0.17.4" description = "Python graph (network) package" category = "dev" optional = false python-versions = "*" [[package]] name = "colorama" version = "0.4.6" Loading Loading @@ -25,6 +33,17 @@ category = "dev" optional = false python-versions = ">=3.7" [[package]] name = "macholib" version = "1.16.3" description = "Mach-O header analysis and editing" category = "dev" optional = false python-versions = "*" [package.dependencies] altgraph = ">=0.17" [[package]] name = "packaging" version = "23.2" Loading @@ -33,6 +52,14 @@ category = "dev" optional = false python-versions = ">=3.7" [[package]] name = "pefile" version = "2023.2.7" description = "Python PE parsing module" category = "dev" optional = false python-versions = ">=3.6.0" [[package]] name = "pluggy" version = "1.3.0" Loading @@ -45,6 +72,39 @@ python-versions = ">=3.8" dev = ["pre-commit", "tox"] testing = ["pytest", "pytest-benchmark"] [[package]] name = "pyinstaller" version = "6.3.0" description = "PyInstaller bundles a Python application and all its dependencies into a single package." category = "dev" optional = false python-versions = "<3.13,>=3.8" [package.dependencies] altgraph = "*" macholib = {version = ">=1.8", markers = "sys_platform == \"darwin\""} packaging = ">=22.0" pefile = {version = ">=2022.5.30", markers = "sys_platform == \"win32\""} pyinstaller-hooks-contrib = ">=2021.4" pywin32-ctypes = {version = ">=0.2.1", markers = "sys_platform == \"win32\""} setuptools = ">=42.0.0" [package.extras] completion = ["argcomplete"] hook_testing = ["execnet (>=1.5.0)", "psutil", "pytest (>=2.7.3)"] [[package]] name = "pyinstaller-hooks-contrib" version = "2023.12" description = "Community maintained hooks for PyInstaller" category = "dev" optional = false python-versions = ">=3.7" [package.dependencies] packaging = ">=22.0" setuptools = ">=42.0.0" [[package]] name = "pyserial" version = "3.5" Loading Loading @@ -75,6 +135,27 @@ tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} [package.extras] testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] [[package]] name = "pywin32-ctypes" version = "0.2.2" description = "A (partial) reimplementation of pywin32 using ctypes/cffi" category = "dev" optional = false python-versions = ">=3.6" [[package]] name = "setuptools" version = "69.0.3" description = "Easily download, build, install, upgrade, and uninstall Python packages" category = "dev" optional = false python-versions = ">=3.8" [package.extras] docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "rst.linker (>=1.9)", "sphinx (<7.2.5)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (>=1,<2)", "sphinx-reredirects", "sphinxcontrib-towncrier"] testing = ["build[virtualenv]", "filelock (>=3.4.0)", "flake8-2020", "ini2toml[lite] (>=0.9)", "jaraco.develop (>=7.21)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pip (>=19.1)", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-mypy (>=0.9.1)", "pytest-perf", "pytest-ruff", "pytest-timeout", "pytest-xdist", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] testing-integration = ["build[virtualenv] (>=1.0.3)", "filelock (>=3.4.0)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "packaging (>=23.1)", "pytest", "pytest-enabler", "pytest-xdist", "tomli", "virtualenv (>=13.0.0)", "wheel"] [[package]] name = "tomli" version = "2.0.1" Loading @@ -83,12 +164,39 @@ category = "dev" optional = false python-versions = ">=3.7" [[package]] name = "typeguard" version = "4.1.5" description = "Run-time type checker for Python" category = "main" optional = false python-versions = ">=3.8" [package.dependencies] typing-extensions = {version = ">=4.7.0", markers = "python_version < \"3.12\""} [package.extras] doc = ["Sphinx (>=7)", "packaging", "sphinx-autodoc-typehints (>=1.2.0)"] test = ["coverage[toml] (>=7)", "mypy (>=1.2.0)", "pytest (>=7)"] [[package]] name = "typing-extensions" version = "4.9.0" description = "Backported and Experimental Type Hints for Python 3.8+" category = "main" optional = false python-versions = ">=3.8" [metadata] lock-version = "1.1" python-versions = "^3.10" content-hash = "6d413f6dd3e7271659a47c02ba0a6715d2c5511894de71fc24c0a061d11a9ab5" python-versions = ">=3.10,<3.13" content-hash = "eb5574af099481673174dc0ff232f98027db90bc29bb3e7642fe52da84696f04" [metadata.files] altgraph = [ {file = "altgraph-0.17.4-py2.py3-none-any.whl", hash = "sha256:642743b4750de17e655e6711601b077bc6598dbfa3ba5fa2b2a35ce12b508dff"}, {file = "altgraph-0.17.4.tar.gz", hash = "sha256:1b5afbb98f6c4dcadb2e2ae6ab9fa994bbb8c1d75f4fa96d340f9437ae454406"}, ] colorama = [ {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, Loading @@ -101,14 +209,40 @@ iniconfig = [ {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, ] macholib = [ {file = "macholib-1.16.3-py2.py3-none-any.whl", hash = "sha256:0e315d7583d38b8c77e815b1ecbdbf504a8258d8b3e17b61165c6feb60d18f2c"}, {file = "macholib-1.16.3.tar.gz", hash = "sha256:07ae9e15e8e4cd9a788013d81f5908b3609aa76f9b1421bae9c4d7606ec86a30"}, ] packaging = [ {file = "packaging-23.2-py3-none-any.whl", hash = "sha256:8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7"}, {file = "packaging-23.2.tar.gz", hash = "sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5"}, ] pefile = [ {file = "pefile-2023.2.7-py3-none-any.whl", hash = "sha256:da185cd2af68c08a6cd4481f7325ed600a88f6a813bad9dea07ab3ef73d8d8d6"}, {file = "pefile-2023.2.7.tar.gz", hash = "sha256:82e6114004b3d6911c77c3953e3838654b04511b8b66e8583db70c65998017dc"}, ] pluggy = [ {file = "pluggy-1.3.0-py3-none-any.whl", hash = "sha256:d89c696a773f8bd377d18e5ecda92b7a3793cbe66c87060a6fb58c7b6e1061f7"}, {file = "pluggy-1.3.0.tar.gz", hash = "sha256:cf61ae8f126ac6f7c451172cf30e3e43d3ca77615509771b3a984a0730651e12"}, ] pyinstaller = [ {file = "pyinstaller-6.3.0-py3-none-macosx_10_13_universal2.whl", hash = "sha256:75a6f2a6f835a2e6e0899d10e60c10caf5defd25aced38b1dd48fbbabc89de07"}, {file = "pyinstaller-6.3.0-py3-none-manylinux2014_aarch64.whl", hash = "sha256:de25beb176f73a944758553caacec46cc665bf3910ad8a174706d79cf6e95340"}, {file = "pyinstaller-6.3.0-py3-none-manylinux2014_i686.whl", hash = "sha256:e436fcc0ea87c3f132baac916d508c24c84a8f6d8a06c3154fbc753f169b76c7"}, {file = "pyinstaller-6.3.0-py3-none-manylinux2014_ppc64le.whl", hash = "sha256:b721d793a33b6d9946c7dd95d3ea7589c0424b51cf1b9fe580f03c544f1336b2"}, {file = "pyinstaller-6.3.0-py3-none-manylinux2014_s390x.whl", hash = "sha256:96c37a1ee5b2fd5bb25c098ef510661d6d17b6515d0b86d8fc93727dd2475ba3"}, {file = "pyinstaller-6.3.0-py3-none-manylinux2014_x86_64.whl", hash = "sha256:abe91106a3bbccc3f3a27af4325676ecdb6f46cb842ac663625002a870fc503b"}, {file = "pyinstaller-6.3.0-py3-none-musllinux_1_1_aarch64.whl", hash = "sha256:41c937fe8f07ae02009b3b5a96ac3eb0800a4f8a97af142d4100060fe2135bb9"}, {file = "pyinstaller-6.3.0-py3-none-musllinux_1_1_x86_64.whl", hash = "sha256:886b3b995b674905a20ad5b720b47cc395897d7b391117831027a4c8c5d67a58"}, {file = "pyinstaller-6.3.0-py3-none-win32.whl", hash = "sha256:0597fb04337695e5cc5250253e0655530bf14f264b7a5b7d219cc65f6889c4bd"}, {file = "pyinstaller-6.3.0-py3-none-win_amd64.whl", hash = "sha256:156b32ba943e0090bcc68e40ae1cb68fd92b7f1ab6fe0bdf8faf3d3cfc4e12dd"}, {file = "pyinstaller-6.3.0-py3-none-win_arm64.whl", hash = "sha256:1eadbd1fae84e2e6c678d8b4ed6a232ec5c8fe3a839aea5a3071c4c0282f98cc"}, {file = "pyinstaller-6.3.0.tar.gz", hash = "sha256:914d4c96cc99472e37ac552fdd82fbbe09e67bb592d0717fcffaa99ea74273df"}, ] pyinstaller-hooks-contrib = [ {file = "pyinstaller-hooks-contrib-2023.12.tar.gz", hash = "sha256:11a9d59d903723dd693e8c10b054f3ea1ecad390623c9fa527c731d715fc5b3f"}, {file = "pyinstaller_hooks_contrib-2023.12-py2.py3-none-any.whl", hash = "sha256:6a601a0d783fa725327fc6ac712779475dc8979f639419c7fcd460dd8d0a6d2a"}, ] pyserial = [ {file = "pyserial-3.5-py2.py3-none-any.whl", hash = "sha256:c4451db6ba391ca6ca299fb3ec7bae67a5c55dde170964c7a14ceefec02f2cf0"}, {file = "pyserial-3.5.tar.gz", hash = "sha256:3c77e014170dfffbd816e6ffc205e9842efb10be9f58ec16d3e8675b4925cddb"}, Loading @@ -117,7 +251,23 @@ pytest = [ {file = "pytest-7.4.4-py3-none-any.whl", hash = "sha256:b090cdf5ed60bf4c45261be03239c2c1c22df034fbffe691abe93cd80cea01d8"}, {file = "pytest-7.4.4.tar.gz", hash = "sha256:2cf0005922c6ace4a3e2ec8b4080eb0d9753fdc93107415332f50ce9e7994280"}, ] pywin32-ctypes = [ {file = "pywin32-ctypes-0.2.2.tar.gz", hash = "sha256:3426e063bdd5fd4df74a14fa3cf80a0b42845a87e1d1e81f6549f9daec593a60"}, {file = "pywin32_ctypes-0.2.2-py3-none-any.whl", hash = "sha256:bf490a1a709baf35d688fe0ecf980ed4de11d2b3e37b51e5442587a75d9957e7"}, ] setuptools = [ {file = "setuptools-69.0.3-py3-none-any.whl", hash = "sha256:385eb4edd9c9d5c17540511303e39a147ce2fc04bc55289c322b9e5904fe2c05"}, {file = "setuptools-69.0.3.tar.gz", hash = "sha256:be1af57fc409f93647f2e8e4573a142ed38724b8cdd389706a867bb4efcf1e78"}, ] tomli = [ {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, ] typeguard = [ {file = "typeguard-4.1.5-py3-none-any.whl", hash = "sha256:8923e55f8873caec136c892c3bed1f676eae7be57cdb94819281b3d3bc9c0953"}, {file = "typeguard-4.1.5.tar.gz", hash = "sha256:ea0a113bbc111bcffc90789ebb215625c963411f7096a7e9062d4e4630c155fd"}, ] typing-extensions = [ {file = "typing_extensions-4.9.0-py3-none-any.whl", hash = "sha256:af72aea155e91adfc61c3ae9e0e342dbc0cba726d6cba4b6c72c1f34e47291cd"}, {file = "typing_extensions-4.9.0.tar.gz", hash = "sha256:23478f88c37f27d76ac8aee6c905017a143b0b1b886c3c9f66bc2fd94f9f5783"}, ]
pyproject.toml +6 −1 Original line number Diff line number Diff line Loading @@ -6,13 +6,18 @@ authors = ["Mattia Gallacchi"] readme = "README.md" [tool.poetry.dependencies] python = "^3.10" python = ">=3.10,<3.13" pyserial = "^3.5" typeguard = "^4.1.5" [tool.poetry.group.test.dependencies] pytest = "^7.4.4" [tool.poetry.group.dev.dependencies] pyinstaller = "^6.3.0" [build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api"
pyrsvp/rsvpclient.py +5 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ This file contains the client definition import socket from pyrsvp.rsvptypes import RsvpBaseType, process_data_types from typeguard import typechecked class RsvpClientConnectionFailed(Exception): pass Loading Loading @@ -67,6 +68,9 @@ class RsvpClient: cmd_reply = tokens[0] cmd, status = cmd_reply.split("=") if len(tokens) < 2: return None # You expect to have a REPLY-{cmd_name} if cmd_name in cmd: if status == "NACK": Loading Loading @@ -119,6 +123,7 @@ class RsvpClientTcp(RsvpClient): except Exception as ex: raise RsvpClientConnectionFailed(f"Failed to connect: {ex}") @typechecked def send_command(self, cmd_name : str, args : list[RsvpBaseType] = None, callback = None) -> list: """Send a command to the RSVP server and wait for a reply. Loading