From 885f43935677d6aa6bb80fa728e5db6c1cb460fe Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Tue, 13 Apr 2021 19:50:28 +0200 Subject: [PATCH] =?UTF-8?q?=E2=AC=86=20Bump=20version=20to=206.2.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- poetry.lock | 101 +++++++++++++++-------------- pyproject.toml | 4 +- royalnet_console/__main__.py | 63 ------------------ royalnet_console/pda.py | 100 ++++------------------------ royalnet_console/tests/test_pda.py | 49 -------------- 5 files changed, 65 insertions(+), 252 deletions(-) delete mode 100644 royalnet_console/__main__.py delete mode 100644 royalnet_console/tests/test_pda.py diff --git a/poetry.lock b/poetry.lock index f70917ae..fdde81b7 100644 --- a/poetry.lock +++ b/poetry.lock @@ -218,7 +218,7 @@ python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" [[package]] name = "pytest" -version = "6.2.2" +version = "6.2.3" description = "pytest: simple powerful testing with Python" category = "dev" optional = false @@ -279,7 +279,7 @@ socks = ["PySocks (>=1.5.6,!=1.5.7)", "win-inet-pton"] [[package]] name = "royalnet" -version = "6.1.2" +version = "6.2.1" description = "A multipurpose bot framework" category = "main" optional = false @@ -288,7 +288,7 @@ python-versions = ">=3.8,<4.0" [package.dependencies] async-property = ">=0.2.1,<0.3.0" pydantic = ">=1.8.1,<2.0.0" -sqlalchemy = ">=1.4.4,<2.0.0" +sqlalchemy = ">=1.4.5,<2.0.0" toml = ">=0.10.1,<0.11.0" [[package]] @@ -301,7 +301,7 @@ python-versions = "*" [[package]] name = "sphinx" -version = "3.5.3" +version = "3.5.4" description = "Python documentation generator" category = "dev" optional = false @@ -311,7 +311,7 @@ python-versions = ">=3.5" alabaster = ">=0.7,<0.8" babel = ">=1.3" colorama = {version = ">=0.3.5", markers = "sys_platform == \"win32\""} -docutils = ">=0.12" +docutils = ">=0.12,<0.17" imagesize = "*" Jinja2 = ">=2.3" packaging = "*" @@ -332,13 +332,14 @@ test = ["pytest", "pytest-cov", "html5lib", "cython", "typed-ast"] [[package]] name = "sphinx-rtd-theme" -version = "0.5.1" +version = "0.5.2" description = "Read the Docs theme for Sphinx" category = "dev" optional = false python-versions = "*" [package.dependencies] +docutils = "<0.17" sphinx = "*" [package.extras] @@ -417,7 +418,7 @@ test = ["pytest"] [[package]] name = "sqlalchemy" -version = "1.4.4" +version = "1.4.7" description = "Database Abstraction Library" category = "main" optional = false @@ -478,7 +479,7 @@ brotli = ["brotlipy (>=0.6.0)"] [metadata] lock-version = "1.1" python-versions = "^3.8" -content-hash = "489f33ca347cef611892ef9d1a26d00f3e96006d8f11c5bf45927631c97a8a6a" +content-hash = "dd03dba3d8cafa05d423d919e0dbda54ac96dddab43573811d49929b468f5d1a" [metadata.files] alabaster = [ @@ -711,8 +712,8 @@ pyparsing = [ {file = "pyparsing-2.4.7.tar.gz", hash = "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"}, ] pytest = [ - {file = "pytest-6.2.2-py3-none-any.whl", hash = "sha256:b574b57423e818210672e07ca1fa90aaf194a4f63f3ab909a2c67ebb22913839"}, - {file = "pytest-6.2.2.tar.gz", hash = "sha256:9d1edf9e7d0b84d72ea3dbcdfd22b35fb543a5e8f2a60092dd578936bf63d7f9"}, + {file = "pytest-6.2.3-py3-none-any.whl", hash = "sha256:6ad9c7bdf517a808242b998ac20063c41532a570d088d77eec1ee12b0b5574bc"}, + {file = "pytest-6.2.3.tar.gz", hash = "sha256:671238a46e4df0f3498d1c3270e5deb9b32d25134c99b7d75370a68cfbe9b634"}, ] pytest-asyncio = [ {file = "pytest-asyncio-0.14.0.tar.gz", hash = "sha256:9882c0c6b24429449f5f969a5158b528f39bde47dc32e85b9f0403965017e700"}, @@ -727,20 +728,20 @@ requests = [ {file = "requests-2.25.1.tar.gz", hash = "sha256:27973dd4a904a4f13b263a19c866c13b92a39ed1c964655f025f3f8d3d75b804"}, ] royalnet = [ - {file = "royalnet-6.1.2-py3-none-any.whl", hash = "sha256:d820e123714488066806834a7e6381279db719c275546f653f3335ecb42e3f69"}, - {file = "royalnet-6.1.2.tar.gz", hash = "sha256:e1f45a8a66c63d9a61d42b14a15b6681f99580314199c52206d3e03f80853855"}, + {file = "royalnet-6.2.1-py3-none-any.whl", hash = "sha256:e5b333fda9e5b0cf34537903e76ce9ffc3ca231df6c6ba28a9b1f9ee94efc843"}, + {file = "royalnet-6.2.1.tar.gz", hash = "sha256:a41bb353840f4b0c4f8fb40d0852d1da9f284af0f525c90f9bfb77d26ccd2c53"}, ] snowballstemmer = [ {file = "snowballstemmer-2.1.0-py2.py3-none-any.whl", hash = "sha256:b51b447bea85f9968c13b650126a888aabd4cb4463fca868ec596826325dedc2"}, {file = "snowballstemmer-2.1.0.tar.gz", hash = "sha256:e997baa4f2e9139951b6f4c631bad912dfd3c792467e2f03d7239464af90e914"}, ] sphinx = [ - {file = "Sphinx-3.5.3-py3-none-any.whl", hash = "sha256:3f01732296465648da43dec8fb40dc451ba79eb3e2cc5c6d79005fd98197107d"}, - {file = "Sphinx-3.5.3.tar.gz", hash = "sha256:ce9c228456131bab09a3d7d10ae58474de562a6f79abb3dc811ae401cf8c1abc"}, + {file = "Sphinx-3.5.4-py3-none-any.whl", hash = "sha256:2320d4e994a191f4b4be27da514e46b3d6b420f2ff895d064f52415d342461e8"}, + {file = "Sphinx-3.5.4.tar.gz", hash = "sha256:19010b7b9fa0dc7756a6e105b2aacd3a80f798af3c25c273be64d7beeb482cb1"}, ] sphinx-rtd-theme = [ - {file = "sphinx_rtd_theme-0.5.1-py2.py3-none-any.whl", hash = "sha256:fa6bebd5ab9a73da8e102509a86f3fcc36dec04a0b52ea80e5a033b2aba00113"}, - {file = "sphinx_rtd_theme-0.5.1.tar.gz", hash = "sha256:eda689eda0c7301a80cf122dad28b1861e5605cbf455558f3775e1e8200e83a5"}, + {file = "sphinx_rtd_theme-0.5.2-py2.py3-none-any.whl", hash = "sha256:4a05bdbe8b1446d77a01e20a23ebc6777c74f43237035e76be89699308987d6f"}, + {file = "sphinx_rtd_theme-0.5.2.tar.gz", hash = "sha256:32bd3b5d13dc8186d7a42fc816a23d32e83a4827d7d9882948e7b837c232da5a"}, ] sphinxcontrib-applehelp = [ {file = "sphinxcontrib-applehelp-1.0.2.tar.gz", hash = "sha256:a072735ec80e7675e3f432fcae8610ecf509c5f1869d17e2eecff44389cdbc58"}, @@ -767,40 +768,40 @@ sphinxcontrib-serializinghtml = [ {file = "sphinxcontrib_serializinghtml-1.1.4-py2.py3-none-any.whl", hash = "sha256:f242a81d423f59617a8e5cf16f5d4d74e28ee9a66f9e5b637a18082991db5a9a"}, ] sqlalchemy = [ - {file = "SQLAlchemy-1.4.4-cp27-cp27m-macosx_10_14_x86_64.whl", hash = "sha256:8dc25ce0be9614ea70077b3857754e685c1063cd2576845a3a2072e0f9d34854"}, - {file = "SQLAlchemy-1.4.4-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:79b9bb47e51208052e3949b3c4fae6ca32b0ed40ab498b25c2515be622509f7b"}, - {file = "SQLAlchemy-1.4.4-cp27-cp27m-win32.whl", hash = "sha256:6d9e9b686b192cd4d1df7330a790a12aecd01561ff104b9fbaed9bf11d49ea06"}, - {file = "SQLAlchemy-1.4.4-cp27-cp27m-win_amd64.whl", hash = "sha256:33da0ad3a913de9abac5a3fbac8e11993ce8c83431d123c216463239767db259"}, - {file = "SQLAlchemy-1.4.4-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:cbd3e77c9e162cf66241476128ff530bd4cc8f0f6bd5e433d320ace048491b71"}, - {file = "SQLAlchemy-1.4.4-cp36-cp36m-macosx_10_14_x86_64.whl", hash = "sha256:a478a0debaa4d66efcffd242bbefdc7e2759d596c8f4ecf3e29a2f0922f8d2d6"}, - {file = "SQLAlchemy-1.4.4-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:88c26aca818c5f10b6dc0588aabbbd14723d39e0707e74c229e0d650eb05eddd"}, - {file = "SQLAlchemy-1.4.4-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:578bcf10223a7cda84e54a7d4e986af4a36415f644fb33e950193dac25556bbd"}, - {file = "SQLAlchemy-1.4.4-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:015c78ece6f62963dc2fb3b409cafb1e6d97040478fe0ac811ba22833489c19f"}, - {file = "SQLAlchemy-1.4.4-cp36-cp36m-manylinux2014_x86_64.whl", hash = "sha256:a50b98d83aca42475e428fb812c8417278d21d7264d24ae0a99963b3e0f0bde8"}, - {file = "SQLAlchemy-1.4.4-cp36-cp36m-win32.whl", hash = "sha256:c5408cb8543fc9a9bdd61ee07a878a655e61e4067e7065cfe3fcab1cb1a611df"}, - {file = "SQLAlchemy-1.4.4-cp36-cp36m-win_amd64.whl", hash = "sha256:7f199813d08192a03c162f819fc265df233f4076086d7e23f07d0a90a4c9d337"}, - {file = "SQLAlchemy-1.4.4-cp37-cp37m-macosx_10_14_x86_64.whl", hash = "sha256:fc16311d5c7737842cd083bf9e02b6d7af406901abd296cae1c055b3b2281eaf"}, - {file = "SQLAlchemy-1.4.4-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:38af517c370b107372d22577e2c2495b53e2de3532d996f416dd13fda5e2a4f3"}, - {file = "SQLAlchemy-1.4.4-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:cee91fb7f22466e18370d6e181c866f3fb9379dab70048a629ceccc286594f40"}, - {file = "SQLAlchemy-1.4.4-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:742dce17585adebb197ac283c99a404c612328aa70ed8325b7b3cd4463f0b220"}, - {file = "SQLAlchemy-1.4.4-cp37-cp37m-manylinux2014_x86_64.whl", hash = "sha256:e65de7abf9c5bb83805d0dff7c443cac648555b445d10067fd1292a6537503ee"}, - {file = "SQLAlchemy-1.4.4-cp37-cp37m-win32.whl", hash = "sha256:6dfeb1f70cf33b8c788fa90839408f7cdae69d41b5d40a209be8b125385e71df"}, - {file = "SQLAlchemy-1.4.4-cp37-cp37m-win_amd64.whl", hash = "sha256:9619b7f9204adbbb78d10db7ef590d826a046a862aed845001ab504068646c87"}, - {file = "SQLAlchemy-1.4.4-cp38-cp38-macosx_10_14_x86_64.whl", hash = "sha256:b7195c168a35c80da3a2ebc242804c417ae2b9cea7eaca27c07d7f0a7fbb60df"}, - {file = "SQLAlchemy-1.4.4-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:9d4cd3568e4580c9b8dc4c14bf9a84d245d062c879f855d2cd8ea04748a02423"}, - {file = "SQLAlchemy-1.4.4-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:df0168d62569de746a0c7b663d34f0f5df578b604356385b9fbb8bdcab460276"}, - {file = "SQLAlchemy-1.4.4-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:3b79f477409ec1141f7d603361be3266a96c99e3d67357c25ea7cae2104f7a90"}, - {file = "SQLAlchemy-1.4.4-cp38-cp38-manylinux2014_x86_64.whl", hash = "sha256:e6a18a08d0a32157cb5168506cd356b22caf2a380532405d4cf21963dd2efe22"}, - {file = "SQLAlchemy-1.4.4-cp38-cp38-win32.whl", hash = "sha256:de4c935ee4afeabd5204d74faee34d511444b55394874e7072f525378f870038"}, - {file = "SQLAlchemy-1.4.4-cp38-cp38-win_amd64.whl", hash = "sha256:426660b62db4111ca6b10e05128c417fa97b4c3abce3a8952bbe691c4bc397fb"}, - {file = "SQLAlchemy-1.4.4-cp39-cp39-macosx_10_14_x86_64.whl", hash = "sha256:885e2dbf92c6a3b1e6b200c19eb17df12a6004cbd11149f336dc4b3a45b499a4"}, - {file = "SQLAlchemy-1.4.4-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:405f171ccdae38f64b1a43d3172a2a801b5dce4a96a60c39a5f7097e3c16d072"}, - {file = "SQLAlchemy-1.4.4-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:b85f68af8c6c1d0833b11c5534a38411cd0378059a8585731c2a9f18eb9e7d82"}, - {file = "SQLAlchemy-1.4.4-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:92c612edab94749ba8561c6c768854ef7a1dd0ef031c18a84b055a27fc505502"}, - {file = "SQLAlchemy-1.4.4-cp39-cp39-manylinux2014_x86_64.whl", hash = "sha256:4aab314df0d9fa9153b9fe735b2925da45425bd510eb0371b005aeca9ff51149"}, - {file = "SQLAlchemy-1.4.4-cp39-cp39-win32.whl", hash = "sha256:e7ff3ac2e0acdf92639128ed0b38ceed370115e3bb412840fc8c9c28d0ac50b4"}, - {file = "SQLAlchemy-1.4.4-cp39-cp39-win_amd64.whl", hash = "sha256:d0cc8dcda237d9d801bee8737a8ce5394586364740b9a8482b466fadb9ab1ff3"}, - {file = "SQLAlchemy-1.4.4.tar.gz", hash = "sha256:7ba9c00c129dbb4fd026a1f2c943188db59c802612e49bc9bded426d8eb14bc0"}, + {file = "SQLAlchemy-1.4.7-cp27-cp27m-macosx_10_14_x86_64.whl", hash = "sha256:e9c2aaaa9738ba3334262734bd25d9b2d6ea446400f815bbdea17571b9e6d8fb"}, + {file = "SQLAlchemy-1.4.7-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:94fece3fdc777fbf37378513414bcf19ae89e1b598edf33d957a2898991d714f"}, + {file = "SQLAlchemy-1.4.7-cp27-cp27m-win32.whl", hash = "sha256:58075eab5e32daf51e637ac88c63057c3a5e84602cfeb30db4258838ef6f7a2b"}, + {file = "SQLAlchemy-1.4.7-cp27-cp27m-win_amd64.whl", hash = "sha256:8df743c79181ecc6aadaf10569d452ef3eda06764fe0adc4ea981a48c01e1ad5"}, + {file = "SQLAlchemy-1.4.7-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:bb69a2d93c1a98a8d4ca24a8012ade4b771087dddbe077ad4ef4911d7f17185d"}, + {file = "SQLAlchemy-1.4.7-cp36-cp36m-macosx_10_14_x86_64.whl", hash = "sha256:d10117c9ce096bd6fb9a13c6fad274982f7889028e22a05719a6d219e2cf977e"}, + {file = "SQLAlchemy-1.4.7-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:abf18c62c4740d7199e443537066904789052d6d165cb279eb91bea35ea42ec4"}, + {file = "SQLAlchemy-1.4.7-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:8672ff62c9d48f62aa17bb806a591cdfed801d139eecbcf9224bffb80f6fdc30"}, + {file = "SQLAlchemy-1.4.7-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:8ecabd4cead9a582e2ffa7a3918bc31155d5c24b1fd16ed617171f913c438da1"}, + {file = "SQLAlchemy-1.4.7-cp36-cp36m-manylinux2014_x86_64.whl", hash = "sha256:e98934855337d76aa7726f444b0fa597a462271a95d01bc050644d88e1ee5aae"}, + {file = "SQLAlchemy-1.4.7-cp36-cp36m-win32.whl", hash = "sha256:6adb07e199781457b75f4773e63577a2898f95141f030b956a2a186055f24e76"}, + {file = "SQLAlchemy-1.4.7-cp36-cp36m-win_amd64.whl", hash = "sha256:d81a68df4f3eee490b66ba990648d3c77cbf2475291ef92aa4e05ef541ecfd66"}, + {file = "SQLAlchemy-1.4.7-cp37-cp37m-macosx_10_14_x86_64.whl", hash = "sha256:ef6d98d5b51eb826516499429e059872b61e272cb44630ca8de87650242d07d8"}, + {file = "SQLAlchemy-1.4.7-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:d5ef5619d421f8a86af874f867d17d823cd970ad0f2ae7c30723beb16922b4d6"}, + {file = "SQLAlchemy-1.4.7-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:c74310f13e5a113ef658345e2cedf9aa1fcb8b9a588e07d54c083c7fc71edf42"}, + {file = "SQLAlchemy-1.4.7-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:069fcda89c7d168382f674b5b566643f1420e4e7704c00cced2579675deb4eed"}, + {file = "SQLAlchemy-1.4.7-cp37-cp37m-manylinux2014_x86_64.whl", hash = "sha256:673cb375deb17e1561340710f428b33c27a11980d991a2ac88d7bf1c623faa0b"}, + {file = "SQLAlchemy-1.4.7-cp37-cp37m-win32.whl", hash = "sha256:aea57c7a5a4135abc10f81ce433b23325cbb9648a5dcb0ac1af1cdd413f7d0cb"}, + {file = "SQLAlchemy-1.4.7-cp37-cp37m-win_amd64.whl", hash = "sha256:6913ea108e7583f2d7ba4bc9cf4f2b1e0cdacf7e66e4cdc04192f870e64306ff"}, + {file = "SQLAlchemy-1.4.7-cp38-cp38-macosx_10_14_x86_64.whl", hash = "sha256:72152b64508dd807ba2a26d9dfc4da450d0ba1808c9f96ddbc397c435735fac3"}, + {file = "SQLAlchemy-1.4.7-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:9de4c84ea180c07f1d4010db2cfdbf9fe67bf7caafcfb1053644c8c03bfa3fd0"}, + {file = "SQLAlchemy-1.4.7-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:89860d594cb3256718d74ff7406a405a890eac71bcc044b3ba6868850d934a48"}, + {file = "SQLAlchemy-1.4.7-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:5d84442d85491dc473bf99f4d90ad45dd2e5539743f4d1216b15ba26575ba572"}, + {file = "SQLAlchemy-1.4.7-cp38-cp38-manylinux2014_x86_64.whl", hash = "sha256:fdd1e4ed5d526aa4c7a01ed2157d01f0234eaecdb04b1c3b5084d0902986be9f"}, + {file = "SQLAlchemy-1.4.7-cp38-cp38-win32.whl", hash = "sha256:3a022a7985a49cacf21e2a73bab083e4852943466d250d932554650d705fcc62"}, + {file = "SQLAlchemy-1.4.7-cp38-cp38-win_amd64.whl", hash = "sha256:a7f450cbab9670949e7d9f0eac1dd93eaaffce319608bf4b863f0b751decef42"}, + {file = "SQLAlchemy-1.4.7-cp39-cp39-macosx_10_14_x86_64.whl", hash = "sha256:2bfadb3279f51252565baed9aa071c1bef875fcde60bf4a172136289ac208804"}, + {file = "SQLAlchemy-1.4.7-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:1d1172a9e5ead90d9299ccad8c5eecf40372a3721ff82fc4b4ee42835baf4659"}, + {file = "SQLAlchemy-1.4.7-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:bea07faab746743c8d82650b51129ff2705d53a0094161cfa6145e7ce77b9644"}, + {file = "SQLAlchemy-1.4.7-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:a3a40d2a0cb2ca2886f8f2fe768e83aeca489a162c8233974b9b2e429827ed85"}, + {file = "SQLAlchemy-1.4.7-cp39-cp39-manylinux2014_x86_64.whl", hash = "sha256:50b1cb7c9f6f0bbc68c06453d66d4a34ca75ba60bce61d49bf007edfd2621d0a"}, + {file = "SQLAlchemy-1.4.7-cp39-cp39-win32.whl", hash = "sha256:d26d8a3865c9f33d7b3b356a577c7f26c499a9f080ae33e4282a65a8a2170cef"}, + {file = "SQLAlchemy-1.4.7-cp39-cp39-win_amd64.whl", hash = "sha256:606ac6a7640cc642fd53c5e693c560ad9fc21ef97aa7e799eb96b6d7f28ad723"}, + {file = "SQLAlchemy-1.4.7.tar.gz", hash = "sha256:84115f97d88c8ccf26db81b7997c5f5de9ae360e0785ef859d0987794495f0a9"}, ] toml = [ {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, diff --git a/pyproject.toml b/pyproject.toml index 85882d51..34f5cacd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "royalnet-console" -version = "1.0.0" +version = "2.0.0" description = "A terminal-based frontend for the royalnet.engineer module." authors = ["Stefano Pigozzi "] license = "AGPL-3.0-or-later" @@ -19,7 +19,7 @@ classifiers = [ [tool.poetry.dependencies] python = "^3.8" -royalnet = "^6.1.4" +royalnet = "~6.2.0" psutil = "^5.8.0" click = "^7.1.2" colorama = "^0.4.4" diff --git a/royalnet_console/__main__.py b/royalnet_console/__main__.py deleted file mode 100644 index 1f72ae30..00000000 --- a/royalnet_console/__main__.py +++ /dev/null @@ -1,63 +0,0 @@ -# Special imports -from __future__ import annotations -import royalnet.royaltyping as t - -# External imports -import logging -import importlib -import click -import asyncio -import royalnet.engineer as engi - -# Internal imports -from .pda import ConsolePDA - -# Special global objects -log = logging.getLogger(__name__) - - -# Code -@click.command() -@click.option("-p", "--pack", "packs", multiple=True) -def main(packs: t.List[str]): - log.debug("Creating PDA...") - pda = ConsolePDA() - - for pack in packs: - log.debug(f"Importing module: {pack!r}") - try: - pack = importlib.import_module(pack) - except ImportError as e: - log.error(f"Skipping {pack!r}: {e!r}") - continue - - for attribute in dir(pack): - log.debug(f"Getting attribute: {attribute!r}") - value = pack.__getattribute__(attribute) - log.debug(f"Attribute is: {value!r}") - - if isinstance(value, engi.PartialCommand): - log.debug(f"Attribute is a PartialCommand, registering it as: {value.f.__name__!r}") - pda.register_partial(part=value, names=[value.f.__name__]) - - elif isinstance(value, engi.Conversation): - log.debug(f"Attribute is a Conversation, registering it...") - pda.register_conversation(conv=value) - - log.debug("Getting event loop...") - loop = asyncio.get_event_loop() - log.debug(f"Event loop is: {loop!r}") - - log.debug("Running the PDA until interrupted...") - try: - loop.run_until_complete(pda.run()) - except KeyboardInterrupt: - log.debug("Got an interrupt, shutting down...") - exit(0) - - log.fatal("PDA stopped unexpectedly, shutting down...") - exit(1) - - -if __name__ == "__main__": - main() diff --git a/royalnet_console/pda.py b/royalnet_console/pda.py index 232fe4c9..819142b6 100644 --- a/royalnet_console/pda.py +++ b/royalnet_console/pda.py @@ -1,45 +1,31 @@ -# Module docstring """ -The PDA ("main" class) for the :mod:`royalnet_console` frontend. +.. todo:: Document this. """ -# Special imports from __future__ import annotations import royalnet.royaltyping as t -# External imports import logging import asyncio import royalnet.engineer as engi import click import datetime -# Internal imports from . import bullets -# Special global objects log = logging.getLogger(__name__) -# Code -class ConsolePDA: - """ - A PDA which handles :mod:`royalnet` input and output using a terminal as source. - """ +class ConsolePDAImplementation(engi.ConversationListImplementation): + def _partialcommand_pattern(self, partial) -> str: + if partial.syntax: + return r"^{name}\s+{syntax}$" + else: + return r"^{name}$" - def __init__(self): - log.debug(f"Creating new ConsolePDA...") - - self.dispenser: t.Optional[engi.Dispenser] = None - """ - The :class:`royalnet.engineer.dispenser.Dispenser` of this PDA. - """ - - self.conversations: t.List[engi.Conversation] = [] - """ - A :class:`list` of conversations to run before a new event is :meth:`.put` in a - :class:`~royalnet.engineer.dispenser.Dispenser`. - """ + @property + def namespace(self): + return "console" async def run(self, cycles: t.Union[bool, int] = True) -> t.NoReturn: """ @@ -55,74 +41,12 @@ class ConsolePDA: projectile = bullets.ConsoleMessageReceived(_text=message, _timestamp=datetime.datetime.now()) log.debug(f"Putting projectile: {projectile!r}") - await self.put_projectile(proj=projectile) + await self.put_projectile(key="TERMINAL", projectile=projectile) if isinstance(cycles, int): cycles -= 1 - def register_conversation(self, conv: engi.Conversation) -> None: - """ - Register a new conversation in the PDA. - :param conv: The conversation to register. - """ - log.info(f"Registering conversation: {conv!r}") - self.conversations.append(conv) - - def unregister_conversation(self, conv: engi.Conversation) -> None: - """ - Unregister a conversation from the PDA. - - :param conv: The conversation to unregister. - """ - log.info(f"Unregistering conversation: {conv!r}") - self.conversations.remove(conv) - - def register_partial(self, part: engi.PartialCommand, names: t.List[str]) -> engi.Command: - """ - Register a new :class:`~royalnet.engineer.command.PartialCommand` in the PDA, converting it to a - :class:`royalnet.engineer.Command` in the process. - - :param part: The :class:`~royalnet.engineer.command.PartialCommand` to register. - :param names: The :attr:`~royalnet.engineer.command.Command.names` to register the command with. - :return: The resulting :class:`~royalnet.engineer.command.Command`. - """ - log.debug(f"Completing partial: {part!r}") - if part.syntax: - command = part.complete(pattern=r"^{name}\s+{syntax}$", names=names) - else: - command = part.complete(pattern=r"^{name}$", names=names) - self.register_conversation(command) - return command - - async def put_projectile(self, proj: engi.Projectile) -> None: - """ - Insert a new projectile into the dispenser. - - :param proj: The projectile to put in the dispenser. - """ - if not self.dispenser: - log.debug(f"Dispenser not found, creating one...") - self.dispenser = engi.Dispenser() - - log.debug("Getting running loop...") - loop = asyncio.get_running_loop() - - for conversation in self.conversations: - log.debug(f"Creating run task for: {conversation!r}") - loop.create_task(self.dispenser.run(conversation), name=f"{repr(conversation)}") - - log.debug("Running a event loop cycle...") - await asyncio.sleep(0) - - log.debug(f"Putting projectile {proj!r} in dispenser {self.dispenser!r}...") - await self.dispenser.put(proj) - - log.debug("Awaiting another event loop cycle...") - await asyncio.sleep(0) - - -# Objects exported by this module __all__ = ( - "ConsolePDA", + "ConsolePDAImplementation", ) diff --git a/royalnet_console/tests/test_pda.py b/royalnet_console/tests/test_pda.py deleted file mode 100644 index cebf42d9..00000000 --- a/royalnet_console/tests/test_pda.py +++ /dev/null @@ -1,49 +0,0 @@ -import pytest -from royalnet_console.pda import ConsolePDA -import royalnet.engineer as engi - - -def test_construction(): - pda = ConsolePDA() - assert pda is not None - - -@pytest.fixture -def pda(): - return ConsolePDA() - - -@pytest.fixture -def command(): - @engi.PartialCommand.new(syntax="") - async def test(*, _sentry: engi.Sentry, _msg: engi.Message, **__): - await _msg.reply(text=r"test") - - return test - - -def test_registration(pda: ConsolePDA, command: engi.PartialCommand): - pda.register_partial(command, ["test"]) - - -@pytest.fixture -def pda_with_command(pda: ConsolePDA, command: engi.PartialCommand): - pda.register_partial(command, ["test"]) - return pda - - -@pytest.mark.asyncio -async def test_run(pda_with_command: ConsolePDA, monkeypatch): - check = False - - def trigger(text): - assert text == "test" - nonlocal check - check = True - - monkeypatch.setattr("click.prompt", lambda *_, **__: "test") - monkeypatch.setattr("click.echo", trigger) - - await pda_with_command.run(cycles=1) - - assert check is True