diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9e3cc3c5..1c358fe6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,9 +2,18 @@ # See https://pre-commit.com/hooks.html for more hooks default_language_version: python: python3.11 +default_install_hook_types: + - pre-commit + - commit-msg repos: +- repo: https://github.com/compilerla/conventional-pre-commit + rev: v4.0.0 + hooks: + - id: conventional-pre-commit + stages: [commit-msg] + args: [] - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v5.0.0 hooks: - id: no-commit-to-branch - id: check-executables-have-shebangs @@ -22,29 +31,29 @@ repos: args: - --autofix - repo: https://github.com/psf/black - rev: 23.7.0 + rev: 25.1.0 hooks: - id: black language_version: python3 - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.5.1 + rev: v1.15.0 hooks: - id: mypy language: system - repo: https://github.com/pycqa/pylint - rev: v2.17.5 + rev: v3.3.6 hooks: - id: pylint language: system - repo: https://github.com/Lucas-C/pre-commit-hooks - rev: v1.5.0 + rev: v1.5.5 hooks: - id: forbid-crlf - id: remove-crlf - id: forbid-tabs - id: remove-tabs - repo: https://github.com/PyCQA/bandit - rev: 1.7.5 + rev: 1.8.3 hooks: - id: bandit args: ["--skip=B101"] @@ -53,7 +62,7 @@ repos: hooks: - id: rst-linter - repo: https://github.com/Yelp/detect-secrets - rev: v1.4.0 + rev: v1.5.0 hooks: - id: detect-secrets language: system diff --git a/README.rst b/README.rst index b7a2b716..0524af8e 100644 --- a/README.rst +++ b/README.rst @@ -236,7 +236,7 @@ pre-commit considerations If working in Docker instead of native env you need to run the pre-commit checks in docker too:: - docker exec -i rasenmaeher_api_devel /bin/bash -c "pre-commit install" + docker exec -i rasenmaeher_api_devel /bin/bash -c "pre-commit install --install-hooks" docker exec -i rasenmaeher_api_devel /bin/bash -c "pre-commit run --all-files" You need to have the container running, see above. Or alternatively use the docker run syntax but using @@ -290,7 +290,7 @@ TLDR: - Install project deps and pre-commit hooks:: poetry install - pre-commit install + pre-commit install --install-hooks pre-commit run --all-files - Ready to go. diff --git a/poetry.lock b/poetry.lock index eeaf290f..48d3da41 100644 --- a/poetry.lock +++ b/poetry.lock @@ -164,20 +164,16 @@ trio = ["trio (>=0.26.1)"] [[package]] name = "astroid" -version = "2.15.8" +version = "3.3.9" description = "An abstract syntax tree for Python with inference support." optional = false -python-versions = ">=3.7.2" +python-versions = ">=3.9.0" groups = ["dev"] files = [ - {file = "astroid-2.15.8-py3-none-any.whl", hash = "sha256:1aa149fc5c6589e3d0ece885b4491acd80af4f087baafa3fb5203b113e68cd3c"}, - {file = "astroid-2.15.8.tar.gz", hash = "sha256:6c107453dffee9055899705de3c9ead36e74119cee151e5a9aaf7f0b0e020a6a"}, + {file = "astroid-3.3.9-py3-none-any.whl", hash = "sha256:d05bfd0acba96a7bd43e222828b7d9bc1e138aaeb0649707908d3702a9831248"}, + {file = "astroid-3.3.9.tar.gz", hash = "sha256:622cc8e3048684aa42c820d9d218978021c3c3d174fb03a9f0d615921744f550"}, ] -[package.dependencies] -lazy-object-proxy = ">=1.4.0" -wrapt = {version = ">=1.14,<2", markers = "python_version >= \"3.11\""} - [[package]] name = "async-asgi-testclient" version = "1.4.11" @@ -252,34 +248,34 @@ yaml = ["PyYAML"] [[package]] name = "black" -version = "23.12.1" +version = "25.1.0" description = "The uncompromising code formatter." optional = false -python-versions = ">=3.8" +python-versions = ">=3.9" groups = ["dev"] files = [ - {file = "black-23.12.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e0aaf6041986767a5e0ce663c7a2f0e9eaf21e6ff87a5f95cbf3675bfd4c41d2"}, - {file = "black-23.12.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c88b3711d12905b74206227109272673edce0cb29f27e1385f33b0163c414bba"}, - {file = "black-23.12.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a920b569dc6b3472513ba6ddea21f440d4b4c699494d2e972a1753cdc25df7b0"}, - {file = "black-23.12.1-cp310-cp310-win_amd64.whl", hash = "sha256:3fa4be75ef2a6b96ea8d92b1587dd8cb3a35c7e3d51f0738ced0781c3aa3a5a3"}, - {file = "black-23.12.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:8d4df77958a622f9b5a4c96edb4b8c0034f8434032ab11077ec6c56ae9f384ba"}, - {file = "black-23.12.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:602cfb1196dc692424c70b6507593a2b29aac0547c1be9a1d1365f0d964c353b"}, - {file = "black-23.12.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9c4352800f14be5b4864016882cdba10755bd50805c95f728011bcb47a4afd59"}, - {file = "black-23.12.1-cp311-cp311-win_amd64.whl", hash = "sha256:0808494f2b2df923ffc5723ed3c7b096bd76341f6213989759287611e9837d50"}, - {file = "black-23.12.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:25e57fd232a6d6ff3f4478a6fd0580838e47c93c83eaf1ccc92d4faf27112c4e"}, - {file = "black-23.12.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:2d9e13db441c509a3763a7a3d9a49ccc1b4e974a47be4e08ade2a228876500ec"}, - {file = "black-23.12.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6d1bd9c210f8b109b1762ec9fd36592fdd528485aadb3f5849b2740ef17e674e"}, - {file = "black-23.12.1-cp312-cp312-win_amd64.whl", hash = "sha256:ae76c22bde5cbb6bfd211ec343ded2163bba7883c7bc77f6b756a1049436fbb9"}, - {file = "black-23.12.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:1fa88a0f74e50e4487477bc0bb900c6781dbddfdfa32691e780bf854c3b4a47f"}, - {file = "black-23.12.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:a4d6a9668e45ad99d2f8ec70d5c8c04ef4f32f648ef39048d010b0689832ec6d"}, - {file = "black-23.12.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b18fb2ae6c4bb63eebe5be6bd869ba2f14fd0259bda7d18a46b764d8fb86298a"}, - {file = "black-23.12.1-cp38-cp38-win_amd64.whl", hash = "sha256:c04b6d9d20e9c13f43eee8ea87d44156b8505ca8a3c878773f68b4e4812a421e"}, - {file = "black-23.12.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:3e1b38b3135fd4c025c28c55ddfc236b05af657828a8a6abe5deec419a0b7055"}, - {file = "black-23.12.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:4f0031eaa7b921db76decd73636ef3a12c942ed367d8c3841a0739412b260a54"}, - {file = "black-23.12.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:97e56155c6b737854e60a9ab1c598ff2533d57e7506d97af5481141671abf3ea"}, - {file = "black-23.12.1-cp39-cp39-win_amd64.whl", hash = "sha256:dd15245c8b68fe2b6bd0f32c1556509d11bb33aec9b5d0866dd8e2ed3dba09c2"}, - {file = "black-23.12.1-py3-none-any.whl", hash = "sha256:78baad24af0f033958cad29731e27363183e140962595def56423e626f4bee3e"}, - {file = "black-23.12.1.tar.gz", hash = "sha256:4ce3ef14ebe8d9509188014d96af1c456a910d5b5cbf434a09fef7e024b3d0d5"}, + {file = "black-25.1.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:759e7ec1e050a15f89b770cefbf91ebee8917aac5c20483bc2d80a6c3a04df32"}, + {file = "black-25.1.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:0e519ecf93120f34243e6b0054db49c00a35f84f195d5bce7e9f5cfc578fc2da"}, + {file = "black-25.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:055e59b198df7ac0b7efca5ad7ff2516bca343276c466be72eb04a3bcc1f82d7"}, + {file = "black-25.1.0-cp310-cp310-win_amd64.whl", hash = "sha256:db8ea9917d6f8fc62abd90d944920d95e73c83a5ee3383493e35d271aca872e9"}, + {file = "black-25.1.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:a39337598244de4bae26475f77dda852ea00a93bd4c728e09eacd827ec929df0"}, + {file = "black-25.1.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:96c1c7cd856bba8e20094e36e0f948718dc688dba4a9d78c3adde52b9e6c2299"}, + {file = "black-25.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:bce2e264d59c91e52d8000d507eb20a9aca4a778731a08cfff7e5ac4a4bb7096"}, + {file = "black-25.1.0-cp311-cp311-win_amd64.whl", hash = "sha256:172b1dbff09f86ce6f4eb8edf9dede08b1fce58ba194c87d7a4f1a5aa2f5b3c2"}, + {file = "black-25.1.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:4b60580e829091e6f9238c848ea6750efed72140b91b048770b64e74fe04908b"}, + {file = "black-25.1.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:1e2978f6df243b155ef5fa7e558a43037c3079093ed5d10fd84c43900f2d8ecc"}, + {file = "black-25.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:3b48735872ec535027d979e8dcb20bf4f70b5ac75a8ea99f127c106a7d7aba9f"}, + {file = "black-25.1.0-cp312-cp312-win_amd64.whl", hash = "sha256:ea0213189960bda9cf99be5b8c8ce66bb054af5e9e861249cd23471bd7b0b3ba"}, + {file = "black-25.1.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:8f0b18a02996a836cc9c9c78e5babec10930862827b1b724ddfe98ccf2f2fe4f"}, + {file = "black-25.1.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:afebb7098bfbc70037a053b91ae8437c3857482d3a690fefc03e9ff7aa9a5fd3"}, + {file = "black-25.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:030b9759066a4ee5e5aca28c3c77f9c64789cdd4de8ac1df642c40b708be6171"}, + {file = "black-25.1.0-cp313-cp313-win_amd64.whl", hash = "sha256:a22f402b410566e2d1c950708c77ebf5ebd5d0d88a6a2e87c86d9fb48afa0d18"}, + {file = "black-25.1.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:a1ee0a0c330f7b5130ce0caed9936a904793576ef4d2b98c40835d6a65afa6a0"}, + {file = "black-25.1.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:f3df5f1bf91d36002b0a75389ca8663510cf0531cca8aa5c1ef695b46d98655f"}, + {file = "black-25.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d9e6827d563a2c820772b32ce8a42828dc6790f095f441beef18f96aa6f8294e"}, + {file = "black-25.1.0-cp39-cp39-win_amd64.whl", hash = "sha256:bacabb307dca5ebaf9c118d2d2f6903da0d62c9faa82bd21a33eecc319559355"}, + {file = "black-25.1.0-py3-none-any.whl", hash = "sha256:95e8176dae143ba9097f351d174fdaf0ccd29efb414b362ae3fd72bf0f710717"}, + {file = "black-25.1.0.tar.gz", hash = "sha256:33496d5cd1222ad73391352b4ae8da15253c5de89b93a80b3e2c8d9a19ec2666"}, ] [package.dependencies] @@ -291,7 +287,7 @@ platformdirs = ">=2" [package.extras] colorama = ["colorama (>=0.4.3)"] -d = ["aiohttp (>=3.7.4)", "aiohttp (>=3.7.4,!=3.9.0)"] +d = ["aiohttp (>=3.10)"] jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] uvloop = ["uvloop (>=0.15.2)"] @@ -1282,53 +1278,6 @@ files = [ cryptography = ">=3.4" typing-extensions = ">=4.5.0" -[[package]] -name = "lazy-object-proxy" -version = "1.10.0" -description = "A fast and thorough lazy object proxy." -optional = false -python-versions = ">=3.8" -groups = ["dev"] -files = [ - {file = "lazy-object-proxy-1.10.0.tar.gz", hash = "sha256:78247b6d45f43a52ef35c25b5581459e85117225408a4128a3daf8bf9648ac69"}, - {file = "lazy_object_proxy-1.10.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:855e068b0358ab916454464a884779c7ffa312b8925c6f7401e952dcf3b89977"}, - {file = "lazy_object_proxy-1.10.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7ab7004cf2e59f7c2e4345604a3e6ea0d92ac44e1c2375527d56492014e690c3"}, - {file = "lazy_object_proxy-1.10.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dc0d2fc424e54c70c4bc06787e4072c4f3b1aa2f897dfdc34ce1013cf3ceef05"}, - {file = "lazy_object_proxy-1.10.0-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:e2adb09778797da09d2b5ebdbceebf7dd32e2c96f79da9052b2e87b6ea495895"}, - {file = "lazy_object_proxy-1.10.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:b1f711e2c6dcd4edd372cf5dec5c5a30d23bba06ee012093267b3376c079ec83"}, - {file = "lazy_object_proxy-1.10.0-cp310-cp310-win32.whl", hash = "sha256:76a095cfe6045c7d0ca77db9934e8f7b71b14645f0094ffcd842349ada5c5fb9"}, - {file = "lazy_object_proxy-1.10.0-cp310-cp310-win_amd64.whl", hash = "sha256:b4f87d4ed9064b2628da63830986c3d2dca7501e6018347798313fcf028e2fd4"}, - {file = "lazy_object_proxy-1.10.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:fec03caabbc6b59ea4a638bee5fce7117be8e99a4103d9d5ad77f15d6f81020c"}, - {file = "lazy_object_proxy-1.10.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:02c83f957782cbbe8136bee26416686a6ae998c7b6191711a04da776dc9e47d4"}, - {file = "lazy_object_proxy-1.10.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:009e6bb1f1935a62889ddc8541514b6a9e1fcf302667dcb049a0be5c8f613e56"}, - {file = "lazy_object_proxy-1.10.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:75fc59fc450050b1b3c203c35020bc41bd2695ed692a392924c6ce180c6f1dc9"}, - {file = "lazy_object_proxy-1.10.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:782e2c9b2aab1708ffb07d4bf377d12901d7a1d99e5e410d648d892f8967ab1f"}, - {file = "lazy_object_proxy-1.10.0-cp311-cp311-win32.whl", hash = "sha256:edb45bb8278574710e68a6b021599a10ce730d156e5b254941754a9cc0b17d03"}, - {file = "lazy_object_proxy-1.10.0-cp311-cp311-win_amd64.whl", hash = "sha256:e271058822765ad5e3bca7f05f2ace0de58a3f4e62045a8c90a0dfd2f8ad8cc6"}, - {file = "lazy_object_proxy-1.10.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:e98c8af98d5707dcdecc9ab0863c0ea6e88545d42ca7c3feffb6b4d1e370c7ba"}, - {file = "lazy_object_proxy-1.10.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:952c81d415b9b80ea261d2372d2a4a2332a3890c2b83e0535f263ddfe43f0d43"}, - {file = "lazy_object_proxy-1.10.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:80b39d3a151309efc8cc48675918891b865bdf742a8616a337cb0090791a0de9"}, - {file = "lazy_object_proxy-1.10.0-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:e221060b701e2aa2ea991542900dd13907a5c90fa80e199dbf5a03359019e7a3"}, - {file = "lazy_object_proxy-1.10.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:92f09ff65ecff3108e56526f9e2481b8116c0b9e1425325e13245abfd79bdb1b"}, - {file = "lazy_object_proxy-1.10.0-cp312-cp312-win32.whl", hash = "sha256:3ad54b9ddbe20ae9f7c1b29e52f123120772b06dbb18ec6be9101369d63a4074"}, - {file = "lazy_object_proxy-1.10.0-cp312-cp312-win_amd64.whl", hash = "sha256:127a789c75151db6af398b8972178afe6bda7d6f68730c057fbbc2e96b08d282"}, - {file = "lazy_object_proxy-1.10.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:9e4ed0518a14dd26092614412936920ad081a424bdcb54cc13349a8e2c6d106a"}, - {file = "lazy_object_proxy-1.10.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5ad9e6ed739285919aa9661a5bbed0aaf410aa60231373c5579c6b4801bd883c"}, - {file = "lazy_object_proxy-1.10.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2fc0a92c02fa1ca1e84fc60fa258458e5bf89d90a1ddaeb8ed9cc3147f417255"}, - {file = "lazy_object_proxy-1.10.0-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:0aefc7591920bbd360d57ea03c995cebc204b424524a5bd78406f6e1b8b2a5d8"}, - {file = "lazy_object_proxy-1.10.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:5faf03a7d8942bb4476e3b62fd0f4cf94eaf4618e304a19865abf89a35c0bbee"}, - {file = "lazy_object_proxy-1.10.0-cp38-cp38-win32.whl", hash = "sha256:e333e2324307a7b5d86adfa835bb500ee70bfcd1447384a822e96495796b0ca4"}, - {file = "lazy_object_proxy-1.10.0-cp38-cp38-win_amd64.whl", hash = "sha256:cb73507defd385b7705c599a94474b1d5222a508e502553ef94114a143ec6696"}, - {file = "lazy_object_proxy-1.10.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:366c32fe5355ef5fc8a232c5436f4cc66e9d3e8967c01fb2e6302fd6627e3d94"}, - {file = "lazy_object_proxy-1.10.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2297f08f08a2bb0d32a4265e98a006643cd7233fb7983032bd61ac7a02956b3b"}, - {file = "lazy_object_proxy-1.10.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:18dd842b49456aaa9a7cf535b04ca4571a302ff72ed8740d06b5adcd41fe0757"}, - {file = "lazy_object_proxy-1.10.0-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:217138197c170a2a74ca0e05bddcd5f1796c735c37d0eee33e43259b192aa424"}, - {file = "lazy_object_proxy-1.10.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:9a3a87cf1e133e5b1994144c12ca4aa3d9698517fe1e2ca82977781b16955658"}, - {file = "lazy_object_proxy-1.10.0-cp39-cp39-win32.whl", hash = "sha256:30b339b2a743c5288405aa79a69e706a06e02958eab31859f7f3c04980853b70"}, - {file = "lazy_object_proxy-1.10.0-cp39-cp39-win_amd64.whl", hash = "sha256:a899b10e17743683b293a729d3a11f2f399e8a90c73b089e29f5d0fe3509f0dd"}, - {file = "lazy_object_proxy-1.10.0-pp310.pp311.pp312.pp38.pp39-none-any.whl", hash = "sha256:80fa48bd89c8f2f456fc0765c11c23bf5af827febacd2f523ca5bc1893fcc09d"}, -] - [[package]] name = "libadvian" version = "1.7.0" @@ -1547,50 +1496,44 @@ fastapi = ["fastapi (>0.89,<1.0)"] [[package]] name = "mypy" -version = "1.14.1" +version = "1.15.0" description = "Optional static typing for Python" optional = false -python-versions = ">=3.8" +python-versions = ">=3.9" groups = ["dev"] files = [ - {file = "mypy-1.14.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:52686e37cf13d559f668aa398dd7ddf1f92c5d613e4f8cb262be2fb4fedb0fcb"}, - {file = "mypy-1.14.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:1fb545ca340537d4b45d3eecdb3def05e913299ca72c290326be19b3804b39c0"}, - {file = "mypy-1.14.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:90716d8b2d1f4cd503309788e51366f07c56635a3309b0f6a32547eaaa36a64d"}, - {file = "mypy-1.14.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:2ae753f5c9fef278bcf12e1a564351764f2a6da579d4a81347e1d5a15819997b"}, - {file = "mypy-1.14.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:e0fe0f5feaafcb04505bcf439e991c6d8f1bf8b15f12b05feeed96e9e7bf1427"}, - {file = "mypy-1.14.1-cp310-cp310-win_amd64.whl", hash = "sha256:7d54bd85b925e501c555a3227f3ec0cfc54ee8b6930bd6141ec872d1c572f81f"}, - {file = "mypy-1.14.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:f995e511de847791c3b11ed90084a7a0aafdc074ab88c5a9711622fe4751138c"}, - {file = "mypy-1.14.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:d64169ec3b8461311f8ce2fd2eb5d33e2d0f2c7b49116259c51d0d96edee48d1"}, - {file = "mypy-1.14.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:ba24549de7b89b6381b91fbc068d798192b1b5201987070319889e93038967a8"}, - {file = "mypy-1.14.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:183cf0a45457d28ff9d758730cd0210419ac27d4d3f285beda038c9083363b1f"}, - {file = "mypy-1.14.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:f2a0ecc86378f45347f586e4163d1769dd81c5a223d577fe351f26b179e148b1"}, - {file = "mypy-1.14.1-cp311-cp311-win_amd64.whl", hash = "sha256:ad3301ebebec9e8ee7135d8e3109ca76c23752bac1e717bc84cd3836b4bf3eae"}, - {file = "mypy-1.14.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:30ff5ef8519bbc2e18b3b54521ec319513a26f1bba19a7582e7b1f58a6e69f14"}, - {file = "mypy-1.14.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:cb9f255c18052343c70234907e2e532bc7e55a62565d64536dbc7706a20b78b9"}, - {file = "mypy-1.14.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:8b4e3413e0bddea671012b063e27591b953d653209e7a4fa5e48759cda77ca11"}, - {file = "mypy-1.14.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:553c293b1fbdebb6c3c4030589dab9fafb6dfa768995a453d8a5d3b23784af2e"}, - {file = "mypy-1.14.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:fad79bfe3b65fe6a1efaed97b445c3d37f7be9fdc348bdb2d7cac75579607c89"}, - {file = "mypy-1.14.1-cp312-cp312-win_amd64.whl", hash = "sha256:8fa2220e54d2946e94ab6dbb3ba0a992795bd68b16dc852db33028df2b00191b"}, - {file = "mypy-1.14.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:92c3ed5afb06c3a8e188cb5da4984cab9ec9a77ba956ee419c68a388b4595255"}, - {file = "mypy-1.14.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:dbec574648b3e25f43d23577309b16534431db4ddc09fda50841f1e34e64ed34"}, - {file = "mypy-1.14.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:8c6d94b16d62eb3e947281aa7347d78236688e21081f11de976376cf010eb31a"}, - {file = "mypy-1.14.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d4b19b03fdf54f3c5b2fa474c56b4c13c9dbfb9a2db4370ede7ec11a2c5927d9"}, - {file = "mypy-1.14.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:0c911fde686394753fff899c409fd4e16e9b294c24bfd5e1ea4675deae1ac6fd"}, - {file = "mypy-1.14.1-cp313-cp313-win_amd64.whl", hash = "sha256:8b21525cb51671219f5307be85f7e646a153e5acc656e5cebf64bfa076c50107"}, - {file = "mypy-1.14.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:7084fb8f1128c76cd9cf68fe5971b37072598e7c31b2f9f95586b65c741a9d31"}, - {file = "mypy-1.14.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:8f845a00b4f420f693f870eaee5f3e2692fa84cc8514496114649cfa8fd5e2c6"}, - {file = "mypy-1.14.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:44bf464499f0e3a2d14d58b54674dee25c031703b2ffc35064bd0df2e0fac319"}, - {file = "mypy-1.14.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c99f27732c0b7dc847adb21c9d47ce57eb48fa33a17bc6d7d5c5e9f9e7ae5bac"}, - {file = "mypy-1.14.1-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:bce23c7377b43602baa0bd22ea3265c49b9ff0b76eb315d6c34721af4cdf1d9b"}, - {file = "mypy-1.14.1-cp38-cp38-win_amd64.whl", hash = "sha256:8edc07eeade7ebc771ff9cf6b211b9a7d93687ff892150cb5692e4f4272b0837"}, - {file = "mypy-1.14.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:3888a1816d69f7ab92092f785a462944b3ca16d7c470d564165fe703b0970c35"}, - {file = "mypy-1.14.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:46c756a444117c43ee984bd055db99e498bc613a70bbbc120272bd13ca579fbc"}, - {file = "mypy-1.14.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:27fc248022907e72abfd8e22ab1f10e903915ff69961174784a3900a8cba9ad9"}, - {file = "mypy-1.14.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:499d6a72fb7e5de92218db961f1a66d5f11783f9ae549d214617edab5d4dbdbb"}, - {file = "mypy-1.14.1-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:57961db9795eb566dc1d1b4e9139ebc4c6b0cb6e7254ecde69d1552bf7613f60"}, - {file = "mypy-1.14.1-cp39-cp39-win_amd64.whl", hash = "sha256:07ba89fdcc9451f2ebb02853deb6aaaa3d2239a236669a63ab3801bbf923ef5c"}, - {file = "mypy-1.14.1-py3-none-any.whl", hash = "sha256:b66a60cc4073aeb8ae00057f9c1f64d49e90f918fbcef9a977eb121da8b8f1d1"}, - {file = "mypy-1.14.1.tar.gz", hash = "sha256:7ec88144fe9b510e8475ec2f5f251992690fcf89ccb4500b214b4226abcd32d6"}, + {file = "mypy-1.15.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:979e4e1a006511dacf628e36fadfecbcc0160a8af6ca7dad2f5025529e082c13"}, + {file = "mypy-1.15.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c4bb0e1bd29f7d34efcccd71cf733580191e9a264a2202b0239da95984c5b559"}, + {file = "mypy-1.15.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:be68172e9fd9ad8fb876c6389f16d1c1b5f100ffa779f77b1fb2176fcc9ab95b"}, + {file = "mypy-1.15.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c7be1e46525adfa0d97681432ee9fcd61a3964c2446795714699a998d193f1a3"}, + {file = "mypy-1.15.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:2e2c2e6d3593f6451b18588848e66260ff62ccca522dd231cd4dd59b0160668b"}, + {file = "mypy-1.15.0-cp310-cp310-win_amd64.whl", hash = "sha256:6983aae8b2f653e098edb77f893f7b6aca69f6cffb19b2cc7443f23cce5f4828"}, + {file = "mypy-1.15.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:2922d42e16d6de288022e5ca321cd0618b238cfc5570e0263e5ba0a77dbef56f"}, + {file = "mypy-1.15.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:2ee2d57e01a7c35de00f4634ba1bbf015185b219e4dc5909e281016df43f5ee5"}, + {file = "mypy-1.15.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:973500e0774b85d9689715feeffcc980193086551110fd678ebe1f4342fb7c5e"}, + {file = "mypy-1.15.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:5a95fb17c13e29d2d5195869262f8125dfdb5c134dc8d9a9d0aecf7525b10c2c"}, + {file = "mypy-1.15.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:1905f494bfd7d85a23a88c5d97840888a7bd516545fc5aaedff0267e0bb54e2f"}, + {file = "mypy-1.15.0-cp311-cp311-win_amd64.whl", hash = "sha256:c9817fa23833ff189db061e6d2eff49b2f3b6ed9856b4a0a73046e41932d744f"}, + {file = "mypy-1.15.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:aea39e0583d05124836ea645f412e88a5c7d0fd77a6d694b60d9b6b2d9f184fd"}, + {file = "mypy-1.15.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:2f2147ab812b75e5b5499b01ade1f4a81489a147c01585cda36019102538615f"}, + {file = "mypy-1.15.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:ce436f4c6d218a070048ed6a44c0bbb10cd2cc5e272b29e7845f6a2f57ee4464"}, + {file = "mypy-1.15.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8023ff13985661b50a5928fc7a5ca15f3d1affb41e5f0a9952cb68ef090b31ee"}, + {file = "mypy-1.15.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:1124a18bc11a6a62887e3e137f37f53fbae476dc36c185d549d4f837a2a6a14e"}, + {file = "mypy-1.15.0-cp312-cp312-win_amd64.whl", hash = "sha256:171a9ca9a40cd1843abeca0e405bc1940cd9b305eaeea2dda769ba096932bb22"}, + {file = "mypy-1.15.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:93faf3fdb04768d44bf28693293f3904bbb555d076b781ad2530214ee53e3445"}, + {file = "mypy-1.15.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:811aeccadfb730024c5d3e326b2fbe9249bb7413553f15499a4050f7c30e801d"}, + {file = "mypy-1.15.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:98b7b9b9aedb65fe628c62a6dc57f6d5088ef2dfca37903a7d9ee374d03acca5"}, + {file = "mypy-1.15.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c43a7682e24b4f576d93072216bf56eeff70d9140241f9edec0c104d0c515036"}, + {file = "mypy-1.15.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:baefc32840a9f00babd83251560e0ae1573e2f9d1b067719479bfb0e987c6357"}, + {file = "mypy-1.15.0-cp313-cp313-win_amd64.whl", hash = "sha256:b9378e2c00146c44793c98b8d5a61039a048e31f429fb0eb546d93f4b000bedf"}, + {file = "mypy-1.15.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:e601a7fa172c2131bff456bb3ee08a88360760d0d2f8cbd7a75a65497e2df078"}, + {file = "mypy-1.15.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:712e962a6357634fef20412699a3655c610110e01cdaa6180acec7fc9f8513ba"}, + {file = "mypy-1.15.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f95579473af29ab73a10bada2f9722856792a36ec5af5399b653aa28360290a5"}, + {file = "mypy-1.15.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8f8722560a14cde92fdb1e31597760dc35f9f5524cce17836c0d22841830fd5b"}, + {file = "mypy-1.15.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:1fbb8da62dc352133d7d7ca90ed2fb0e9d42bb1a32724c287d3c76c58cbaa9c2"}, + {file = "mypy-1.15.0-cp39-cp39-win_amd64.whl", hash = "sha256:d10d994b41fb3497719bbf866f227b3489048ea4bbbb5015357db306249f7980"}, + {file = "mypy-1.15.0-py3-none-any.whl", hash = "sha256:5469affef548bd1895d86d3bf10ce2b44e33d86923c29e4d675b3e323437ea3e"}, + {file = "mypy-1.15.0.tar.gz", hash = "sha256:404534629d51d3efea5c800ee7c42b72a6554d6c400e6a79eafe15d11341fd43"}, ] [package.dependencies] @@ -2164,23 +2107,26 @@ tests = ["coverage[toml] (==5.0.4)", "pytest (>=6.0.0,<7.0.0)"] [[package]] name = "pylint" -version = "2.17.7" +version = "3.3.6" description = "python code static checker" optional = false -python-versions = ">=3.7.2" +python-versions = ">=3.9.0" groups = ["dev"] files = [ - {file = "pylint-2.17.7-py3-none-any.whl", hash = "sha256:27a8d4c7ddc8c2f8c18aa0050148f89ffc09838142193fdbe98f172781a3ff87"}, - {file = "pylint-2.17.7.tar.gz", hash = "sha256:f4fcac7ae74cfe36bc8451e931d8438e4a476c20314b1101c458ad0f05191fad"}, + {file = "pylint-3.3.6-py3-none-any.whl", hash = "sha256:8b7c2d3e86ae3f94fb27703d521dd0b9b6b378775991f504d7c3a6275aa0a6a6"}, + {file = "pylint-3.3.6.tar.gz", hash = "sha256:b634a041aac33706d56a0d217e6587228c66427e20ec21a019bc4cdee48c040a"}, ] [package.dependencies] -astroid = ">=2.15.8,<=2.17.0-dev0" +astroid = ">=3.3.8,<=3.4.0.dev0" colorama = {version = ">=0.4.5", markers = "sys_platform == \"win32\""} -dill = {version = ">=0.3.6", markers = "python_version >= \"3.11\""} -isort = ">=4.2.5,<6" +dill = [ + {version = ">=0.3.7", markers = "python_version >= \"3.12\""}, + {version = ">=0.3.6", markers = "python_version >= \"3.11\" and python_version < \"3.12\""}, +] +isort = ">=4.2.5,<5.13 || >5.13,<7" mccabe = ">=0.6,<0.8" -platformdirs = ">=2.2.0" +platformdirs = ">=2.2" tomlkit = ">=0.10.1" [package.extras] @@ -3055,95 +3001,6 @@ files = [ {file = "websockets-14.2.tar.gz", hash = "sha256:5059ed9c54945efb321f097084b4c7e52c246f2c869815876a69d1efc4ad6eb5"}, ] -[[package]] -name = "wrapt" -version = "1.17.2" -description = "Module for decorators, wrappers and monkey patching." -optional = false -python-versions = ">=3.8" -groups = ["dev"] -files = [ - {file = "wrapt-1.17.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:3d57c572081fed831ad2d26fd430d565b76aa277ed1d30ff4d40670b1c0dd984"}, - {file = "wrapt-1.17.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:b5e251054542ae57ac7f3fba5d10bfff615b6c2fb09abeb37d2f1463f841ae22"}, - {file = "wrapt-1.17.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:80dd7db6a7cb57ffbc279c4394246414ec99537ae81ffd702443335a61dbf3a7"}, - {file = "wrapt-1.17.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0a6e821770cf99cc586d33833b2ff32faebdbe886bd6322395606cf55153246c"}, - {file = "wrapt-1.17.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b60fb58b90c6d63779cb0c0c54eeb38941bae3ecf7a73c764c52c88c2dcb9d72"}, - {file = "wrapt-1.17.2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b870b5df5b71d8c3359d21be8f0d6c485fa0ebdb6477dda51a1ea54a9b558061"}, - {file = "wrapt-1.17.2-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:4011d137b9955791f9084749cba9a367c68d50ab8d11d64c50ba1688c9b457f2"}, - {file = "wrapt-1.17.2-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:1473400e5b2733e58b396a04eb7f35f541e1fb976d0c0724d0223dd607e0f74c"}, - {file = "wrapt-1.17.2-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:3cedbfa9c940fdad3e6e941db7138e26ce8aad38ab5fe9dcfadfed9db7a54e62"}, - {file = "wrapt-1.17.2-cp310-cp310-win32.whl", hash = "sha256:582530701bff1dec6779efa00c516496968edd851fba224fbd86e46cc6b73563"}, - {file = "wrapt-1.17.2-cp310-cp310-win_amd64.whl", hash = "sha256:58705da316756681ad3c9c73fd15499aa4d8c69f9fd38dc8a35e06c12468582f"}, - {file = "wrapt-1.17.2-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:ff04ef6eec3eee8a5efef2401495967a916feaa353643defcc03fc74fe213b58"}, - {file = "wrapt-1.17.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:4db983e7bca53819efdbd64590ee96c9213894272c776966ca6306b73e4affda"}, - {file = "wrapt-1.17.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:9abc77a4ce4c6f2a3168ff34b1da9b0f311a8f1cfd694ec96b0603dff1c79438"}, - {file = "wrapt-1.17.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0b929ac182f5ace000d459c59c2c9c33047e20e935f8e39371fa6e3b85d56f4a"}, - {file = "wrapt-1.17.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f09b286faeff3c750a879d336fb6d8713206fc97af3adc14def0cdd349df6000"}, - {file = "wrapt-1.17.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1a7ed2d9d039bd41e889f6fb9364554052ca21ce823580f6a07c4ec245c1f5d6"}, - {file = "wrapt-1.17.2-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:129a150f5c445165ff941fc02ee27df65940fcb8a22a61828b1853c98763a64b"}, - {file = "wrapt-1.17.2-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:1fb5699e4464afe5c7e65fa51d4f99e0b2eadcc176e4aa33600a3df7801d6662"}, - {file = "wrapt-1.17.2-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:9a2bce789a5ea90e51a02dfcc39e31b7f1e662bc3317979aa7e5538e3a034f72"}, - {file = "wrapt-1.17.2-cp311-cp311-win32.whl", hash = "sha256:4afd5814270fdf6380616b321fd31435a462019d834f83c8611a0ce7484c7317"}, - {file = "wrapt-1.17.2-cp311-cp311-win_amd64.whl", hash = "sha256:acc130bc0375999da18e3d19e5a86403667ac0c4042a094fefb7eec8ebac7cf3"}, - {file = "wrapt-1.17.2-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:d5e2439eecc762cd85e7bd37161d4714aa03a33c5ba884e26c81559817ca0925"}, - {file = "wrapt-1.17.2-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:3fc7cb4c1c744f8c05cd5f9438a3caa6ab94ce8344e952d7c45a8ed59dd88392"}, - {file = "wrapt-1.17.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:8fdbdb757d5390f7c675e558fd3186d590973244fab0c5fe63d373ade3e99d40"}, - {file = "wrapt-1.17.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5bb1d0dbf99411f3d871deb6faa9aabb9d4e744d67dcaaa05399af89d847a91d"}, - {file = "wrapt-1.17.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d18a4865f46b8579d44e4fe1e2bcbc6472ad83d98e22a26c963d46e4c125ef0b"}, - {file = "wrapt-1.17.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bc570b5f14a79734437cb7b0500376b6b791153314986074486e0b0fa8d71d98"}, - {file = "wrapt-1.17.2-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:6d9187b01bebc3875bac9b087948a2bccefe464a7d8f627cf6e48b1bbae30f82"}, - {file = "wrapt-1.17.2-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:9e8659775f1adf02eb1e6f109751268e493c73716ca5761f8acb695e52a756ae"}, - {file = "wrapt-1.17.2-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:e8b2816ebef96d83657b56306152a93909a83f23994f4b30ad4573b00bd11bb9"}, - {file = "wrapt-1.17.2-cp312-cp312-win32.whl", hash = "sha256:468090021f391fe0056ad3e807e3d9034e0fd01adcd3bdfba977b6fdf4213ea9"}, - {file = "wrapt-1.17.2-cp312-cp312-win_amd64.whl", hash = "sha256:ec89ed91f2fa8e3f52ae53cd3cf640d6feff92ba90d62236a81e4e563ac0e991"}, - {file = "wrapt-1.17.2-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:6ed6ffac43aecfe6d86ec5b74b06a5be33d5bb9243d055141e8cabb12aa08125"}, - {file = "wrapt-1.17.2-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:35621ae4c00e056adb0009f8e86e28eb4a41a4bfa8f9bfa9fca7d343fe94f998"}, - {file = "wrapt-1.17.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:a604bf7a053f8362d27eb9fefd2097f82600b856d5abe996d623babd067b1ab5"}, - {file = "wrapt-1.17.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5cbabee4f083b6b4cd282f5b817a867cf0b1028c54d445b7ec7cfe6505057cf8"}, - {file = "wrapt-1.17.2-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:49703ce2ddc220df165bd2962f8e03b84c89fee2d65e1c24a7defff6f988f4d6"}, - {file = "wrapt-1.17.2-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8112e52c5822fc4253f3901b676c55ddf288614dc7011634e2719718eaa187dc"}, - {file = "wrapt-1.17.2-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:9fee687dce376205d9a494e9c121e27183b2a3df18037f89d69bd7b35bcf59e2"}, - {file = "wrapt-1.17.2-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:18983c537e04d11cf027fbb60a1e8dfd5190e2b60cc27bc0808e653e7b218d1b"}, - {file = "wrapt-1.17.2-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:703919b1633412ab54bcf920ab388735832fdcb9f9a00ae49387f0fe67dad504"}, - {file = "wrapt-1.17.2-cp313-cp313-win32.whl", hash = "sha256:abbb9e76177c35d4e8568e58650aa6926040d6a9f6f03435b7a522bf1c487f9a"}, - {file = "wrapt-1.17.2-cp313-cp313-win_amd64.whl", hash = "sha256:69606d7bb691b50a4240ce6b22ebb319c1cfb164e5f6569835058196e0f3a845"}, - {file = "wrapt-1.17.2-cp313-cp313t-macosx_10_13_universal2.whl", hash = "sha256:4a721d3c943dae44f8e243b380cb645a709ba5bd35d3ad27bc2ed947e9c68192"}, - {file = "wrapt-1.17.2-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:766d8bbefcb9e00c3ac3b000d9acc51f1b399513f44d77dfe0eb026ad7c9a19b"}, - {file = "wrapt-1.17.2-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:e496a8ce2c256da1eb98bd15803a79bee00fc351f5dfb9ea82594a3f058309e0"}, - {file = "wrapt-1.17.2-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:40d615e4fe22f4ad3528448c193b218e077656ca9ccb22ce2cb20db730f8d306"}, - {file = "wrapt-1.17.2-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a5aaeff38654462bc4b09023918b7f21790efb807f54c000a39d41d69cf552cb"}, - {file = "wrapt-1.17.2-cp313-cp313t-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9a7d15bbd2bc99e92e39f49a04653062ee6085c0e18b3b7512a4f2fe91f2d681"}, - {file = "wrapt-1.17.2-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:e3890b508a23299083e065f435a492b5435eba6e304a7114d2f919d400888cc6"}, - {file = "wrapt-1.17.2-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:8c8b293cd65ad716d13d8dd3624e42e5a19cc2a2f1acc74b30c2c13f15cb61a6"}, - {file = "wrapt-1.17.2-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:4c82b8785d98cdd9fed4cac84d765d234ed3251bd6afe34cb7ac523cb93e8b4f"}, - {file = "wrapt-1.17.2-cp313-cp313t-win32.whl", hash = "sha256:13e6afb7fe71fe7485a4550a8844cc9ffbe263c0f1a1eea569bc7091d4898555"}, - {file = "wrapt-1.17.2-cp313-cp313t-win_amd64.whl", hash = "sha256:eaf675418ed6b3b31c7a989fd007fa7c3be66ce14e5c3b27336383604c9da85c"}, - {file = "wrapt-1.17.2-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:5c803c401ea1c1c18de70a06a6f79fcc9c5acfc79133e9869e730ad7f8ad8ef9"}, - {file = "wrapt-1.17.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:f917c1180fdb8623c2b75a99192f4025e412597c50b2ac870f156de8fb101119"}, - {file = "wrapt-1.17.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:ecc840861360ba9d176d413a5489b9a0aff6d6303d7e733e2c4623cfa26904a6"}, - {file = "wrapt-1.17.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bb87745b2e6dc56361bfde481d5a378dc314b252a98d7dd19a651a3fa58f24a9"}, - {file = "wrapt-1.17.2-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:58455b79ec2661c3600e65c0a716955adc2410f7383755d537584b0de41b1d8a"}, - {file = "wrapt-1.17.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b4e42a40a5e164cbfdb7b386c966a588b1047558a990981ace551ed7e12ca9c2"}, - {file = "wrapt-1.17.2-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:91bd7d1773e64019f9288b7a5101f3ae50d3d8e6b1de7edee9c2ccc1d32f0c0a"}, - {file = "wrapt-1.17.2-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:bb90fb8bda722a1b9d48ac1e6c38f923ea757b3baf8ebd0c82e09c5c1a0e7a04"}, - {file = "wrapt-1.17.2-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:08e7ce672e35efa54c5024936e559469436f8b8096253404faeb54d2a878416f"}, - {file = "wrapt-1.17.2-cp38-cp38-win32.whl", hash = "sha256:410a92fefd2e0e10d26210e1dfb4a876ddaf8439ef60d6434f21ef8d87efc5b7"}, - {file = "wrapt-1.17.2-cp38-cp38-win_amd64.whl", hash = "sha256:95c658736ec15602da0ed73f312d410117723914a5c91a14ee4cdd72f1d790b3"}, - {file = "wrapt-1.17.2-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:99039fa9e6306880572915728d7f6c24a86ec57b0a83f6b2491e1d8ab0235b9a"}, - {file = "wrapt-1.17.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:2696993ee1eebd20b8e4ee4356483c4cb696066ddc24bd70bcbb80fa56ff9061"}, - {file = "wrapt-1.17.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:612dff5db80beef9e649c6d803a8d50c409082f1fedc9dbcdfde2983b2025b82"}, - {file = "wrapt-1.17.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:62c2caa1585c82b3f7a7ab56afef7b3602021d6da34fbc1cf234ff139fed3cd9"}, - {file = "wrapt-1.17.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c958bcfd59bacc2d0249dcfe575e71da54f9dcf4a8bdf89c4cb9a68a1170d73f"}, - {file = "wrapt-1.17.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fc78a84e2dfbc27afe4b2bd7c80c8db9bca75cc5b85df52bfe634596a1da846b"}, - {file = "wrapt-1.17.2-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:ba0f0eb61ef00ea10e00eb53a9129501f52385c44853dbd6c4ad3f403603083f"}, - {file = "wrapt-1.17.2-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:1e1fe0e6ab7775fd842bc39e86f6dcfc4507ab0ffe206093e76d61cde37225c8"}, - {file = "wrapt-1.17.2-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:c86563182421896d73858e08e1db93afdd2b947a70064b813d515d66549e15f9"}, - {file = "wrapt-1.17.2-cp39-cp39-win32.whl", hash = "sha256:f393cda562f79828f38a819f4788641ac7c4085f30f1ce1a68672baa686482bb"}, - {file = "wrapt-1.17.2-cp39-cp39-win_amd64.whl", hash = "sha256:36ccae62f64235cf8ddb682073a60519426fdd4725524ae38874adf72b5f2aeb"}, - {file = "wrapt-1.17.2-py3-none-any.whl", hash = "sha256:b18f2d1533a71f069c7f82d524a52599053d4c7166e9dd374ae2136b7f40f7c8"}, - {file = "wrapt-1.17.2.tar.gz", hash = "sha256:41388e9d4d1522446fe79d3213196bd9e3b301a336965b9e27ca2788ebd122f3"}, -] - [[package]] name = "yarl" version = "1.18.3" @@ -3244,4 +3101,4 @@ propcache = ">=0.2.0" [metadata] lock-version = "2.1" python-versions = ">=3.11,<4.0" -content-hash = "a00739934a61fcebd1e9a1d3a448c6410f5a95963eec8710edb7d328817228a7" +content-hash = "11d9b14e38a7bfb74468e252cd0a1ca42030738eeae593985bc42ed77c790beb" diff --git a/pyproject.toml b/pyproject.toml index ab5c0bfe..77ec1adf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -99,10 +99,10 @@ psycopg2 = "^2.9" pytest = "^7.4" coverage = "^7.3" pytest-cov = "^4.1" -pylint = "^2.17" -black = "^23.7" -bandit = "^1.7" -mypy = "^1.5" +pylint = "^3.3" +black = "^25.1" +bandit = "^1.8" +mypy = "^1.15" pre-commit = "^3.3" pytest-asyncio = ">=0.23,<1.0" # caret behaviour on 0.x is to lock to 0.x.* bump2version = "^1.0" diff --git a/src/rasenmaeher_api/__init__.py b/src/rasenmaeher_api/__init__.py index 25fb314b..306b038f 100644 --- a/src/rasenmaeher_api/__init__.py +++ b/src/rasenmaeher_api/__init__.py @@ -1,2 +1,3 @@ -""" python-rasenmaeher-api """ +"""python-rasenmaeher-api""" + __version__ = "1.6.4" # NOTE Use `bump2version --config-file patch` to bump versions correctly diff --git a/src/rasenmaeher_api/cfssl/anoncsr.py b/src/rasenmaeher_api/cfssl/anoncsr.py index 7ba3e275..32694413 100644 --- a/src/rasenmaeher_api/cfssl/anoncsr.py +++ b/src/rasenmaeher_api/cfssl/anoncsr.py @@ -1,4 +1,5 @@ """This needs to be separated to avoid circular imports""" + import logging import aiohttp @@ -18,7 +19,7 @@ async def anon_sign_csr(csr: str, bundle: bool = True) -> str: params: csr returns: certificate """ - async with (await anon_session()) as session: + async with await anon_session() as session: url = f"{ocsprest_base()}/api/v1/csr/sign" payload = {"certificate_request": csr, "profile": "client", "bundle": bundle} try: diff --git a/src/rasenmaeher_api/cfssl/base.py b/src/rasenmaeher_api/cfssl/base.py index 8e5c9bf6..2638f2af 100644 --- a/src/rasenmaeher_api/cfssl/base.py +++ b/src/rasenmaeher_api/cfssl/base.py @@ -1,4 +1,5 @@ """Base helpers etc""" + from typing import Any, Mapping, Union, List, cast import logging import ssl diff --git a/src/rasenmaeher_api/cfssl/mtls.py b/src/rasenmaeher_api/cfssl/mtls.py index 4183cfbb..6460dd82 100644 --- a/src/rasenmaeher_api/cfssl/mtls.py +++ b/src/rasenmaeher_api/cfssl/mtls.py @@ -1,4 +1,5 @@ """mTLS stuff, needs to be away from base to avoid cyclic imports""" + import logging import aiohttp diff --git a/src/rasenmaeher_api/cfssl/private.py b/src/rasenmaeher_api/cfssl/private.py index d480f783..e886f794 100644 --- a/src/rasenmaeher_api/cfssl/private.py +++ b/src/rasenmaeher_api/cfssl/private.py @@ -1,4 +1,5 @@ """Private apis""" + from typing import Union, Optional, Any, Dict import asyncio import logging @@ -26,7 +27,7 @@ async def post_ocsprest( """Do a POST with the mTLS client""" if timeout is None: timeout = RMSettings.singleton().cfssl_timeout - async with (await mtls_session()) as session: + async with await mtls_session() as session: try: LOGGER.debug("POSTing to {}, payload={}".format(url, send_payload)) async with session.post(url, data=send_payload, timeout=aiohttp.ClientTimeout(total=timeout)) as response: @@ -54,7 +55,7 @@ async def sign_csr(csr: str, bundle: bool = True) -> str: params: csr, whether to return cert of full bundle returns: certificate as PEM """ - async with (await mtls_session()) as session: + async with await mtls_session() as session: url = f"{ocsprest_base()}/api/v1/csr/sign" payload = {"certificate_request": csr, "profile": "client", "bundle": bundle} try: @@ -76,7 +77,7 @@ async def sign_ocsp(cert: str, status: str = "good") -> Any: Call ocspsign endpoint """ - async with (await mtls_session()) as session: + async with await mtls_session() as session: url = f"{base_url()}/api/v1/cfssl/ocspsign" payload = {"certificate": cert, "status": status} try: @@ -129,7 +130,7 @@ async def revoke_serial(serialno: str, authority_key_id: str, reason: ReasonType Reason must be one of the enumerations of cryptography.x509.ReasonFlags or it's string values (see REASONS_BY_VALUE) """ reason = validate_reason(reason) - async with (await mtls_session()) as session: + async with await mtls_session() as session: url = f"{base_url()}/api/v1/cfssl/revoke" payload = { "serial": serialno, @@ -168,7 +169,7 @@ async def certadd_pem(pem: Union[str, Path], status: str = "good") -> Any: if not kid: raise ValueError("Cannot resolve authority_key_id from the cert") - async with (await mtls_session()) as session: + async with await mtls_session() as session: url = f"{base_url()}/api/v1/cfssl/certadd" payload = { "pem": pem, diff --git a/src/rasenmaeher_api/cfssl/public.py b/src/rasenmaeher_api/cfssl/public.py index 5edd6e20..62259d6b 100644 --- a/src/rasenmaeher_api/cfssl/public.py +++ b/src/rasenmaeher_api/cfssl/public.py @@ -1,4 +1,5 @@ """Public things, CA cert, CRL etc""" + from typing import Dict, Any import logging import base64 @@ -28,7 +29,7 @@ async def get_ca() -> str: returns: CA certificate """ - async with (await anon_session()) as session: + async with await anon_session() as session: url = f"{base_url()}/api/v1/cfssl/info" payload: Dict[str, Any] = {} # PONDER: Why does this need to be a POST ?? @@ -42,7 +43,7 @@ async def get_ca() -> str: async def get_ocsprest_crl(suffix: str) -> bytes: """Fetch CRL from OCSPREST""" - async with (await anon_session()) as session: + async with await anon_session() as session: url = f"{ocsprest_base()}/api/v1/crl/{suffix}" try: async with session.get(url) as response: @@ -59,7 +60,7 @@ async def get_crl() -> bytes: returns: DER binary encoded Certificate Revocation List """ - async with (await anon_session()) as session: + async with await anon_session() as session: url = f"{base_url()}/api/v1/cfssl/crl" try: async with session.get(url, params={"expiry": CRL_LIFETIME}, timeout=default_timeout()) as response: @@ -78,7 +79,7 @@ async def get_bundle(cert: str) -> str: # FIXME: This is not a good way but I don't have a better one right now either # Force OCSP refresh before getting the bundle so we hopefully get all we need await refresh_ocsp() - async with (await anon_session()) as session: + async with await anon_session() as session: url = f"{base_url()}/api/v1/cfssl/bundle" payload: Dict[str, Any] = {"certificate": cert, "flavor": "optimal"} try: diff --git a/src/rasenmaeher_api/console.py b/src/rasenmaeher_api/console.py index d3a6de16..75038d58 100644 --- a/src/rasenmaeher_api/console.py +++ b/src/rasenmaeher_api/console.py @@ -1,4 +1,5 @@ """CLI entrypoints for python-rasenmaeher-api""" + from typing import Dict, Any import logging import json diff --git a/src/rasenmaeher_api/db/__init__.py b/src/rasenmaeher_api/db/__init__.py index 61389c7f..107629f9 100644 --- a/src/rasenmaeher_api/db/__init__.py +++ b/src/rasenmaeher_api/db/__init__.py @@ -1,4 +1,5 @@ """Gino based database abstraction""" + from .config import DBConfig from .people import Person, Role from .enrollments import Enrollment, EnrollmentPool, EnrollmentState diff --git a/src/rasenmaeher_api/db/base.py b/src/rasenmaeher_api/db/base.py index ca2ec89a..a9d3b94a 100644 --- a/src/rasenmaeher_api/db/base.py +++ b/src/rasenmaeher_api/db/base.py @@ -1,4 +1,5 @@ """The Gino baseclass with db connection wrapping""" + from typing import Self, Union import uuid import logging diff --git a/src/rasenmaeher_api/db/config.py b/src/rasenmaeher_api/db/config.py index 61888e0a..af61ad2b 100644 --- a/src/rasenmaeher_api/db/config.py +++ b/src/rasenmaeher_api/db/config.py @@ -1,4 +1,5 @@ """Read database configuration from ENV or .env -file""" + from typing import Optional, cast, Callable, ClassVar, Any import logging import functools diff --git a/src/rasenmaeher_api/db/dbinit.py b/src/rasenmaeher_api/db/dbinit.py index 1bb8937a..35f8d4cf 100644 --- a/src/rasenmaeher_api/db/dbinit.py +++ b/src/rasenmaeher_api/db/dbinit.py @@ -1,4 +1,5 @@ """Ensure all models are defined and then create tables""" + import logging from pathlib import Path import tempfile diff --git a/src/rasenmaeher_api/db/engine.py b/src/rasenmaeher_api/db/engine.py index 6f882b33..0829a26f 100644 --- a/src/rasenmaeher_api/db/engine.py +++ b/src/rasenmaeher_api/db/engine.py @@ -1,4 +1,5 @@ """Engine stuff""" + from typing import ClassVar, Optional, Any import logging from dataclasses import dataclass, field diff --git a/src/rasenmaeher_api/db/enrollments.py b/src/rasenmaeher_api/db/enrollments.py index f45521ab..0f354565 100644 --- a/src/rasenmaeher_api/db/enrollments.py +++ b/src/rasenmaeher_api/db/enrollments.py @@ -1,4 +1,5 @@ """Abstractions for enrollments""" + from typing import Dict, Any, Optional, AsyncGenerator, Union import string import secrets diff --git a/src/rasenmaeher_api/db/errors.py b/src/rasenmaeher_api/db/errors.py index 7e02ccfe..a5ed65a3 100644 --- a/src/rasenmaeher_api/db/errors.py +++ b/src/rasenmaeher_api/db/errors.py @@ -1,4 +1,5 @@ """Errors""" + from typing import Sequence, Any from starlette import status diff --git a/src/rasenmaeher_api/db/logincodes.py b/src/rasenmaeher_api/db/logincodes.py index 6558c7d1..9810935d 100644 --- a/src/rasenmaeher_api/db/logincodes.py +++ b/src/rasenmaeher_api/db/logincodes.py @@ -1,4 +1,5 @@ """DB abstraction for storing nonces etc things needed to prevent re-use of certain tokens""" + from typing import Dict, Any, Optional import logging import string diff --git a/src/rasenmaeher_api/db/middleware.py b/src/rasenmaeher_api/db/middleware.py index a7a157b3..7d7b2fb5 100644 --- a/src/rasenmaeher_api/db/middleware.py +++ b/src/rasenmaeher_api/db/middleware.py @@ -1,4 +1,5 @@ """Middleware stuff""" + from dataclasses import dataclass, field import logging import asyncio diff --git a/src/rasenmaeher_api/db/nonces.py b/src/rasenmaeher_api/db/nonces.py index e75dd09b..71e8cf75 100644 --- a/src/rasenmaeher_api/db/nonces.py +++ b/src/rasenmaeher_api/db/nonces.py @@ -1,4 +1,5 @@ """DB abstraction for storing nonces etc things needed to prevent re-use of certain tokens""" + from typing import Dict, Any, Optional import logging diff --git a/src/rasenmaeher_api/db/people.py b/src/rasenmaeher_api/db/people.py index a70864a7..ef7590ed 100644 --- a/src/rasenmaeher_api/db/people.py +++ b/src/rasenmaeher_api/db/people.py @@ -1,4 +1,5 @@ """Abstractions for people""" + from typing import Self, Optional, AsyncGenerator, Dict, Any, Set, Union import asyncio import uuid diff --git a/src/rasenmaeher_api/jwtinit.py b/src/rasenmaeher_api/jwtinit.py index 6001b467..20c3e482 100644 --- a/src/rasenmaeher_api/jwtinit.py +++ b/src/rasenmaeher_api/jwtinit.py @@ -1,4 +1,5 @@ """Init JWT issuer""" + from typing import Optional, Union import logging import os diff --git a/src/rasenmaeher_api/kchelpers.py b/src/rasenmaeher_api/kchelpers.py index 496d2f65..e9aba2bd 100644 --- a/src/rasenmaeher_api/kchelpers.py +++ b/src/rasenmaeher_api/kchelpers.py @@ -1,8 +1,10 @@ """Keycloak helpers""" -from typing import Optional, Any, ClassVar, Dict, Set, Union + +from typing import Optional, Any, ClassVar, Dict, Set, Union, cast from dataclasses import dataclass, field import logging import uuid +import json from libpvarki.schemas.product import UserCRUDRequest from pydantic import BaseModel, Extra, Field @@ -233,6 +235,10 @@ async def delete_kc_user(self, user: KCUserData) -> bool: await self.kcadmin.a_delete_user(user.kc_id) return True + async def client_access_token(self) -> Dict[str, Union[str, int]]: + """Create initial access token for a client to register for OIDC""" + return cast(Dict[str, Union[str, int]], json.loads(await self.kcadmin.a_create_initial_access_token())) + async def ensure_product_groups(self) -> Optional[bool]: """Make sure each product in manifest has a root level group and initial child-group""" conf = RMSettings.singleton() diff --git a/src/rasenmaeher_api/mtlsinit.py b/src/rasenmaeher_api/mtlsinit.py index dde01b70..b02a2138 100644 --- a/src/rasenmaeher_api/mtlsinit.py +++ b/src/rasenmaeher_api/mtlsinit.py @@ -1,4 +1,5 @@ """Init mTLS client cert for RASENMAEHER itself""" + import asyncio from pathlib import Path import logging diff --git a/src/rasenmaeher_api/productapihelpers.py b/src/rasenmaeher_api/productapihelpers.py index a4739d85..143317ae 100644 --- a/src/rasenmaeher_api/productapihelpers.py +++ b/src/rasenmaeher_api/productapihelpers.py @@ -1,4 +1,5 @@ """Product integration API helpers""" + from typing import Dict, Optional, Type, Any, Mapping, Tuple import asyncio import logging diff --git a/src/rasenmaeher_api/rmsettings.py b/src/rasenmaeher_api/rmsettings.py index 365f6439..c0239338 100644 --- a/src/rasenmaeher_api/rmsettings.py +++ b/src/rasenmaeher_api/rmsettings.py @@ -1,4 +1,5 @@ -""" Application settings. """ +"""Application settings.""" + from typing import Optional, Any, Dict, ClassVar, List import enum from pathlib import Path @@ -136,6 +137,17 @@ def load_manifest(self) -> None: self.kraftwerk_manifest_dict = json.loads(pth.read_text(encoding="utf-8")) self.kraftwerk_manifest_bool = True + @property + def deployment_name(self) -> str: + """Resolve the deployment name""" + if not self.kraftwerk_manifest_bool: + self.load_manifest() + if "dns" in self.kraftwerk_manifest_dict: + my_dn = str(self.kraftwerk_manifest_dict["dns"]) + return my_dn.split(".", maxsplit=1)[0] + LOGGER.warning("DNS name not defined") + return "undefined" + @property def valid_product_cns(self) -> List[str]: """Get valid CNs for productapi certs""" diff --git a/src/rasenmaeher_api/testhelpers.py b/src/rasenmaeher_api/testhelpers.py index c01e94f3..f16e4572 100644 --- a/src/rasenmaeher_api/testhelpers.py +++ b/src/rasenmaeher_api/testhelpers.py @@ -1,4 +1,5 @@ """Helpers for testing, unit and manual""" + from typing import Tuple, List import logging diff --git a/src/rasenmaeher_api/user_integrations.py b/src/rasenmaeher_api/user_integrations.py index 432f5040..8af360ce 100644 --- a/src/rasenmaeher_api/user_integrations.py +++ b/src/rasenmaeher_api/user_integrations.py @@ -1,4 +1,5 @@ """Functions that routes that deal with users MUST call after changes""" + import uuid import logging diff --git a/src/rasenmaeher_api/web/api/checkauth/__init__.py b/src/rasenmaeher_api/web/api/checkauth/__init__.py index a392b589..7fd5f327 100644 --- a/src/rasenmaeher_api/web/api/checkauth/__init__.py +++ b/src/rasenmaeher_api/web/api/checkauth/__init__.py @@ -1,4 +1,5 @@ """Takreg API.""" + from rasenmaeher_api.web.api.checkauth.views import router __all__ = ["router"] diff --git a/src/rasenmaeher_api/web/api/checkauth/views.py b/src/rasenmaeher_api/web/api/checkauth/views.py index 06618905..e71b27a2 100644 --- a/src/rasenmaeher_api/web/api/checkauth/views.py +++ b/src/rasenmaeher_api/web/api/checkauth/views.py @@ -1,4 +1,5 @@ """Info API views.""" + from typing import cast diff --git a/src/rasenmaeher_api/web/api/descriptions.py b/src/rasenmaeher_api/web/api/descriptions.py index 2847035d..d9a2cf6a 100644 --- a/src/rasenmaeher_api/web/api/descriptions.py +++ b/src/rasenmaeher_api/web/api/descriptions.py @@ -1,4 +1,5 @@ """product descriptions endpoints""" + from typing import Optional, cast import logging diff --git a/src/rasenmaeher_api/web/api/enduserpfx/__init__.py b/src/rasenmaeher_api/web/api/enduserpfx/__init__.py index 7aeab1d7..cc92fbfd 100644 --- a/src/rasenmaeher_api/web/api/enduserpfx/__init__.py +++ b/src/rasenmaeher_api/web/api/enduserpfx/__init__.py @@ -1,4 +1,5 @@ """Enduserpfx API.""" + from rasenmaeher_api.web.api.enduserpfx.views import router __all__ = ["router"] diff --git a/src/rasenmaeher_api/web/api/enduserpfx/views.py b/src/rasenmaeher_api/web/api/enduserpfx/views.py index 71fa0e4c..06052a43 100644 --- a/src/rasenmaeher_api/web/api/enduserpfx/views.py +++ b/src/rasenmaeher_api/web/api/enduserpfx/views.py @@ -1,4 +1,5 @@ """Enduser API views.""" + import logging from fastapi import APIRouter, HTTPException, Depends @@ -6,11 +7,13 @@ from ....db import Person from ..middleware.user import ValidUser +from ....rmsettings import RMSettings router = APIRouter() LOGGER = logging.getLogger(__name__) +@router.get(f"/{{callsign}}_{RMSettings.singleton().deployment_name}.pfx") @router.get("/{callsign}.pfx") @router.get("/{callsign}") async def get_user_pfx( @@ -22,6 +25,9 @@ async def get_user_pfx( :param callsign: OTTER1.pfx :returns pfx or 403 error """ + deplosuffix = f"_{RMSettings.singleton().deployment_name}.pfx" + if callsign.endswith(deplosuffix): + callsign = callsign[: -len(deplosuffix)] if callsign.endswith(".pfx"): callsign = callsign[:-4] LOGGER.debug("Called with callsign={}".format(callsign)) @@ -30,4 +36,8 @@ async def get_user_pfx( # Make sure the pfx exists, this is no-op if it does await person.create_pfx() - return FileResponse(path=person.pfxfile, media_type="application/x-pkcs12", filename=f"{callsign}.pfx") + return FileResponse( + path=person.pfxfile, + media_type="application/x-pkcs12", + filename=f"{callsign}_{RMSettings.singleton().deployment_name}.pfx", + ) diff --git a/src/rasenmaeher_api/web/api/enrollment/__init__.py b/src/rasenmaeher_api/web/api/enrollment/__init__.py index f2690db6..2314f9c7 100644 --- a/src/rasenmaeher_api/web/api/enrollment/__init__.py +++ b/src/rasenmaeher_api/web/api/enrollment/__init__.py @@ -1,4 +1,5 @@ """Enrollment API.""" + from rasenmaeher_api.web.api.enrollment.views import ENROLLMENT_ROUTER, NO_JWT_ENROLLMENT_ROUTER __all__ = ["ENROLLMENT_ROUTER", "NO_JWT_ENROLLMENT_ROUTER"] diff --git a/src/rasenmaeher_api/web/api/enrollment/schema.py b/src/rasenmaeher_api/web/api/enrollment/schema.py index b07d04ca..2bc9adaf 100644 --- a/src/rasenmaeher_api/web/api/enrollment/schema.py +++ b/src/rasenmaeher_api/web/api/enrollment/schema.py @@ -1,4 +1,5 @@ """Schema for enrollment.""" + from typing import List, Dict, Any from pydantic import BaseModel, Extra, Field diff --git a/src/rasenmaeher_api/web/api/enrollment/views.py b/src/rasenmaeher_api/web/api/enrollment/views.py index bb36d935..c719a9e7 100644 --- a/src/rasenmaeher_api/web/api/enrollment/views.py +++ b/src/rasenmaeher_api/web/api/enrollment/views.py @@ -1,4 +1,5 @@ """Enrollment API views.""" # pylint: disable=too-many-lines + from typing import Dict, List, Any, Optional import logging import uuid diff --git a/src/rasenmaeher_api/web/api/firstuser/__init__.py b/src/rasenmaeher_api/web/api/firstuser/__init__.py index ecdb2509..0377e355 100644 --- a/src/rasenmaeher_api/web/api/firstuser/__init__.py +++ b/src/rasenmaeher_api/web/api/firstuser/__init__.py @@ -1,4 +1,5 @@ """Firstuser API.""" + from rasenmaeher_api.web.api.firstuser.views import router __all__ = ["router"] diff --git a/src/rasenmaeher_api/web/api/firstuser/schema.py b/src/rasenmaeher_api/web/api/firstuser/schema.py index 7968c134..718f0c5d 100644 --- a/src/rasenmaeher_api/web/api/firstuser/schema.py +++ b/src/rasenmaeher_api/web/api/firstuser/schema.py @@ -1,4 +1,5 @@ """Schema for enrollment.""" + from pydantic import BaseModel, Extra diff --git a/src/rasenmaeher_api/web/api/firstuser/views.py b/src/rasenmaeher_api/web/api/firstuser/views.py index 54eea638..d4fd3be1 100644 --- a/src/rasenmaeher_api/web/api/firstuser/views.py +++ b/src/rasenmaeher_api/web/api/firstuser/views.py @@ -1,4 +1,5 @@ """Firstuser API views.""" + import asyncio import logging from fastapi import APIRouter, Request, Body, Depends, HTTPException diff --git a/src/rasenmaeher_api/web/api/healthcheck/__init__.py b/src/rasenmaeher_api/web/api/healthcheck/__init__.py index 0795bfd4..5e000175 100644 --- a/src/rasenmaeher_api/web/api/healthcheck/__init__.py +++ b/src/rasenmaeher_api/web/api/healthcheck/__init__.py @@ -1,4 +1,5 @@ """healthcheck API.""" + from rasenmaeher_api.web.api.healthcheck.views import router __all__ = ["router"] diff --git a/src/rasenmaeher_api/web/api/healthcheck/schema.py b/src/rasenmaeher_api/web/api/healthcheck/schema.py index ab822791..fb747f7a 100644 --- a/src/rasenmaeher_api/web/api/healthcheck/schema.py +++ b/src/rasenmaeher_api/web/api/healthcheck/schema.py @@ -1,4 +1,5 @@ """Healthcheck response schemas""" + from typing import Dict from pydantic import BaseModel, Field, Extra diff --git a/src/rasenmaeher_api/web/api/healthcheck/views.py b/src/rasenmaeher_api/web/api/healthcheck/views.py index 0e36b677..69ae43ca 100644 --- a/src/rasenmaeher_api/web/api/healthcheck/views.py +++ b/src/rasenmaeher_api/web/api/healthcheck/views.py @@ -1,4 +1,5 @@ """Healthcheck API views.""" + from typing import cast import logging import os diff --git a/src/rasenmaeher_api/web/api/instructions/__init__.py b/src/rasenmaeher_api/web/api/instructions/__init__.py index e94c1cd3..1ad236da 100644 --- a/src/rasenmaeher_api/web/api/instructions/__init__.py +++ b/src/rasenmaeher_api/web/api/instructions/__init__.py @@ -1,4 +1,5 @@ """Instruction routes""" + from .views import router __all__ = ["router"] diff --git a/src/rasenmaeher_api/web/api/instructions/schema.py b/src/rasenmaeher_api/web/api/instructions/schema.py index 31ed3a86..78d378c1 100644 --- a/src/rasenmaeher_api/web/api/instructions/schema.py +++ b/src/rasenmaeher_api/web/api/instructions/schema.py @@ -1,4 +1,5 @@ """Instruction response schemas""" + from typing import Dict, Optional, Any from pydantic import BaseModel, Extra, Field diff --git a/src/rasenmaeher_api/web/api/instructions/views.py b/src/rasenmaeher_api/web/api/instructions/views.py index d941f942..7a2905bf 100644 --- a/src/rasenmaeher_api/web/api/instructions/views.py +++ b/src/rasenmaeher_api/web/api/instructions/views.py @@ -1,4 +1,5 @@ """Instruction routes""" + from typing import cast, Optional import logging @@ -67,8 +68,10 @@ async def get_product_instructions(request: Request, product: str, language: str user = UserCRUDRequest( uuid=str(person.pk), callsign=person.callsign, x509cert=person.certfile.read_text(encoding="utf-8") ) - response = await post_to_product(product, f"api/v1/instructions/{language}", user.dict(), InstructionData) + endpoint_url = f"api/v1/instructions/{language}" + response = await post_to_product(product, endpoint_url, user.dict(), InstructionData) if response is None: + LOGGER.error("post_to_product({}, {}): failed".format(product, endpoint_url)) # TODO: Raise a reasonable error instead return None response = cast(InstructionData, response) diff --git a/src/rasenmaeher_api/web/api/middleware/datatypes.py b/src/rasenmaeher_api/web/api/middleware/datatypes.py index fe0466eb..443f1ccc 100644 --- a/src/rasenmaeher_api/web/api/middleware/datatypes.py +++ b/src/rasenmaeher_api/web/api/middleware/datatypes.py @@ -1,4 +1,5 @@ """Data types needed by this module""" + from typing import Union, Optional from dataclasses import dataclass, field import enum diff --git a/src/rasenmaeher_api/web/api/middleware/mtls.py b/src/rasenmaeher_api/web/api/middleware/mtls.py index 3dfc1a49..d5f404e4 100644 --- a/src/rasenmaeher_api/web/api/middleware/mtls.py +++ b/src/rasenmaeher_api/web/api/middleware/mtls.py @@ -1,4 +1,5 @@ """Middleware to handle mTLS or JWT auth""" + from typing import Optional, Sequence import logging @@ -16,7 +17,7 @@ class MTLSorJWT(HTTPBase): # pylint: disable=too-few-public-methods """Auth either by JWT or mTLS header""" - def __init__( + def __init__( # pylint: disable=R0913 self, *, scheme: str = "header", diff --git a/src/rasenmaeher_api/web/api/middleware/user.py b/src/rasenmaeher_api/web/api/middleware/user.py index 0d78e03d..aeb5364c 100644 --- a/src/rasenmaeher_api/web/api/middleware/user.py +++ b/src/rasenmaeher_api/web/api/middleware/user.py @@ -1,4 +1,5 @@ """Middleware to require valid user""" + from typing import Optional, Sequence import logging diff --git a/src/rasenmaeher_api/web/api/people/__init__.py b/src/rasenmaeher_api/web/api/people/__init__.py index 53a5156b..110b9643 100644 --- a/src/rasenmaeher_api/web/api/people/__init__.py +++ b/src/rasenmaeher_api/web/api/people/__init__.py @@ -1,4 +1,5 @@ """People API.""" + from rasenmaeher_api.web.api.people.views import router __all__ = ["router"] diff --git a/src/rasenmaeher_api/web/api/people/schema.py b/src/rasenmaeher_api/web/api/people/schema.py index 6f4327e8..0c6a2472 100644 --- a/src/rasenmaeher_api/web/api/people/schema.py +++ b/src/rasenmaeher_api/web/api/people/schema.py @@ -1,4 +1,5 @@ """Schema for people.""" + from typing import List, Dict, Any, Optional from pydantic import BaseModel, Extra diff --git a/src/rasenmaeher_api/web/api/people/views.py b/src/rasenmaeher_api/web/api/people/views.py index 0ff25dcd..1d258344 100644 --- a/src/rasenmaeher_api/web/api/people/views.py +++ b/src/rasenmaeher_api/web/api/people/views.py @@ -1,4 +1,5 @@ """People API views.""" # pylint: disable=too-many-lines + from typing import List, Optional import logging diff --git a/src/rasenmaeher_api/web/api/product/__init__.py b/src/rasenmaeher_api/web/api/product/__init__.py index 574fe05b..b17589e2 100644 --- a/src/rasenmaeher_api/web/api/product/__init__.py +++ b/src/rasenmaeher_api/web/api/product/__init__.py @@ -1,4 +1,5 @@ """Product registration API.""" + from rasenmaeher_api.web.api.product.views import router __all__ = ["router"] diff --git a/src/rasenmaeher_api/web/api/product/schema.py b/src/rasenmaeher_api/web/api/product/schema.py index f1d29d40..15b857df 100644 --- a/src/rasenmaeher_api/web/api/product/schema.py +++ b/src/rasenmaeher_api/web/api/product/schema.py @@ -1,4 +1,5 @@ """Schema for product mTLS cert signing""" + from pydantic import BaseModel, Field, Extra @@ -66,3 +67,31 @@ class Config: # pylint: disable=too-few-public-methods }, ] } + + +class KCClientToken(BaseModel): # pylint: disable=too-few-public-methods + """Token for registering a KC client (for OIDC)""" + + id: str = Field(description="Internal KC uuid for the token") + token: str = Field(description="JWT that allows to register a client to KC") + timestamp: int = Field(description="Unix timestamp") + expiration: int = Field(description="Expires in days") + count: int = Field(description="Number of uses total") + remainingCount: int = Field(description="Number of uses remaining") + + class Config: # pylint: disable=too-few-public-methods + """Example values for schema""" + + extra = Extra.forbid + schema_extra = { + "examples": [ + { + "id": """ca27c7ee-bc2b-4a48-bd76-9f12d31758bb""", + "certificate": """eyJhb...._N8GEsPw""", + "timestamp": 1743207161, + "expiration": 1, + "count": 1, + "remainingCount": 1, + }, + ] + } diff --git a/src/rasenmaeher_api/web/api/product/views.py b/src/rasenmaeher_api/web/api/product/views.py index 6744ee34..de0472ca 100644 --- a/src/rasenmaeher_api/web/api/product/views.py +++ b/src/rasenmaeher_api/web/api/product/views.py @@ -1,4 +1,5 @@ """Product registration API views.""" + import logging from fastapi import APIRouter, Depends, HTTPException, Request @@ -10,13 +11,14 @@ from OpenSSL.crypto import load_certificate_request, FILETYPE_PEM # FIXME: use cryptography instead of pyOpenSSL -from .schema import CertificatesResponse, CertificatesRequest, RevokeRequest +from .schema import CertificatesResponse, CertificatesRequest, RevokeRequest, KCClientToken from ....db.nonces import SeenToken from ....db.errors import NotFound from ....cfssl.public import get_ca, get_bundle from ....cfssl.private import sign_csr, revoke_pem from ....cfssl.base import CFSSLError from ....rmsettings import RMSettings +from ....kchelpers import KCClient router = APIRouter() @@ -122,3 +124,17 @@ async def signal_ready( _ = meta return OperationResultResponse(success=True, extra="This was actually NO-OP") + + +@router.post("/kctoken", dependencies=[Depends(MTLSHeader(auto_error=True))]) +async def get_kc_token( + request: Request, +) -> KCClientToken: + """Get a token to self-register a client for OIDC""" + payload = request.state.mtlsdn + if payload.get("CN") not in RMSettings.singleton().valid_product_cns: + raise HTTPException(status_code=403) + if not RMSettings.singleton().kc_enabled: + raise HTTPException(403, detail="KC is not enabled") + data = await KCClient.singleton().client_access_token() + return KCClientToken.parse_obj(data) diff --git a/src/rasenmaeher_api/web/api/router.py b/src/rasenmaeher_api/web/api/router.py index d9cad2ee..03c3ea75 100644 --- a/src/rasenmaeher_api/web/api/router.py +++ b/src/rasenmaeher_api/web/api/router.py @@ -1,4 +1,5 @@ -""" router.py: API router. """ +"""router.py: API router.""" + from fastapi.routing import APIRouter from rasenmaeher_api.web.api import ( diff --git a/src/rasenmaeher_api/web/api/tokens/__init__.py b/src/rasenmaeher_api/web/api/tokens/__init__.py index 06abfb64..036eb63c 100644 --- a/src/rasenmaeher_api/web/api/tokens/__init__.py +++ b/src/rasenmaeher_api/web/api/tokens/__init__.py @@ -1,4 +1,5 @@ """Login tokens APIs""" + from .views import router __all__ = ["router"] diff --git a/src/rasenmaeher_api/web/api/tokens/schema.py b/src/rasenmaeher_api/web/api/tokens/schema.py index bdc26289..fb46e773 100644 --- a/src/rasenmaeher_api/web/api/tokens/schema.py +++ b/src/rasenmaeher_api/web/api/tokens/schema.py @@ -1,4 +1,5 @@ """Token exchange schemas""" + from typing import Any, Dict from pydantic import BaseModel, Field, Extra diff --git a/src/rasenmaeher_api/web/api/tokens/views.py b/src/rasenmaeher_api/web/api/tokens/views.py index 89b8f957..f961c39c 100644 --- a/src/rasenmaeher_api/web/api/tokens/views.py +++ b/src/rasenmaeher_api/web/api/tokens/views.py @@ -1,4 +1,5 @@ """Views dealing with login tokens issues by/via TILAUSPALVELU""" + import logging from fastapi import APIRouter, HTTPException, Depends diff --git a/src/rasenmaeher_api/web/api/utils/__init__.py b/src/rasenmaeher_api/web/api/utils/__init__.py index 0230502a..4dd2fadc 100644 --- a/src/rasenmaeher_api/web/api/utils/__init__.py +++ b/src/rasenmaeher_api/web/api/utils/__init__.py @@ -1,4 +1,5 @@ """Utils API.""" + from rasenmaeher_api.web.api.utils.views import router __all__ = ["router"] diff --git a/src/rasenmaeher_api/web/api/utils/schema.py b/src/rasenmaeher_api/web/api/utils/schema.py index f459bb0f..19c07c5e 100644 --- a/src/rasenmaeher_api/web/api/utils/schema.py +++ b/src/rasenmaeher_api/web/api/utils/schema.py @@ -1,4 +1,5 @@ """Schema for utils.""" + from typing import Optional from pydantic import BaseModel, Extra diff --git a/src/rasenmaeher_api/web/api/utils/views.py b/src/rasenmaeher_api/web/api/utils/views.py index ea09e101..d5c6f25f 100644 --- a/src/rasenmaeher_api/web/api/utils/views.py +++ b/src/rasenmaeher_api/web/api/utils/views.py @@ -1,4 +1,5 @@ """Utils API views.""" + import logging from fastapi import APIRouter, Depends, Response diff --git a/src/rasenmaeher_api/web/application.py b/src/rasenmaeher_api/web/application.py index d09e1131..618532d7 100644 --- a/src/rasenmaeher_api/web/application.py +++ b/src/rasenmaeher_api/web/application.py @@ -1,4 +1,5 @@ """Main API entrypoint""" + from typing import AsyncGenerator import asyncio import logging diff --git a/tests/conftest.py b/tests/conftest.py index 0aa54d83..30397d50 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,5 @@ """pytest automagics""" + import asyncio from typing import Dict, Any, AsyncGenerator, Generator, Tuple, List import logging @@ -21,7 +22,6 @@ import pytest_asyncio # pylint: disable=import-error -from rasenmaeher_api.web.application import get_app from rasenmaeher_api.rmsettings import switchme_to_singleton_call from rasenmaeher_api.productapihelpers import check_kraftwerk_manifest from rasenmaeher_api.testhelpers import create_test_users @@ -35,6 +35,9 @@ JWT_PATH = DATA_PATH / Path("jwt") +# pylint: disable=W0621 + + # FIXME Should the TaskMaster feature async def tms_wait() -> None: """Wait for background tasks to avoid race conditions""" @@ -68,8 +71,12 @@ async def taskmaster() -> AsyncGenerator[None, None]: @pytest.fixture(scope="session") -def app_instance() -> FastAPI: +def app_instance(session_env_config: None) -> FastAPI: """Singleton app instance""" + _ = session_env_config + # We need to import this *after* messing with env or manifest based routes break + from rasenmaeher_api.web.application import get_app # pylint: disable=import-outside-toplevel + app = get_app() return app diff --git a/tests/ptfpapi/fpclient.py b/tests/ptfpapi/fpclient.py index 63f20953..ae503d75 100644 --- a/tests/ptfpapi/fpclient.py +++ b/tests/ptfpapi/fpclient.py @@ -1,4 +1,5 @@ """Quick client to test the fprun server""" + import logging from os import environ import sys diff --git a/tests/ptfpapi/fpinit.py b/tests/ptfpapi/fpinit.py index 3a368940..9c71e95f 100644 --- a/tests/ptfpapi/fpinit.py +++ b/tests/ptfpapi/fpinit.py @@ -1,4 +1,5 @@ """Create server cert and get it signed by CFSSL""" + from typing import cast, Any, Mapping, Union, Dict import asyncio import logging diff --git a/tests/ptfpapi/fprun.py b/tests/ptfpapi/fprun.py index 4422809d..25922ee5 100644 --- a/tests/ptfpapi/fprun.py +++ b/tests/ptfpapi/fprun.py @@ -1,4 +1,5 @@ """The quickest and dirtiest way to respond something to rasenmaehers product integration requests""" + import logging from os import environ import sys @@ -62,6 +63,7 @@ async def handle_fragment(request: web.Request) -> web.Response: """Respond with hello_world for user""" check_peer_cert(request) user = UserCRUDRequest.parse_raw(await request.text()) + LOGGER.info("Called with user={}".format(user)) zip1_bytes = zip_pem(user.x509cert, f"{user.callsign}_1.pem") zip2_bytes = zip_pem(user.x509cert, f"{user.callsign}_2.pem") @@ -84,6 +86,7 @@ async def handle_fragment(request: web.Request) -> web.Response: async def handle_description(request: web.Request) -> web.Response: """Respond with hello_world for user""" _lang = request.match_info.get("language", "en") + LOGGER.info("Called") return web.json_response( { @@ -101,6 +104,7 @@ async def handle_instructions(request: web.Request) -> web.Response: check_peer_cert(request) _lang = request.match_info.get("language", "en") payload = await request.json() + LOGGER.info("Called with payload={}".format(payload)) return web.json_response( { diff --git a/tests/test_auth.py b/tests/test_auth.py index 380adf62..b2547a77 100644 --- a/tests/test_auth.py +++ b/tests/test_auth.py @@ -1,4 +1,5 @@ """Test the supported authentication methods""" + import uuid from typing import Tuple, Dict, Any, cast import logging diff --git a/tests/test_cfssl.py b/tests/test_cfssl.py index 0b2efa79..b0a52032 100644 --- a/tests/test_cfssl.py +++ b/tests/test_cfssl.py @@ -1,4 +1,5 @@ """Test CFSSL wrappers""" + import logging import uuid diff --git a/tests/test_console.py b/tests/test_console.py index c8e8409f..57235a4c 100644 --- a/tests/test_console.py +++ b/tests/test_console.py @@ -1,4 +1,5 @@ """Test CLI scripts""" + import asyncio import pytest diff --git a/tests/test_db.py b/tests/test_db.py index 40cd0c0d..b8c4baca 100644 --- a/tests/test_db.py +++ b/tests/test_db.py @@ -1,4 +1,5 @@ """DB specific tests""" + import asyncio import logging import uuid diff --git a/tests/test_descriptions.py b/tests/test_descriptions.py index e9935393..2bd4afe0 100644 --- a/tests/test_descriptions.py +++ b/tests/test_descriptions.py @@ -1,4 +1,5 @@ """Test the descriptions endpoint""" + import logging import pytest diff --git a/tests/test_enrollment.py b/tests/test_enrollment.py index 6629fc96..69472f1f 100644 --- a/tests/test_enrollment.py +++ b/tests/test_enrollment.py @@ -1,4 +1,5 @@ """Test enrollment endpoint""" + from typing import Dict, Any import logging @@ -7,6 +8,7 @@ import cryptography.hazmat.primitives.serialization.pkcs12 from async_asgi_testclient import TestClient # pylint: disable=import-error +from rasenmaeher_api.rmsettings import RMSettings LOGGER = logging.getLogger(__name__) @@ -586,4 +588,19 @@ async def test_enroll_with_invite_code( # pylint: disable=R0915 pfxdata = cryptography.hazmat.primitives.serialization.pkcs12.load_pkcs12(resp.content, b"enrollenrique") assert pfxdata.key assert pfxdata.cert + + # Fetch also with alternative URLs + pfxurl = "/api/v1/enduserpfx/enrollenrique.pfx" + LOGGER.debug("Trying: {}".format(pfxurl)) + unauth_client_session.headers.update({"Authorization": f"Bearer {enrique_jwt}"}) + resp = await unauth_client_session.get(pfxurl) + resp.raise_for_status() + pfxurl2 = f"/api/v1/enduserpfx/enrollenrique_{RMSettings.singleton().deployment_name}.pfx" + LOGGER.debug("Trying: {}".format(pfxurl2)) + unauth_client_session.headers.update({"Authorization": f"Bearer {enrique_jwt}"}) + resp = await unauth_client_session.get( + pfxurl2, + ) + resp.raise_for_status() + del unauth_client_session.headers["Authorization"] diff --git a/tests/test_healthcheck.py b/tests/test_healthcheck.py index ea8543bf..c7e46743 100644 --- a/tests/test_healthcheck.py +++ b/tests/test_healthcheck.py @@ -1,4 +1,5 @@ """Test healthcheck endpoint""" + import logging from typing import Dict, Any diff --git a/tests/test_rasenmaeher_api.py b/tests/test_rasenmaeher_api.py index 4316066c..b1d84404 100644 --- a/tests/test_rasenmaeher_api.py +++ b/tests/test_rasenmaeher_api.py @@ -1,4 +1,5 @@ """Package level tests""" + from typing import Any, Dict from pathlib import Path diff --git a/tests/test_tokens.py b/tests/test_tokens.py index 97e3cf3f..1fb42338 100644 --- a/tests/test_tokens.py +++ b/tests/test_tokens.py @@ -1,4 +1,5 @@ """Test the token endpoints""" + from typing import cast import logging