From b4645bb4adb8ddcc315fcafcf8c33a93a5ea4810 Mon Sep 17 00:00:00 2001 From: Lasse Yledahl Date: Tue, 3 Sep 2024 11:39:41 +0000 Subject: [PATCH 01/28] add ruff --- .devcontainer/devcontainer.json | 5 +++-- requirements/test_requirements.in | 1 + ruff.toml | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 ruff.toml diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 18bf627fd..00d2b1f29 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,7 +1,7 @@ { "name": "Python 3", "build": { - "dockerfile": "Dockerfile", + "dockerfile": "Dockerfile" }, "customizations": { "vscode": { @@ -22,7 +22,8 @@ "streetsidesoftware.code-spell-checker", "streetsidesoftware.code-spell-checker-swedish", "ms-vscode.makefile-tools", - "ms-python.isort" + "ms-python.isort", + "charliermarsh.ruff" ] } }, diff --git a/requirements/test_requirements.in b/requirements/test_requirements.in index 8b45fb5fd..7977add28 100644 --- a/requirements/test_requirements.in +++ b/requirements/test_requirements.in @@ -14,3 +14,4 @@ pytest-cov respx pip-tools motor-types +ruff diff --git a/ruff.toml b/ruff.toml new file mode 100644 index 000000000..fad38e917 --- /dev/null +++ b/ruff.toml @@ -0,0 +1,3 @@ +# Set the maximum line length to 120. +line-length = 120 +target-version = "py310" From 12e9f7ad4ec5b4748d8cfb46398c2f72169c8420 Mon Sep 17 00:00:00 2001 From: Lasse Yledahl Date: Tue, 3 Sep 2024 11:40:01 +0000 Subject: [PATCH 02/28] update deps --- requirements/test_requirements.txt | 496 ++++++++++++++++------------- 1 file changed, 269 insertions(+), 227 deletions(-) diff --git a/requirements/test_requirements.txt b/requirements/test_requirements.txt index 04e1e04b5..6c69eccde 100644 --- a/requirements/test_requirements.txt +++ b/requirements/test_requirements.txt @@ -56,9 +56,9 @@ async-timeout==4.0.3 \ # via # -c main.txt # redis -authlib==1.3.1 \ - --hash=sha256:7ae843f03c06c5c0debd63c9db91f9fda64fa62a42a77419fa15fbb7e7a58917 \ - --hash=sha256:d35800b973099bbadc49b42b256ecb80041ad56b7fe1216a362c7943c088f377 +authlib==1.3.2 \ + --hash=sha256:4b16130117f9eb82aa6eec97f6dd4673c3f960ac0283ccdae2897ee4bc030ba2 \ + --hash=sha256:ede026a95e9f5cdc2d4364a52103f5405e75aa156357e831ef2bfd0bc5094dfc # via -r webapp_requirements.in babel==2.15.0 \ --hash=sha256:08706bdad8d0a3413266ab61bd6c34d0c28d6e1e7badf40a2cebe67644e2e1fb \ @@ -518,9 +518,9 @@ exceptiongroup==1.2.2 \ # -r sub_main.in # anyio # pytest -fastapi==0.112.0 \ - --hash=sha256:3487ded9778006a45834b8c816ec4a48d522e2631ca9e75ec5a774f1b052f821 \ - --hash=sha256:d262bc56b7d101d1f4e8fc0ad2ac75bb9935fec504d2b7117686cec50710cf05 +fastapi==0.112.2 \ + --hash=sha256:3d4729c038414d5193840706907a41839d839523da6ed0c2811f1168cac1798c \ + --hash=sha256:db84b470bd0e2b1075942231e90e3577e12a903c4dc8696f0d206a7904a7af1c # via -r fastapi_requirements.in fido-mds==2024.7 \ --hash=sha256:6b1ea32bf2edb45f8be991a108a06df577e052298f8571f3438c505817cdb107 \ @@ -548,9 +548,9 @@ flask-babel==4.0.0 \ --hash=sha256:638194cf91f8b301380f36d70e2034c77ee25b98cb5d80a1626820df9a6d4625 \ --hash=sha256:dbeab4027a3f4a87678a11686496e98e1492eb793cbdd77ab50f4e9a2602a593 # via -r webapp_requirements.in -flask-cors==4.0.1 \ - --hash=sha256:eeb69b342142fdbf4766ad99357a7f3876a2ceb77689dc10ff912aac06c389e4 \ - --hash=sha256:f2a704e4458665580c074b714c4627dd5a306b333deb9074d0b1794dfa2fb677 +flask-cors==5.0.0 \ + --hash=sha256:5aadb4b950c4e93745034594d9f3ea6591f734bb3662e16e255ffbf5e89c88ef \ + --hash=sha256:b9e307d082a9261c100d8fb0ba909eec6a228ed1b60a8315fd85f783d61910bc # via -r webapp_requirements.in flask-mail==0.10.0 \ --hash=sha256:44083e7b02bbcce792209c06252f8569dd5a325a7aaa76afe7330422bd97881d \ @@ -1072,34 +1072,34 @@ motor-types==1.0.0b4 \ --hash=sha256:6dc37c87a78acdbd658abbc4426ba3d239c4a26485a12325c65439cb7a2e27bf \ --hash=sha256:ece2ec5283dfef1a4d3d693db15a010b6c56fea0d46697184e36880935a9f940 # via -r test_requirements.in -mypy==1.11.1 \ - --hash=sha256:0624bdb940255d2dd24e829d99a13cfeb72e4e9031f9492148f410ed30bcab54 \ - --hash=sha256:0bc71d1fb27a428139dd78621953effe0d208aed9857cb08d002280b0422003a \ - --hash=sha256:0bd53faf56de9643336aeea1c925012837432b5faf1701ccca7fde70166ccf72 \ - --hash=sha256:11965c2f571ded6239977b14deebd3f4c3abd9a92398712d6da3a772974fad69 \ - --hash=sha256:1a81cf05975fd61aec5ae16501a091cfb9f605dc3e3c878c0da32f250b74760b \ - --hash=sha256:2684d3f693073ab89d76da8e3921883019ea8a3ec20fa5d8ecca6a2db4c54bbe \ - --hash=sha256:2c63350af88f43a66d3dfeeeb8d77af34a4f07d760b9eb3a8697f0386c7590b4 \ - --hash=sha256:45df906e8b6804ef4b666af29a87ad9f5921aad091c79cc38e12198e220beabd \ - --hash=sha256:4c956b49c5d865394d62941b109728c5c596a415e9c5b2be663dd26a1ff07bc0 \ - --hash=sha256:64f4a90e3ea07f590c5bcf9029035cf0efeae5ba8be511a8caada1a4893f5525 \ - --hash=sha256:749fd3213916f1751fff995fccf20c6195cae941dc968f3aaadf9bb4e430e5a2 \ - --hash=sha256:79c07eb282cb457473add5052b63925e5cc97dfab9812ee65a7c7ab5e3cb551c \ - --hash=sha256:7b6343d338390bb946d449677726edf60102a1c96079b4f002dedff375953fc5 \ - --hash=sha256:886c9dbecc87b9516eff294541bf7f3655722bf22bb898ee06985cd7269898de \ - --hash=sha256:a2b43895a0f8154df6519706d9bca8280cda52d3d9d1514b2d9c3e26792a0b74 \ - --hash=sha256:a32fc80b63de4b5b3e65f4be82b4cfa362a46702672aa6a0f443b4689af7008c \ - --hash=sha256:a707ec1527ffcdd1c784d0924bf5cb15cd7f22683b919668a04d2b9c34549d2e \ - --hash=sha256:a831671bad47186603872a3abc19634f3011d7f83b083762c942442d51c58d58 \ - --hash=sha256:b639dce63a0b19085213ec5fdd8cffd1d81988f47a2dec7100e93564f3e8fb3b \ - --hash=sha256:b868d3bcff720dd7217c383474008ddabaf048fad8d78ed948bb4b624870a417 \ - --hash=sha256:c1952f5ea8a5a959b05ed5f16452fddadbaae48b5d39235ab4c3fc444d5fd411 \ - --hash=sha256:d44be7551689d9d47b7abc27c71257adfdb53f03880841a5db15ddb22dc63edb \ - --hash=sha256:e1e30dc3bfa4e157e53c1d17a0dad20f89dc433393e7702b813c10e200843b03 \ - --hash=sha256:e4fe9f4e5e521b458d8feb52547f4bade7ef8c93238dfb5bbc790d9ff2d770ca \ - --hash=sha256:f39918a50f74dc5969807dcfaecafa804fa7f90c9d60506835036cc1bc891dc8 \ - --hash=sha256:f404a0b069709f18bbdb702eb3dcfe51910602995de00bd39cea3050b5772d08 \ - --hash=sha256:fca4a60e1dd9fd0193ae0067eaeeb962f2d79e0d9f0f66223a0682f26ffcc809 +mypy==1.11.2 \ + --hash=sha256:06d26c277962f3fb50e13044674aa10553981ae514288cb7d0a738f495550b36 \ + --hash=sha256:2ff93107f01968ed834f4256bc1fc4475e2fecf6c661260066a985b52741ddce \ + --hash=sha256:36383a4fcbad95f2657642a07ba22ff797de26277158f1cc7bd234821468b1b6 \ + --hash=sha256:37c7fa6121c1cdfcaac97ce3d3b5588e847aa79b580c1e922bb5d5d2902df19b \ + --hash=sha256:3a66169b92452f72117e2da3a576087025449018afc2d8e9bfe5ffab865709ca \ + --hash=sha256:3f14cd3d386ac4d05c5a39a51b84387403dadbd936e17cb35882134d4f8f0d24 \ + --hash=sha256:41ea707d036a5307ac674ea172875f40c9d55c5394f888b168033177fce47383 \ + --hash=sha256:478db5f5036817fe45adb7332d927daa62417159d49783041338921dcf646fc7 \ + --hash=sha256:4a8a53bc3ffbd161b5b2a4fff2f0f1e23a33b0168f1c0778ec70e1a3d66deb86 \ + --hash=sha256:539c570477a96a4e6fb718b8d5c3e0c0eba1f485df13f86d2970c91f0673148d \ + --hash=sha256:57555a7715c0a34421013144a33d280e73c08df70f3a18a552938587ce9274f4 \ + --hash=sha256:6e658bd2d20565ea86da7d91331b0eed6d2eee22dc031579e6297f3e12c758c8 \ + --hash=sha256:6e7184632d89d677973a14d00ae4d03214c8bc301ceefcdaf5c474866814c987 \ + --hash=sha256:75746e06d5fa1e91bfd5432448d00d34593b52e7e91a187d981d08d1f33d4385 \ + --hash=sha256:7f9993ad3e0ffdc95c2a14b66dee63729f021968bff8ad911867579c65d13a79 \ + --hash=sha256:801780c56d1cdb896eacd5619a83e427ce436d86a3bdf9112527f24a66618fef \ + --hash=sha256:801ca29f43d5acce85f8e999b1e431fb479cb02d0e11deb7d2abb56bdaf24fd6 \ + --hash=sha256:969ea3ef09617aff826885a22ece0ddef69d95852cdad2f60c8bb06bf1f71f70 \ + --hash=sha256:a976775ab2256aadc6add633d44f100a2517d2388906ec4f13231fafbb0eccca \ + --hash=sha256:af8d155170fcf87a2afb55b35dc1a0ac21df4431e7d96717621962e4b9192e70 \ + --hash=sha256:b499bc07dbdcd3de92b0a8b29fdf592c111276f6a12fe29c30f6c417dd546d12 \ + --hash=sha256:cd953f221ac1379050a8a646585a29574488974f79d8082cedef62744f0a0104 \ + --hash=sha256:d42a6dd818ffce7be66cce644f1dff482f1d97c53ca70908dff0b9ddc120b77a \ + --hash=sha256:e8960dbbbf36906c5c0b7f4fbf2f0c7ffb20f4898e6a879fcf56a41a08b0d318 \ + --hash=sha256:edb91dded4df17eae4537668b23f0ff6baf3707683734b6a818d5b9d0c0c31a1 \ + --hash=sha256:ee23de8530d99b6db0573c4ef4bd8f39a2a6f9b60655bf7a1357e585a3486f2b \ + --hash=sha256:f7821776e5c4286b6a13138cc935e2e9b6fde05e081bdebf5cdb2bb97c9df81d # via -r test_requirements.in mypy-extensions==1.0.0 \ --hash=sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d \ @@ -1925,6 +1925,26 @@ rsa==4.9 \ # via # -c main.txt # python-jose +ruff==0.6.3 \ + --hash=sha256:14a9528a8b70ccc7a847637c29e56fd1f9183a9db743bbc5b8e0c4ad60592a82 \ + --hash=sha256:183b99e9edd1ef63be34a3b51fee0a9f4ab95add123dbf89a71f7b1f0c991983 \ + --hash=sha256:34e2824a13bb8c668c71c1760a6ac7d795ccbd8d38ff4a0d8471fdb15de910b1 \ + --hash=sha256:3b061e49b5cf3a297b4d1c27ac5587954ccb4ff601160d3d6b2f70b1622194dc \ + --hash=sha256:42844ff678f9b976366b262fa2d1d1a3fe76f6e145bd92c84e27d172e3c34500 \ + --hash=sha256:47021dff5445d549be954eb275156dfd7c37222acc1e8014311badcb9b4ec8c1 \ + --hash=sha256:500f166d03fc6d0e61c8e40a3ff853fa8a43d938f5d14c183c612df1b0d6c58a \ + --hash=sha256:65a533235ed55f767d1fc62193a21cbf9e3329cf26d427b800fdeacfb77d296f \ + --hash=sha256:70452a10eb2d66549de8e75f89ae82462159855e983ddff91bc0bce6511d0470 \ + --hash=sha256:746af39356fee2b89aada06c7376e1aa274a23493d7016059c3a72e3b296befb \ + --hash=sha256:7a62d3b5b0d7f9143d94893f8ba43aa5a5c51a0ffc4a401aa97a81ed76930521 \ + --hash=sha256:7d7bd20dc07cebd68cc8bc7b3f5ada6d637f42d947c85264f94b0d1cd9d87384 \ + --hash=sha256:97f58fda4e309382ad30ede7f30e2791d70dd29ea17f41970119f55bdb7a45c3 \ + --hash=sha256:bddfbb8d63c460f4b4128b6a506e7052bad4d6f3ff607ebbb41b0aa19c2770d1 \ + --hash=sha256:ced3eeb44df75353e08ab3b6a9e113b5f3f996bea48d4f7c027bc528ba87b672 \ + --hash=sha256:d2e2c23cef30dc3cbe9cc5d04f2899e7f5e478c40d2e0a633513ad081f7361b5 \ + --hash=sha256:d8a136aa7d228975a6aee3dd8bea9b28e2b43e9444aa678fb62aeb1956ff2351 \ + --hash=sha256:f92fe93bc72e262b7b3f2bba9879897e2d58a989b4714ba6a5a7273e842ad2f8 + # via -r test_requirements.in s3transfer==0.10.2 \ --hash=sha256:0711534e9356d3cc692fdde846b4a1e4b0cb6519971860796e6bc4c7aea00ef6 \ --hash=sha256:eca1c20de70a39daee580aef4986996620f365c4e0fda6a86100231d62f1bf69 @@ -2059,9 +2079,9 @@ sniffio==1.3.1 \ # -c main.txt # anyio # httpx -starlette==0.37.2 \ - --hash=sha256:6fe59f29268538e5d0d182f2791a479a0c64638e6935d1c6989e63fb2699c6ee \ - --hash=sha256:9af890290133b79fc3db55474ade20f6220a364a0402e0b556e7cd5e1e093823 +starlette==0.38.4 \ + --hash=sha256:526f53a77f0e43b85f583438aee1a940fd84f8fd610353e8b0c1a77ad8a87e76 \ + --hash=sha256:53a7439060304a208fea17ed407e998f46da5e5d9b1addfea3040094512a6379 # via fastapi statsd==4.0.1 \ --hash=sha256:99763da81bfea8daf6b3d22d11aaccb01a8d0f52ea521daab37e758a4ca7d128 \ @@ -2164,42 +2184,42 @@ user-agents==2.2.0 \ --hash=sha256:a98c4dc72ecbc64812c4534108806fb0a0b3a11ec3fd1eafe807cee5b0a942e7 \ --hash=sha256:d36d25178db65308d1458c5fa4ab39c9b2619377010130329f3955e7626ead26 # via -r webapp_requirements.in -uvicorn[standard]==0.30.5 \ - --hash=sha256:ac6fdbd4425c5fd17a9fe39daf4d4d075da6fdc80f653e5894cdc2fd98752bee \ - --hash=sha256:b2d86de274726e9878188fa07576c9ceeff90a839e2b6e25c917fe05f5a6c835 +uvicorn[standard]==0.30.6 \ + --hash=sha256:4b15decdda1e72be08209e860a1e10e92439ad5b97cf44cc945fcbee66fc5788 \ + --hash=sha256:65fd46fe3fda5bdc1b03b94eb634923ff18cd35b2f084813ea79d1f103f711b5 # via -r fastapi_requirements.in -uvloop==0.19.0 \ - --hash=sha256:0246f4fd1bf2bf702e06b0d45ee91677ee5c31242f39aab4ea6fe0c51aedd0fd \ - --hash=sha256:02506dc23a5d90e04d4f65c7791e65cf44bd91b37f24cfc3ef6cf2aff05dc7ec \ - --hash=sha256:13dfdf492af0aa0a0edf66807d2b465607d11c4fa48f4a1fd41cbea5b18e8e8b \ - --hash=sha256:2693049be9d36fef81741fddb3f441673ba12a34a704e7b4361efb75cf30befc \ - --hash=sha256:271718e26b3e17906b28b67314c45d19106112067205119dddbd834c2b7ce797 \ - --hash=sha256:2df95fca285a9f5bfe730e51945ffe2fa71ccbfdde3b0da5772b4ee4f2e770d5 \ - --hash=sha256:31e672bb38b45abc4f26e273be83b72a0d28d074d5b370fc4dcf4c4eb15417d2 \ - --hash=sha256:34175c9fd2a4bc3adc1380e1261f60306344e3407c20a4d684fd5f3be010fa3d \ - --hash=sha256:45bf4c24c19fb8a50902ae37c5de50da81de4922af65baf760f7c0c42e1088be \ - --hash=sha256:472d61143059c84947aa8bb74eabbace30d577a03a1805b77933d6bd13ddebbd \ - --hash=sha256:47bf3e9312f63684efe283f7342afb414eea4d3011542155c7e625cd799c3b12 \ - --hash=sha256:492e2c32c2af3f971473bc22f086513cedfc66a130756145a931a90c3958cb17 \ - --hash=sha256:4ce6b0af8f2729a02a5d1575feacb2a94fc7b2e983868b009d51c9a9d2149bef \ - --hash=sha256:5138821e40b0c3e6c9478643b4660bd44372ae1e16a322b8fc07478f92684e24 \ - --hash=sha256:5588bd21cf1fcf06bded085f37e43ce0e00424197e7c10e77afd4bbefffef428 \ - --hash=sha256:570fc0ed613883d8d30ee40397b79207eedd2624891692471808a95069a007c1 \ - --hash=sha256:5a05128d315e2912791de6088c34136bfcdd0c7cbc1cf85fd6fd1bb321b7c849 \ - --hash=sha256:5daa304d2161d2918fa9a17d5635099a2f78ae5b5960e742b2fcfbb7aefaa593 \ - --hash=sha256:5f17766fb6da94135526273080f3455a112f82570b2ee5daa64d682387fe0dcd \ - --hash=sha256:6e3d4e85ac060e2342ff85e90d0c04157acb210b9ce508e784a944f852a40e67 \ - --hash=sha256:7010271303961c6f0fe37731004335401eb9075a12680738731e9c92ddd96ad6 \ - --hash=sha256:7207272c9520203fea9b93843bb775d03e1cf88a80a936ce760f60bb5add92f3 \ - --hash=sha256:78ab247f0b5671cc887c31d33f9b3abfb88d2614b84e4303f1a63b46c046c8bd \ - --hash=sha256:7b1fd71c3843327f3bbc3237bedcdb6504fd50368ab3e04d0410e52ec293f5b8 \ - --hash=sha256:8ca4956c9ab567d87d59d49fa3704cf29e37109ad348f2d5223c9bf761a332e7 \ - --hash=sha256:91ab01c6cd00e39cde50173ba4ec68a1e578fee9279ba64f5221810a9e786533 \ - --hash=sha256:cd81bdc2b8219cb4b2556eea39d2e36bfa375a2dd021404f90a62e44efaaf957 \ - --hash=sha256:da8435a3bd498419ee8c13c34b89b5005130a476bda1d6ca8cfdde3de35cd650 \ - --hash=sha256:de4313d7f575474c8f5a12e163f6d89c0a878bc49219641d49e6f1444369a90e \ - --hash=sha256:e27f100e1ff17f6feeb1f33968bc185bf8ce41ca557deee9d9bbbffeb72030b7 \ - --hash=sha256:f467a5fd23b4fc43ed86342641f3936a68ded707f4627622fa3f82a120e18256 +uvloop==0.20.0 \ + --hash=sha256:265a99a2ff41a0fd56c19c3838b29bf54d1d177964c300dad388b27e84fd7847 \ + --hash=sha256:2beee18efd33fa6fdb0976e18475a4042cd31c7433c866e8a09ab604c7c22ff2 \ + --hash=sha256:35968fc697b0527a06e134999eef859b4034b37aebca537daeb598b9d45a137b \ + --hash=sha256:36c530d8fa03bfa7085af54a48f2ca16ab74df3ec7108a46ba82fd8b411a2315 \ + --hash=sha256:3a609780e942d43a275a617c0839d85f95c334bad29c4c0918252085113285b5 \ + --hash=sha256:4603ca714a754fc8d9b197e325db25b2ea045385e8a3ad05d3463de725fdf469 \ + --hash=sha256:4b75f2950ddb6feed85336412b9a0c310a2edbcf4cf931aa5cfe29034829676d \ + --hash=sha256:4f44af67bf39af25db4c1ac27e82e9665717f9c26af2369c404be865c8818dcf \ + --hash=sha256:6462c95f48e2d8d4c993a2950cd3d31ab061864d1c226bbf0ee2f1a8f36674b9 \ + --hash=sha256:649c33034979273fa71aa25d0fe120ad1777c551d8c4cd2c0c9851d88fcb13ab \ + --hash=sha256:746242cd703dc2b37f9d8b9f173749c15e9a918ddb021575a0205ec29a38d31e \ + --hash=sha256:77fbc69c287596880ecec2d4c7a62346bef08b6209749bf6ce8c22bbaca0239e \ + --hash=sha256:80dc1b139516be2077b3e57ce1cb65bfed09149e1d175e0478e7a987863b68f0 \ + --hash=sha256:82edbfd3df39fb3d108fc079ebc461330f7c2e33dbd002d146bf7c445ba6e756 \ + --hash=sha256:89e8d33bb88d7263f74dc57d69f0063e06b5a5ce50bb9a6b32f5fcbe655f9e73 \ + --hash=sha256:94707205efbe809dfa3a0d09c08bef1352f5d3d6612a506f10a319933757c006 \ + --hash=sha256:95720bae002ac357202e0d866128eb1ac82545bcf0b549b9abe91b5178d9b541 \ + --hash=sha256:9b04d96188d365151d1af41fa2d23257b674e7ead68cfd61c725a422764062ae \ + --hash=sha256:9d0fba61846f294bce41eb44d60d58136090ea2b5b99efd21cbdf4e21927c56a \ + --hash=sha256:9ebafa0b96c62881d5cafa02d9da2e44c23f9f0cd829f3a32a6aff771449c996 \ + --hash=sha256:a0fac7be202596c7126146660725157d4813aa29a4cc990fe51346f75ff8fde7 \ + --hash=sha256:aea15c78e0d9ad6555ed201344ae36db5c63d428818b4b2a42842b3870127c00 \ + --hash=sha256:b10c2956efcecb981bf9cfb8184d27d5d64b9033f917115a960b83f11bfa0d6b \ + --hash=sha256:b16696f10e59d7580979b420eedf6650010a4a9c3bd8113f24a103dfdb770b10 \ + --hash=sha256:d8c36fdf3e02cec92aed2d44f63565ad1522a499c654f07935c8f9d04db69e95 \ + --hash=sha256:e237f9c1e8a00e7d9ddaa288e535dc337a39bcbf679f290aee9d26df9e72bce9 \ + --hash=sha256:e50289c101495e0d1bb0bfcb4a60adde56e32f4449a67216a1ab2750aa84f037 \ + --hash=sha256:e7d61fe8e8d9335fac1bf8d5d82820b4808dd7a43020c149b63a1ada953d48a6 \ + --hash=sha256:e97152983442b499d7a71e44f29baa75b3b02e65d9c44ba53b10338e98dedb66 \ + --hash=sha256:f0e94b221295b5e69de57a1bd4aeb0b3a29f61be6e1b478bb8a69a73377db7ba \ + --hash=sha256:fee6044b64c965c425b65a4e17719953b96e065c5b7e09b599ff332bb2744bdf # via uvicorn vine==5.1.0 \ --hash=sha256:40fdf3c48b2cfe1c38a49e9ae2da6fda88e4794c810050a728bd7413811fb1dc \ @@ -2209,82 +2229,90 @@ vine==5.1.0 \ # amqp # celery # kombu -watchfiles==0.22.0 \ - --hash=sha256:00095dd368f73f8f1c3a7982a9801190cc88a2f3582dd395b289294f8975172b \ - --hash=sha256:00ad0bcd399503a84cc688590cdffbe7a991691314dde5b57b3ed50a41319a31 \ - --hash=sha256:00f39592cdd124b4ec5ed0b1edfae091567c72c7da1487ae645426d1b0ffcad1 \ - --hash=sha256:030bc4e68d14bcad2294ff68c1ed87215fbd9a10d9dea74e7cfe8a17869785ab \ - --hash=sha256:052d668a167e9fc345c24203b104c313c86654dd6c0feb4b8a6dfc2462239249 \ - --hash=sha256:067dea90c43bf837d41e72e546196e674f68c23702d3ef80e4e816937b0a3ffd \ - --hash=sha256:0b04a2cbc30e110303baa6d3ddce8ca3664bc3403be0f0ad513d1843a41c97d1 \ - --hash=sha256:0bc3b2f93a140df6806c8467c7f51ed5e55a931b031b5c2d7ff6132292e803d6 \ - --hash=sha256:0c8e0aa0e8cc2a43561e0184c0513e291ca891db13a269d8d47cb9841ced7c71 \ - --hash=sha256:103622865599f8082f03af4214eaff90e2426edff5e8522c8f9e93dc17caee13 \ - --hash=sha256:1235c11510ea557fe21be5d0e354bae2c655a8ee6519c94617fe63e05bca4171 \ - --hash=sha256:1cc0cba54f47c660d9fa3218158b8963c517ed23bd9f45fe463f08262a4adae1 \ - --hash=sha256:1d9188979a58a096b6f8090e816ccc3f255f137a009dd4bbec628e27696d67c1 \ - --hash=sha256:213792c2cd3150b903e6e7884d40660e0bcec4465e00563a5fc03f30ea9c166c \ - --hash=sha256:25c817ff2a86bc3de3ed2df1703e3d24ce03479b27bb4527c57e722f8554d971 \ - --hash=sha256:2627a91e8110b8de2406d8b2474427c86f5a62bf7d9ab3654f541f319ef22bcb \ - --hash=sha256:280a4afbc607cdfc9571b9904b03a478fc9f08bbeec382d648181c695648202f \ - --hash=sha256:28324d6b28bcb8d7c1041648d7b63be07a16db5510bea923fc80b91a2a6cbed6 \ - --hash=sha256:28585744c931576e535860eaf3f2c0ec7deb68e3b9c5a85ca566d69d36d8dd27 \ - --hash=sha256:28f393c1194b6eaadcdd8f941307fc9bbd7eb567995232c830f6aef38e8a6e88 \ - --hash=sha256:2abeb79209630da981f8ebca30a2c84b4c3516a214451bfc5f106723c5f45843 \ - --hash=sha256:2bdadf6b90c099ca079d468f976fd50062905d61fae183f769637cb0f68ba59a \ - --hash=sha256:2f350cbaa4bb812314af5dab0eb8d538481e2e2279472890864547f3fe2281ed \ - --hash=sha256:3218a6f908f6a276941422b035b511b6d0d8328edd89a53ae8c65be139073f84 \ - --hash=sha256:3973145235a38f73c61474d56ad6199124e7488822f3a4fc97c72009751ae3b0 \ - --hash=sha256:3a0d883351a34c01bd53cfa75cd0292e3f7e268bacf2f9e33af4ecede7e21d1d \ - --hash=sha256:425440e55cd735386ec7925f64d5dde392e69979d4c8459f6bb4e920210407f2 \ - --hash=sha256:4b9f2a128a32a2c273d63eb1fdbf49ad64852fc38d15b34eaa3f7ca2f0d2b797 \ - --hash=sha256:4cc382083afba7918e32d5ef12321421ef43d685b9a67cc452a6e6e18920890e \ - --hash=sha256:52fc9b0dbf54d43301a19b236b4a4614e610605f95e8c3f0f65c3a456ffd7d35 \ - --hash=sha256:55b7cc10261c2786c41d9207193a85c1db1b725cf87936df40972aab466179b6 \ - --hash=sha256:581f0a051ba7bafd03e17127735d92f4d286af941dacf94bcf823b101366249e \ - --hash=sha256:5834e1f8b71476a26df97d121c0c0ed3549d869124ed2433e02491553cb468c2 \ - --hash=sha256:5e45fb0d70dda1623a7045bd00c9e036e6f1f6a85e4ef2c8ae602b1dfadf7550 \ - --hash=sha256:61af9efa0733dc4ca462347becb82e8ef4945aba5135b1638bfc20fad64d4f0e \ - --hash=sha256:68fe0c4d22332d7ce53ad094622b27e67440dacefbaedd29e0794d26e247280c \ - --hash=sha256:72a44e9481afc7a5ee3291b09c419abab93b7e9c306c9ef9108cb76728ca58d2 \ - --hash=sha256:7a74436c415843af2a769b36bf043b6ccbc0f8d784814ba3d42fc961cdb0a9dc \ - --hash=sha256:8597b6f9dc410bdafc8bb362dac1cbc9b4684a8310e16b1ff5eee8725d13dcd6 \ - --hash=sha256:8c39987a1397a877217be1ac0fb1d8b9f662c6077b90ff3de2c05f235e6a8f96 \ - --hash=sha256:8c3e3675e6e39dc59b8fe5c914a19d30029e36e9f99468dddffd432d8a7b1c93 \ - --hash=sha256:8dc1fc25a1dedf2dd952909c8e5cb210791e5f2d9bc5e0e8ebc28dd42fed7562 \ - --hash=sha256:8fdebb655bb1ba0122402352b0a4254812717a017d2dc49372a1d47e24073795 \ - --hash=sha256:9165bcab15f2b6d90eedc5c20a7f8a03156b3773e5fb06a790b54ccecdb73385 \ - --hash=sha256:94ebe84a035993bb7668f58a0ebf998174fb723a39e4ef9fce95baabb42b787f \ - --hash=sha256:9624a68b96c878c10437199d9a8b7d7e542feddda8d5ecff58fdc8e67b460848 \ - --hash=sha256:96eec15e5ea7c0b6eb5bfffe990fc7c6bd833acf7e26704eb18387fb2f5fd087 \ - --hash=sha256:97b94e14b88409c58cdf4a8eaf0e67dfd3ece7e9ce7140ea6ff48b0407a593ec \ - --hash=sha256:988e981aaab4f3955209e7e28c7794acdb690be1efa7f16f8ea5aba7ffdadacb \ - --hash=sha256:a8a31bfd98f846c3c284ba694c6365620b637debdd36e46e1859c897123aa232 \ - --hash=sha256:a927b3034d0672f62fb2ef7ea3c9fc76d063c4b15ea852d1db2dc75fe2c09696 \ - --hash=sha256:ace7d060432acde5532e26863e897ee684780337afb775107c0a90ae8dbccfd2 \ - --hash=sha256:aec83c3ba24c723eac14225194b862af176d52292d271c98820199110e31141e \ - --hash=sha256:b44b70850f0073b5fcc0b31ede8b4e736860d70e2dbf55701e05d3227a154a67 \ - --hash=sha256:b610fb5e27825b570554d01cec427b6620ce9bd21ff8ab775fc3a32f28bba63e \ - --hash=sha256:b810a2c7878cbdecca12feae2c2ae8af59bea016a78bc353c184fa1e09f76b68 \ - --hash=sha256:bbf8a20266136507abf88b0df2328e6a9a7c7309e8daff124dda3803306a9fdb \ - --hash=sha256:bd4c06100bce70a20c4b81e599e5886cf504c9532951df65ad1133e508bf20be \ - --hash=sha256:c2444dc7cb9d8cc5ab88ebe792a8d75709d96eeef47f4c8fccb6df7c7bc5be71 \ - --hash=sha256:c49b76a78c156979759d759339fb62eb0549515acfe4fd18bb151cc07366629c \ - --hash=sha256:c4a65474fd2b4c63e2c18ac67a0c6c66b82f4e73e2e4d940f837ed3d2fd9d4da \ - --hash=sha256:c5af2347d17ab0bd59366db8752d9e037982e259cacb2ba06f2c41c08af02c39 \ - --hash=sha256:c668228833c5619f6618699a2c12be057711b0ea6396aeaece4ded94184304ea \ - --hash=sha256:c7b978c384e29d6c7372209cbf421d82286a807bbcdeb315427687f8371c340a \ - --hash=sha256:d048ad5d25b363ba1d19f92dcf29023988524bee6f9d952130b316c5802069cb \ - --hash=sha256:d3e1f3cf81f1f823e7874ae563457828e940d75573c8fbf0ee66818c8b6a9099 \ - --hash=sha256:d47e9ef1a94cc7a536039e46738e17cce058ac1593b2eccdede8bf72e45f372a \ - --hash=sha256:da1e0a8caebf17976e2ffd00fa15f258e14749db5e014660f53114b676e68538 \ - --hash=sha256:dc1b9b56f051209be458b87edb6856a449ad3f803315d87b2da4c93b43a6fe72 \ - --hash=sha256:dc2e8fe41f3cac0660197d95216c42910c2b7e9c70d48e6d84e22f577d106fc1 \ - --hash=sha256:dc92d2d2706d2b862ce0568b24987eba51e17e14b79a1abcd2edc39e48e743c8 \ - --hash=sha256:dd64f3a4db121bc161644c9e10a9acdb836853155a108c2446db2f5ae1778c3d \ - --hash=sha256:e0f0a874231e2839abbf473256efffe577d6ee2e3bfa5b540479e892e47c172d \ - --hash=sha256:f7e1f9c5d1160d03b93fc4b68a0aeb82fe25563e12fbcdc8507f8434ab6f823c \ - --hash=sha256:fe82d13461418ca5e5a808a9e40f79c1879351fcaeddbede094028e74d836e86 +watchfiles==0.24.0 \ + --hash=sha256:01550ccf1d0aed6ea375ef259706af76ad009ef5b0203a3a4cce0f6024f9b68a \ + --hash=sha256:01def80eb62bd5db99a798d5e1f5f940ca0a05986dcfae21d833af7a46f7ee22 \ + --hash=sha256:07cdef0c84c03375f4e24642ef8d8178e533596b229d32d2bbd69e5128ede02a \ + --hash=sha256:083dc77dbdeef09fa44bb0f4d1df571d2e12d8a8f985dccde71ac3ac9ac067a0 \ + --hash=sha256:1cf1f6dd7825053f3d98f6d33f6464ebdd9ee95acd74ba2c34e183086900a827 \ + --hash=sha256:21ab23fdc1208086d99ad3f69c231ba265628014d4aed31d4e8746bd59e88cd1 \ + --hash=sha256:2dadf8a8014fde6addfd3c379e6ed1a981c8f0a48292d662e27cabfe4239c83c \ + --hash=sha256:2e28d91ef48eab0afb939fa446d8ebe77e2f7593f5f463fd2bb2b14132f95b6e \ + --hash=sha256:2efec17819b0046dde35d13fb8ac7a3ad877af41ae4640f4109d9154ed30a188 \ + --hash=sha256:30bbd525c3262fd9f4b1865cb8d88e21161366561cd7c9e1194819e0a33ea86b \ + --hash=sha256:316449aefacf40147a9efaf3bd7c9bdd35aaba9ac5d708bd1eb5763c9a02bef5 \ + --hash=sha256:327763da824817b38ad125dcd97595f942d720d32d879f6c4ddf843e3da3fe90 \ + --hash=sha256:32aa53a9a63b7f01ed32e316e354e81e9da0e6267435c7243bf8ae0f10b428ef \ + --hash=sha256:34e19e56d68b0dad5cff62273107cf5d9fbaf9d75c46277aa5d803b3ef8a9e9b \ + --hash=sha256:3770e260b18e7f4e576edca4c0a639f704088602e0bc921c5c2e721e3acb8d15 \ + --hash=sha256:3d2e3ab79a1771c530233cadfd277fcc762656d50836c77abb2e5e72b88e3a48 \ + --hash=sha256:41face41f036fee09eba33a5b53a73e9a43d5cb2c53dad8e61fa6c9f91b5a51e \ + --hash=sha256:43e3e37c15a8b6fe00c1bce2473cfa8eb3484bbeecf3aefbf259227e487a03df \ + --hash=sha256:449f43f49c8ddca87c6b3980c9284cab6bd1f5c9d9a2b00012adaaccd5e7decd \ + --hash=sha256:4933a508d2f78099162da473841c652ad0de892719043d3f07cc83b33dfd9d91 \ + --hash=sha256:49d617df841a63b4445790a254013aea2120357ccacbed00253f9c2b5dc24e2d \ + --hash=sha256:49fb58bcaa343fedc6a9e91f90195b20ccb3135447dc9e4e2570c3a39565853e \ + --hash=sha256:4a7fa2bc0efef3e209a8199fd111b8969fe9db9c711acc46636686331eda7dd4 \ + --hash=sha256:4abf4ad269856618f82dee296ac66b0cd1d71450fc3c98532d93798e73399b7a \ + --hash=sha256:4b8693502d1967b00f2fb82fc1e744df128ba22f530e15b763c8d82baee15370 \ + --hash=sha256:4d28cea3c976499475f5b7a2fec6b3a36208656963c1a856d328aeae056fc5c1 \ + --hash=sha256:5148c2f1ea043db13ce9b0c28456e18ecc8f14f41325aa624314095b6aa2e9ea \ + --hash=sha256:54ca90a9ae6597ae6dc00e7ed0a040ef723f84ec517d3e7ce13e63e4bc82fa04 \ + --hash=sha256:551ec3ee2a3ac9cbcf48a4ec76e42c2ef938a7e905a35b42a1267fa4b1645896 \ + --hash=sha256:5c51749f3e4e269231510da426ce4a44beb98db2dce9097225c338f815b05d4f \ + --hash=sha256:632676574429bee8c26be8af52af20e0c718cc7f5f67f3fb658c71928ccd4f7f \ + --hash=sha256:6509ed3f467b79d95fc62a98229f79b1a60d1b93f101e1c61d10c95a46a84f43 \ + --hash=sha256:6bdcfa3cd6fdbdd1a068a52820f46a815401cbc2cb187dd006cb076675e7b735 \ + --hash=sha256:7138eff8baa883aeaa074359daabb8b6c1e73ffe69d5accdc907d62e50b1c0da \ + --hash=sha256:7211b463695d1e995ca3feb38b69227e46dbd03947172585ecb0588f19b0d87a \ + --hash=sha256:73bde715f940bea845a95247ea3e5eb17769ba1010efdc938ffcb967c634fa61 \ + --hash=sha256:78470906a6be5199524641f538bd2c56bb809cd4bf29a566a75051610bc982c3 \ + --hash=sha256:7ae3e208b31be8ce7f4c2c0034f33406dd24fbce3467f77223d10cd86778471c \ + --hash=sha256:7e4bd963a935aaf40b625c2499f3f4f6bbd0c3776f6d3bc7c853d04824ff1c9f \ + --hash=sha256:82ae557a8c037c42a6ef26c494d0631cacca040934b101d001100ed93d43f361 \ + --hash=sha256:82b2509f08761f29a0fdad35f7e1638b8ab1adfa2666d41b794090361fb8b855 \ + --hash=sha256:8360f7314a070c30e4c976b183d1d8d1585a4a50c5cb603f431cebcbb4f66327 \ + --hash=sha256:85d5f0c7771dcc7a26c7a27145059b6bb0ce06e4e751ed76cdf123d7039b60b5 \ + --hash=sha256:88bcd4d0fe1d8ff43675360a72def210ebad3f3f72cabfeac08d825d2639b4ab \ + --hash=sha256:9301c689051a4857d5b10777da23fafb8e8e921bcf3abe6448a058d27fb67633 \ + --hash=sha256:951088d12d339690a92cef2ec5d3cfd957692834c72ffd570ea76a6790222777 \ + --hash=sha256:95cf3b95ea665ab03f5a54765fa41abf0529dbaf372c3b83d91ad2cfa695779b \ + --hash=sha256:96619302d4374de5e2345b2b622dc481257a99431277662c30f606f3e22f42be \ + --hash=sha256:999928c6434372fde16c8f27143d3e97201160b48a614071261701615a2a156f \ + --hash=sha256:9a60e2bf9dc6afe7f743e7c9b149d1fdd6dbf35153c78fe3a14ae1a9aee3d98b \ + --hash=sha256:9f895d785eb6164678ff4bb5cc60c5996b3ee6df3edb28dcdeba86a13ea0465e \ + --hash=sha256:a2a9891723a735d3e2540651184be6fd5b96880c08ffe1a98bae5017e65b544b \ + --hash=sha256:a974231b4fdd1bb7f62064a0565a6b107d27d21d9acb50c484d2cdba515b9366 \ + --hash=sha256:aa0fd7248cf533c259e59dc593a60973a73e881162b1a2f73360547132742823 \ + --hash=sha256:acbfa31e315a8f14fe33e3542cbcafc55703b8f5dcbb7c1eecd30f141df50db3 \ + --hash=sha256:afb72325b74fa7a428c009c1b8be4b4d7c2afedafb2982827ef2156646df2fe1 \ + --hash=sha256:b3ef2c69c655db63deb96b3c3e587084612f9b1fa983df5e0c3379d41307467f \ + --hash=sha256:b52a65e4ea43c6d149c5f8ddb0bef8d4a1e779b77591a458a893eb416624a418 \ + --hash=sha256:b665caeeda58625c3946ad7308fbd88a086ee51ccb706307e5b1fa91556ac886 \ + --hash=sha256:b74fdffce9dfcf2dc296dec8743e5b0332d15df19ae464f0e249aa871fc1c571 \ + --hash=sha256:b995bfa6bf01a9e09b884077a6d37070464b529d8682d7691c2d3b540d357a0c \ + --hash=sha256:bd82010f8ab451dabe36054a1622870166a67cf3fce894f68895db6f74bbdc94 \ + --hash=sha256:bdcd5538e27f188dd3c804b4a8d5f52a7fc7f87e7fd6b374b8e36a4ca03db428 \ + --hash=sha256:c79d7719d027b7a42817c5d96461a99b6a49979c143839fc37aa5748c322f234 \ + --hash=sha256:cdab9555053399318b953a1fe1f586e945bc8d635ce9d05e617fd9fe3a4687d6 \ + --hash=sha256:ce72dba6a20e39a0c628258b5c308779b8697f7676c254a845715e2a1039b968 \ + --hash=sha256:d337193bbf3e45171c8025e291530fb7548a93c45253897cd764a6a71c937ed9 \ + --hash=sha256:d3dcb774e3568477275cc76554b5a565024b8ba3a0322f77c246bc7111c5bb9c \ + --hash=sha256:d64ba08db72e5dfd5c33be1e1e687d5e4fcce09219e8aee893a4862034081d4e \ + --hash=sha256:d7a2e3b7f5703ffbd500dabdefcbc9eafeff4b9444bbdd5d83d79eedf8428fab \ + --hash=sha256:d831ee0a50946d24a53821819b2327d5751b0c938b12c0653ea5be7dea9c82ec \ + --hash=sha256:d9018153cf57fc302a2a34cb7564870b859ed9a732d16b41a9b5cb2ebed2d444 \ + --hash=sha256:e5171ef898299c657685306d8e1478a45e9303ddcd8ac5fed5bd52ad4ae0b69b \ + --hash=sha256:e94e98c7cb94cfa6e071d401ea3342767f28eb5a06a58fafdc0d2a4974f4f35c \ + --hash=sha256:ec39698c45b11d9694a1b635a70946a5bad066b593af863460a8e600f0dff1ca \ + --hash=sha256:ed9aba6e01ff6f2e8285e5aa4154e2970068fe0fc0998c4380d0e6278222269b \ + --hash=sha256:edf71b01dec9f766fb285b73930f95f730bb0943500ba0566ae234b5c1618c18 \ + --hash=sha256:ee82c98bed9d97cd2f53bdb035e619309a098ea53ce525833e26b93f673bc318 \ + --hash=sha256:f4c96283fca3ee09fb044f02156d9570d156698bc3734252175a38f0e8975f07 \ + --hash=sha256:f7d9b87c4c55e3ea8881dfcbf6d61ea6775fffed1fedffaa60bd047d3c08c430 \ + --hash=sha256:f83df90191d67af5a831da3a33dd7628b02a95450e168785586ed51e6d28943c \ + --hash=sha256:fca9433a45f18b7c779d2bae7beeec4f740d28b788b117a48368d95a3233ed83 \ + --hash=sha256:fd92bbaa2ecdb7864b7600dcdb6f2f1db6e0346ed425fbd01085be04c63f0b05 # via uvicorn wcwidth==0.2.13 \ --hash=sha256:3da69048e4540d84af32131829ff948f1e022c1c6bdb8d6102117aac784f6859 \ @@ -2301,83 +2329,97 @@ webencodings==0.5.1 \ # cssselect2 # html5lib # tinycss2 -websockets==12.0 \ - --hash=sha256:00700340c6c7ab788f176d118775202aadea7602c5cc6be6ae127761c16d6b0b \ - --hash=sha256:0bee75f400895aef54157b36ed6d3b308fcab62e5260703add87f44cee9c82a6 \ - --hash=sha256:0e6e2711d5a8e6e482cacb927a49a3d432345dfe7dea8ace7b5790df5932e4df \ - --hash=sha256:12743ab88ab2af1d17dd4acb4645677cb7063ef4db93abffbf164218a5d54c6b \ - --hash=sha256:1a9d160fd080c6285e202327aba140fc9a0d910b09e423afff4ae5cbbf1c7205 \ - --hash=sha256:1bf386089178ea69d720f8db6199a0504a406209a0fc23e603b27b300fdd6892 \ - --hash=sha256:1df2fbd2c8a98d38a66f5238484405b8d1d16f929bb7a33ed73e4801222a6f53 \ - --hash=sha256:1e4b3f8ea6a9cfa8be8484c9221ec0257508e3a1ec43c36acdefb2a9c3b00aa2 \ - --hash=sha256:1f38a7b376117ef7aff996e737583172bdf535932c9ca021746573bce40165ed \ - --hash=sha256:23509452b3bc38e3a057382c2e941d5ac2e01e251acce7adc74011d7d8de434c \ - --hash=sha256:248d8e2446e13c1d4326e0a6a4e9629cb13a11195051a73acf414812700badbd \ - --hash=sha256:25eb766c8ad27da0f79420b2af4b85d29914ba0edf69f547cc4f06ca6f1d403b \ - --hash=sha256:27a5e9964ef509016759f2ef3f2c1e13f403725a5e6a1775555994966a66e931 \ - --hash=sha256:2c71bd45a777433dd9113847af751aae36e448bc6b8c361a566cb043eda6ec30 \ - --hash=sha256:2cb388a5bfb56df4d9a406783b7f9dbefb888c09b71629351cc6b036e9259370 \ - --hash=sha256:2d225bb6886591b1746b17c0573e29804619c8f755b5598d875bb4235ea639be \ - --hash=sha256:2e5fc14ec6ea568200ea4ef46545073da81900a2b67b3e666f04adf53ad452ec \ - --hash=sha256:363f57ca8bc8576195d0540c648aa58ac18cf85b76ad5202b9f976918f4219cf \ - --hash=sha256:3c6cc1360c10c17463aadd29dd3af332d4a1adaa8796f6b0e9f9df1fdb0bad62 \ - --hash=sha256:3d829f975fc2e527a3ef2f9c8f25e553eb7bc779c6665e8e1d52aa22800bb38b \ - --hash=sha256:3e3aa8c468af01d70332a382350ee95f6986db479ce7af14d5e81ec52aa2b402 \ - --hash=sha256:3f61726cae9f65b872502ff3c1496abc93ffbe31b278455c418492016e2afc8f \ - --hash=sha256:423fc1ed29f7512fceb727e2d2aecb952c46aa34895e9ed96071821309951123 \ - --hash=sha256:46e71dbbd12850224243f5d2aeec90f0aaa0f2dde5aeeb8fc8df21e04d99eff9 \ - --hash=sha256:4d87be612cbef86f994178d5186add3d94e9f31cc3cb499a0482b866ec477603 \ - --hash=sha256:5693ef74233122f8ebab026817b1b37fe25c411ecfca084b29bc7d6efc548f45 \ - --hash=sha256:5aa9348186d79a5f232115ed3fa9020eab66d6c3437d72f9d2c8ac0c6858c558 \ - --hash=sha256:5d873c7de42dea355d73f170be0f23788cf3fa9f7bed718fd2830eefedce01b4 \ - --hash=sha256:5f6ffe2c6598f7f7207eef9a1228b6f5c818f9f4d53ee920aacd35cec8110438 \ - --hash=sha256:604428d1b87edbf02b233e2c207d7d528460fa978f9e391bd8aaf9c8311de137 \ - --hash=sha256:6350b14a40c95ddd53e775dbdbbbc59b124a5c8ecd6fbb09c2e52029f7a9f480 \ - --hash=sha256:6e2df67b8014767d0f785baa98393725739287684b9f8d8a1001eb2839031447 \ - --hash=sha256:6e96f5ed1b83a8ddb07909b45bd94833b0710f738115751cdaa9da1fb0cb66e8 \ - --hash=sha256:6e9e7db18b4539a29cc5ad8c8b252738a30e2b13f033c2d6e9d0549b45841c04 \ - --hash=sha256:70ec754cc2a769bcd218ed8d7209055667b30860ffecb8633a834dde27d6307c \ - --hash=sha256:7b645f491f3c48d3f8a00d1fce07445fab7347fec54a3e65f0725d730d5b99cb \ - --hash=sha256:7fa3d25e81bfe6a89718e9791128398a50dec6d57faf23770787ff441d851967 \ - --hash=sha256:81df9cbcbb6c260de1e007e58c011bfebe2dafc8435107b0537f393dd38c8b1b \ - --hash=sha256:8572132c7be52632201a35f5e08348137f658e5ffd21f51f94572ca6c05ea81d \ - --hash=sha256:87b4aafed34653e465eb77b7c93ef058516cb5acf3eb21e42f33928616172def \ - --hash=sha256:8e332c210b14b57904869ca9f9bf4ca32f5427a03eeb625da9b616c85a3a506c \ - --hash=sha256:9893d1aa45a7f8b3bc4510f6ccf8db8c3b62120917af15e3de247f0780294b92 \ - --hash=sha256:9edf3fc590cc2ec20dc9d7a45108b5bbaf21c0d89f9fd3fd1685e223771dc0b2 \ - --hash=sha256:9fdf06fd06c32205a07e47328ab49c40fc1407cdec801d698a7c41167ea45113 \ - --hash=sha256:a02413bc474feda2849c59ed2dfb2cddb4cd3d2f03a2fedec51d6e959d9b608b \ - --hash=sha256:a1d9697f3337a89691e3bd8dc56dea45a6f6d975f92e7d5f773bc715c15dde28 \ - --hash=sha256:a571f035a47212288e3b3519944f6bf4ac7bc7553243e41eac50dd48552b6df7 \ - --hash=sha256:ab3d732ad50a4fbd04a4490ef08acd0517b6ae6b77eb967251f4c263011a990d \ - --hash=sha256:ae0a5da8f35a5be197f328d4727dbcfafa53d1824fac3d96cdd3a642fe09394f \ - --hash=sha256:b067cb952ce8bf40115f6c19f478dc71c5e719b7fbaa511359795dfd9d1a6468 \ - --hash=sha256:b2ee7288b85959797970114deae81ab41b731f19ebcd3bd499ae9ca0e3f1d2c8 \ - --hash=sha256:b81f90dcc6c85a9b7f29873beb56c94c85d6f0dac2ea8b60d995bd18bf3e2aae \ - --hash=sha256:ba0cab91b3956dfa9f512147860783a1829a8d905ee218a9837c18f683239611 \ - --hash=sha256:baa386875b70cbd81798fa9f71be689c1bf484f65fd6fb08d051a0ee4e79924d \ - --hash=sha256:bbe6013f9f791944ed31ca08b077e26249309639313fff132bfbf3ba105673b9 \ - --hash=sha256:bea88d71630c5900690fcb03161ab18f8f244805c59e2e0dc4ffadae0a7ee0ca \ - --hash=sha256:befe90632d66caaf72e8b2ed4d7f02b348913813c8b0a32fae1cc5fe3730902f \ - --hash=sha256:c3181df4583c4d3994d31fb235dc681d2aaad744fbdbf94c4802485ececdecf2 \ - --hash=sha256:c4e37d36f0d19f0a4413d3e18c0d03d0c268ada2061868c1e6f5ab1a6d575077 \ - --hash=sha256:c588f6abc13f78a67044c6b1273a99e1cf31038ad51815b3b016ce699f0d75c2 \ - --hash=sha256:cbe83a6bbdf207ff0541de01e11904827540aa069293696dd528a6640bd6a5f6 \ - --hash=sha256:d554236b2a2006e0ce16315c16eaa0d628dab009c33b63ea03f41c6107958374 \ - --hash=sha256:dbcf72a37f0b3316e993e13ecf32f10c0e1259c28ffd0a85cee26e8549595fbc \ - --hash=sha256:dc284bbc8d7c78a6c69e0c7325ab46ee5e40bb4d50e494d8131a07ef47500e9e \ - --hash=sha256:dff6cdf35e31d1315790149fee351f9e52978130cef6c87c4b6c9b3baf78bc53 \ - --hash=sha256:e469d01137942849cff40517c97a30a93ae79917752b34029f0ec72df6b46399 \ - --hash=sha256:eb809e816916a3b210bed3c82fb88eaf16e8afcf9c115ebb2bacede1797d2547 \ - --hash=sha256:ed2fcf7a07334c77fc8a230755c2209223a7cc44fc27597729b8ef5425aa61a3 \ - --hash=sha256:f44069528d45a933997a6fef143030d8ca8042f0dfaad753e2906398290e2870 \ - --hash=sha256:f764ba54e33daf20e167915edc443b6f88956f37fb606449b4a5b10ba42235a5 \ - --hash=sha256:fc4e7fa5414512b481a2483775a8e8be7803a35b30ca805afa4998a84f9fd9e8 \ - --hash=sha256:ffefa1374cd508d633646d51a8e9277763a9b78ae71324183693959cf94635a7 +websockets==13.0.1 \ + --hash=sha256:00fd961943b6c10ee6f0b1130753e50ac5dcd906130dcd77b0003c3ab797d026 \ + --hash=sha256:03d3f9ba172e0a53e37fa4e636b86cc60c3ab2cfee4935e66ed1d7acaa4625ad \ + --hash=sha256:0513c727fb8adffa6d9bf4a4463b2bade0186cbd8c3604ae5540fae18a90cb99 \ + --hash=sha256:05e70fec7c54aad4d71eae8e8cab50525e899791fc389ec6f77b95312e4e9920 \ + --hash=sha256:0617fd0b1d14309c7eab6ba5deae8a7179959861846cbc5cb528a7531c249448 \ + --hash=sha256:06c0a667e466fcb56a0886d924b5f29a7f0886199102f0a0e1c60a02a3751cb4 \ + --hash=sha256:0f52504023b1480d458adf496dc1c9e9811df4ba4752f0bc1f89ae92f4f07d0c \ + --hash=sha256:10a0dc7242215d794fb1918f69c6bb235f1f627aaf19e77f05336d147fce7c37 \ + --hash=sha256:11f9976ecbc530248cf162e359a92f37b7b282de88d1d194f2167b5e7ad80ce3 \ + --hash=sha256:132511bfd42e77d152c919147078460c88a795af16b50e42a0bd14f0ad71ddd2 \ + --hash=sha256:139add0f98206cb74109faf3611b7783ceafc928529c62b389917a037d4cfdf4 \ + --hash=sha256:14b9c006cac63772b31abbcd3e3abb6228233eec966bf062e89e7fa7ae0b7333 \ + --hash=sha256:15c7d62ee071fa94a2fc52c2b472fed4af258d43f9030479d9c4a2de885fd543 \ + --hash=sha256:165bedf13556f985a2aa064309baa01462aa79bf6112fbd068ae38993a0e1f1b \ + --hash=sha256:17118647c0ea14796364299e942c330d72acc4b248e07e639d34b75067b3cdd8 \ + --hash=sha256:1841c9082a3ba4a05ea824cf6d99570a6a2d8849ef0db16e9c826acb28089e8f \ + --hash=sha256:1a678532018e435396e37422a95e3ab87f75028ac79570ad11f5bf23cd2a7d8c \ + --hash=sha256:1ee4cc030a4bdab482a37462dbf3ffb7e09334d01dd37d1063be1136a0d825fa \ + --hash=sha256:1f3cf6d6ec1142412d4535adabc6bd72a63f5f148c43fe559f06298bc21953c9 \ + --hash=sha256:1f613289f4a94142f914aafad6c6c87903de78eae1e140fa769a7385fb232fdf \ + --hash=sha256:1fa082ea38d5de51dd409434edc27c0dcbd5fed2b09b9be982deb6f0508d25bc \ + --hash=sha256:249aab278810bee585cd0d4de2f08cfd67eed4fc75bde623be163798ed4db2eb \ + --hash=sha256:254ecf35572fca01a9f789a1d0f543898e222f7b69ecd7d5381d8d8047627bdb \ + --hash=sha256:2a02b0161c43cc9e0232711eff846569fad6ec836a7acab16b3cf97b2344c060 \ + --hash=sha256:30d3a1f041360f029765d8704eae606781e673e8918e6b2c792e0775de51352f \ + --hash=sha256:3624fd8664f2577cf8de996db3250662e259bfbc870dd8ebdcf5d7c6ac0b5185 \ + --hash=sha256:3f55b36d17ac50aa8a171b771e15fbe1561217510c8768af3d546f56c7576cdc \ + --hash=sha256:46af561eba6f9b0848b2c9d2427086cabadf14e0abdd9fde9d72d447df268418 \ + --hash=sha256:47236c13be337ef36546004ce8c5580f4b1150d9538b27bf8a5ad8edf23ccfab \ + --hash=sha256:4a365bcb7be554e6e1f9f3ed64016e67e2fa03d7b027a33e436aecf194febb63 \ + --hash=sha256:4d6ece65099411cfd9a48d13701d7438d9c34f479046b34c50ff60bb8834e43e \ + --hash=sha256:4e85f46ce287f5c52438bb3703d86162263afccf034a5ef13dbe4318e98d86e7 \ + --hash=sha256:4f0426d51c8f0926a4879390f53c7f5a855e42d68df95fff6032c82c888b5f36 \ + --hash=sha256:518f90e6dd089d34eaade01101fd8a990921c3ba18ebbe9b0165b46ebff947f0 \ + --hash=sha256:52aed6ef21a0f1a2a5e310fb5c42d7555e9c5855476bbd7173c3aa3d8a0302f2 \ + --hash=sha256:556e70e4f69be1082e6ef26dcb70efcd08d1850f5d6c5f4f2bcb4e397e68f01f \ + --hash=sha256:56a952fa2ae57a42ba7951e6b2605e08a24801a4931b5644dfc68939e041bc7f \ + --hash=sha256:59197afd478545b1f73367620407b0083303569c5f2d043afe5363676f2697c9 \ + --hash=sha256:5df891c86fe68b2c38da55b7aea7095beca105933c697d719f3f45f4220a5e0e \ + --hash=sha256:63848cdb6fcc0bf09d4a155464c46c64ffdb5807ede4fb251da2c2692559ce75 \ + --hash=sha256:64a11aae1de4c178fa653b07d90f2fb1a2ed31919a5ea2361a38760192e1858b \ + --hash=sha256:6724b554b70d6195ba19650fef5759ef11346f946c07dbbe390e039bcaa7cc3d \ + --hash=sha256:67494e95d6565bf395476e9d040037ff69c8b3fa356a886b21d8422ad86ae075 \ + --hash=sha256:67648f5e50231b5a7f6d83b32f9c525e319f0ddc841be0de64f24928cd75a603 \ + --hash=sha256:68264802399aed6fe9652e89761031acc734fc4c653137a5911c2bfa995d6d6d \ + --hash=sha256:699ba9dd6a926f82a277063603fc8d586b89f4cb128efc353b749b641fcddda7 \ + --hash=sha256:6aa74a45d4cdc028561a7d6ab3272c8b3018e23723100b12e58be9dfa5a24491 \ + --hash=sha256:6b41a1b3b561f1cba8321fb32987552a024a8f67f0d05f06fcf29f0090a1b956 \ + --hash=sha256:71e6e5a3a3728886caee9ab8752e8113670936a193284be9d6ad2176a137f376 \ + --hash=sha256:7d20516990d8ad557b5abeb48127b8b779b0b7e6771a265fa3e91767596d7d97 \ + --hash=sha256:80e4ba642fc87fa532bac07e5ed7e19d56940b6af6a8c61d4429be48718a380f \ + --hash=sha256:872afa52a9f4c414d6955c365b6588bc4401272c629ff8321a55f44e3f62b553 \ + --hash=sha256:8eb2b9a318542153674c6e377eb8cb9ca0fc011c04475110d3477862f15d29f0 \ + --hash=sha256:9bbc525f4be3e51b89b2a700f5746c2a6907d2e2ef4513a8daafc98198b92237 \ + --hash=sha256:a1a2e272d067030048e1fe41aa1ec8cfbbaabce733b3d634304fa2b19e5c897f \ + --hash=sha256:a5dc0c42ded1557cc7c3f0240b24129aefbad88af4f09346164349391dea8e58 \ + --hash=sha256:acab3539a027a85d568c2573291e864333ec9d912675107d6efceb7e2be5d980 \ + --hash=sha256:acbebec8cb3d4df6e2488fbf34702cbc37fc39ac7abf9449392cefb3305562e9 \ + --hash=sha256:ad327ac80ba7ee61da85383ca8822ff808ab5ada0e4a030d66703cc025b021c4 \ + --hash=sha256:b448a0690ef43db5ef31b3a0d9aea79043882b4632cfc3eaab20105edecf6097 \ + --hash=sha256:b5a06d7f60bc2fc378a333978470dfc4e1415ee52f5f0fce4f7853eb10c1e9df \ + --hash=sha256:b74593e9acf18ea5469c3edaa6b27fa7ecf97b30e9dabd5a94c4c940637ab96e \ + --hash=sha256:b79915a1179a91f6c5f04ece1e592e2e8a6bd245a0e45d12fd56b2b59e559a32 \ + --hash=sha256:b80f0c51681c517604152eb6a572f5a9378f877763231fddb883ba2f968e8817 \ + --hash=sha256:b8ac5b46fd798bbbf2ac6620e0437c36a202b08e1f827832c4bf050da081b501 \ + --hash=sha256:c3c493d0e5141ec055a7d6809a28ac2b88d5b878bb22df8c621ebe79a61123d0 \ + --hash=sha256:c44ca9ade59b2e376612df34e837013e2b273e6c92d7ed6636d0556b6f4db93d \ + --hash=sha256:c4a6343e3b0714e80da0b0893543bf9a5b5fa71b846ae640e56e9abc6fbc4c83 \ + --hash=sha256:c5870b4a11b77e4caa3937142b650fbbc0914a3e07a0cf3131f35c0587489c1c \ + --hash=sha256:ca48914cdd9f2ccd94deab5bcb5ac98025a5ddce98881e5cce762854a5de330b \ + --hash=sha256:cf2fae6d85e5dc384bf846f8243ddaa9197f3a1a70044f59399af001fd1f51d4 \ + --hash=sha256:d450f5a7a35662a9b91a64aefa852f0c0308ee256122f5218a42f1d13577d71e \ + --hash=sha256:d6716c087e4aa0b9260c4e579bb82e068f84faddb9bfba9906cb87726fa2e870 \ + --hash=sha256:d93572720d781331fb10d3da9ca1067817d84ad1e7c31466e9f5e59965618096 \ + --hash=sha256:dbb0b697cc0655719522406c059eae233abaa3243821cfdfab1215d02ac10231 \ + --hash=sha256:e33505534f3f673270dd67f81e73550b11de5b538c56fe04435d63c02c3f26b5 \ + --hash=sha256:e801ca2f448850685417d723ec70298feff3ce4ff687c6f20922c7474b4746ae \ + --hash=sha256:e82db3756ccb66266504f5a3de05ac6b32f287faacff72462612120074103329 \ + --hash=sha256:ef48e4137e8799998a343706531e656fdec6797b80efd029117edacb74b0a10a \ + --hash=sha256:f1d3d1f2eb79fe7b0fb02e599b2bf76a7619c79300fc55f0b5e2d382881d4f7f \ + --hash=sha256:f3fea72e4e6edb983908f0db373ae0732b275628901d909c382aae3b592589f2 \ + --hash=sha256:f40de079779acbcdbb6ed4c65af9f018f8b77c5ec4e17a4b737c05c2db554491 \ + --hash=sha256:f73e676a46b0fe9426612ce8caeca54c9073191a77c3e9d5c94697aef99296af \ + --hash=sha256:f9c9e258e3d5efe199ec23903f5da0eeaad58cf6fccb3547b74fd4750e5ac47a \ + --hash=sha256:fac2d146ff30d9dd2fcf917e5d147db037a5c573f0446c564f16f1f94cf87462 \ + --hash=sha256:faef9ec6354fe4f9a2c0bbb52fb1ff852effc897e2a4501e25eb3a47cb0a4f89 # via uvicorn -werkzeug==3.0.3 \ - --hash=sha256:097e5bfda9f0aba8da6b8545146def481d06aa7d3266e7448e2cccf67dd8bd18 \ - --hash=sha256:fc9645dc43e03e4d630d23143a04a7f947a9a3b5727cd535fdfe155a17cc48c8 +werkzeug==3.0.4 \ + --hash=sha256:02c9eb92b7d6c06f31a782811505d2157837cea66aaede3e217c7c27c039476c \ + --hash=sha256:34f2371506b250df4d4f84bfe7b0921e4762525762bbd936614909fe25cd7306 # via # flask # satosa From 271671feab8777823a7be0d3467227c487b46e06 Mon Sep 17 00:00:00 2001 From: Lasse Yledahl Date: Tue, 3 Sep 2024 11:58:42 +0000 Subject: [PATCH 03/28] remove unused imports --- src/eduid/common/models/bearer_token.py | 2 +- src/eduid/common/models/scim_invite.py | 5 ++--- src/eduid/maccapi/helpers.py | 2 +- src/eduid/maccapi/testing.py | 3 +-- src/eduid/maccapi/util.py | 2 -- src/eduid/scimapi/models/event.py | 1 - src/eduid/userdb/tests/test_app_user.py | 1 - src/eduid/userdb/tests/test_async_db.py | 7 ++----- src/eduid/userdb/tests/test_event.py | 2 +- src/eduid/userdb/tests/test_identities.py | 1 - src/eduid/userdb/tests/test_logs.py | 1 - src/eduid/userdb/tests/test_u2f.py | 2 +- src/eduid/userdb/user_cleaner/db.py | 5 +---- src/eduid/userdb/userdb.py | 1 - src/eduid/webapp/bankid/tests/test_app.py | 2 +- src/eduid/webapp/common/api/captcha.py | 1 - src/eduid/webapp/eidas/tests/test_app.py | 4 ++-- src/eduid/webapp/jsconfig/settings/jsapps.py | 2 +- src/eduid/webapp/ladok/client.py | 2 +- src/eduid/webapp/letter_proofing/pdf.py | 1 - src/eduid/webapp/signup/views.py | 3 +-- src/eduid/webapp/support/helpers.py | 1 - src/eduid/workers/job_runner/context.py | 1 - src/eduid/workers/job_runner/status.py | 2 +- src/eduid/workers/job_runner/testing.py | 5 ----- src/eduid/workers/job_runner/tests/test_user_cleaner.py | 1 - 26 files changed, 17 insertions(+), 43 deletions(-) diff --git a/src/eduid/common/models/bearer_token.py b/src/eduid/common/models/bearer_token.py index d6bdfdc49..f50365733 100644 --- a/src/eduid/common/models/bearer_token.py +++ b/src/eduid/common/models/bearer_token.py @@ -3,7 +3,7 @@ from enum import Enum from typing import Any, Mapping, Optional -from pydantic import BaseModel, Field, StrictInt, field_validator, model_validator, validator +from pydantic import BaseModel, Field, StrictInt, field_validator, model_validator from pydantic_core.core_schema import ValidationInfo from eduid.common.config.base import AuthnBearerTokenConfig, DataOwnerName, ScopeName diff --git a/src/eduid/common/models/scim_invite.py b/src/eduid/common/models/scim_invite.py index c6b054351..dda913414 100644 --- a/src/eduid/common/models/scim_invite.py +++ b/src/eduid/common/models/scim_invite.py @@ -1,8 +1,7 @@ -from datetime import datetime -from typing import Any, Optional +from typing import Optional from uuid import UUID -from pydantic import Field, model_validator, root_validator +from pydantic import Field, model_validator from typing_extensions import Self from eduid.common.models.scim_base import ( diff --git a/src/eduid/maccapi/helpers.py b/src/eduid/maccapi/helpers.py index 0dc3f40ad..90e9205a7 100644 --- a/src/eduid/maccapi/helpers.py +++ b/src/eduid/maccapi/helpers.py @@ -10,7 +10,7 @@ from eduid.userdb.exceptions import UserDoesNotExist, UserOutOfSync from eduid.userdb.logs.element import ManagedAccountLogElement from eduid.userdb.maccapi import ManagedAccount -from eduid.vccs.client import VCCSClient, VCCSClientHTTPError, VCCSPasswordFactor, VCCSRevokeFactor +from eduid.vccs.client import VCCSClientHTTPError, VCCSPasswordFactor, VCCSRevokeFactor class UnableToCreateUniqueEppn(Exception): diff --git a/src/eduid/maccapi/testing.py b/src/eduid/maccapi/testing.py index 0c61a8dce..69471014f 100644 --- a/src/eduid/maccapi/testing.py +++ b/src/eduid/maccapi/testing.py @@ -1,6 +1,6 @@ import os import unittest -from typing import Any, Optional, cast +from typing import Any, cast import pkg_resources from starlette.testclient import TestClient @@ -9,7 +9,6 @@ from eduid.maccapi.app import init_api from eduid.maccapi.config import MAccApiConfig from eduid.maccapi.context import Context -from eduid.userdb.maccapi import ManagedAccount from eduid.userdb.testing import MongoTemporaryInstance from eduid.vccs.client import VCCSClient from eduid.webapp.common.authn.testing import MockVCCSClient diff --git a/src/eduid/maccapi/util.py b/src/eduid/maccapi/util.py index f3bdc77c6..4c427370d 100644 --- a/src/eduid/maccapi/util.py +++ b/src/eduid/maccapi/util.py @@ -1,9 +1,7 @@ import logging import math -from uuid import uuid4 from jwcrypto import jwk -from pwgen import pwgen from eduid.common.config.exceptions import BadConfiguration from eduid.maccapi.config import MAccApiConfig diff --git a/src/eduid/scimapi/models/event.py b/src/eduid/scimapi/models/event.py index b9ed127a6..5a634a7ea 100644 --- a/src/eduid/scimapi/models/event.py +++ b/src/eduid/scimapi/models/event.py @@ -1,4 +1,3 @@ -from datetime import datetime from typing import Any, Optional from uuid import UUID diff --git a/src/eduid/userdb/tests/test_app_user.py b/src/eduid/userdb/tests/test_app_user.py index c784eea8a..155d70325 100644 --- a/src/eduid/userdb/tests/test_app_user.py +++ b/src/eduid/userdb/tests/test_app_user.py @@ -4,7 +4,6 @@ from pydantic import ValidationError from eduid.userdb import User -from eduid.userdb.credentials import CredentialList from eduid.userdb.db import TUserDbDocument from eduid.userdb.fixtures.users import UserFixtures diff --git a/src/eduid/userdb/tests/test_async_db.py b/src/eduid/userdb/tests/test_async_db.py index 450b31cfc..24b891b10 100644 --- a/src/eduid/userdb/tests/test_async_db.py +++ b/src/eduid/userdb/tests/test_async_db.py @@ -1,12 +1,9 @@ -from unittest import IsolatedAsyncioTestCase, TestCase +from unittest import IsolatedAsyncioTestCase from unittest.mock import patch -from bson import ObjectId from eduid.userdb.db.async_db import AsyncBaseDB, AsyncMongoDB -from eduid.userdb.fixtures.users import UserFixtures -from eduid.userdb.identity import IdentityType -from eduid.userdb.testing import AsyncMongoTestCase, MongoTestCase +from eduid.userdb.testing import AsyncMongoTestCase class TestAsyncMongoDB(IsolatedAsyncioTestCase): diff --git a/src/eduid/userdb/tests/test_event.py b/src/eduid/userdb/tests/test_event.py index 2f050fe63..8dfa05196 100644 --- a/src/eduid/userdb/tests/test_event.py +++ b/src/eduid/userdb/tests/test_event.py @@ -1,7 +1,7 @@ from __future__ import annotations from copy import deepcopy -from datetime import datetime, timezone +from datetime import datetime from typing import Any from unittest import TestCase diff --git a/src/eduid/userdb/tests/test_identities.py b/src/eduid/userdb/tests/test_identities.py index fb58f029e..31da98eeb 100644 --- a/src/eduid/userdb/tests/test_identities.py +++ b/src/eduid/userdb/tests/test_identities.py @@ -1,4 +1,3 @@ -import copy import datetime import unittest from unittest import TestCase diff --git a/src/eduid/userdb/tests/test_logs.py b/src/eduid/userdb/tests/test_logs.py index b27721c10..f8145a220 100644 --- a/src/eduid/userdb/tests/test_logs.py +++ b/src/eduid/userdb/tests/test_logs.py @@ -1,4 +1,3 @@ -import unittest from unittest import TestCase import pytest diff --git a/src/eduid/userdb/tests/test_u2f.py b/src/eduid/userdb/tests/test_u2f.py index 146546646..db9108803 100644 --- a/src/eduid/userdb/tests/test_u2f.py +++ b/src/eduid/userdb/tests/test_u2f.py @@ -7,7 +7,7 @@ from pydantic import ValidationError from eduid.common.testing_base import normalised_data -from eduid.userdb.credentials import U2F, Credential, CredentialList, CredentialProofingMethod +from eduid.userdb.credentials import U2F, CredentialList, CredentialProofingMethod __author__ = "lundberg" diff --git a/src/eduid/userdb/user_cleaner/db.py b/src/eduid/userdb/user_cleaner/db.py index 5dcf31339..41e72fcb8 100644 --- a/src/eduid/userdb/user_cleaner/db.py +++ b/src/eduid/userdb/user_cleaner/db.py @@ -1,15 +1,12 @@ import logging -from datetime import datetime -from enum import Enum from typing import Optional import pymongo from eduid.userdb.db.base import TUserDbDocument -from eduid.userdb.identity import IdentityType from eduid.userdb.meta import CleanerType from eduid.userdb.user import User -from eduid.userdb.userdb import UserDB, UserVar +from eduid.userdb.userdb import UserDB logger = logging.getLogger(__name__) diff --git a/src/eduid/userdb/userdb.py b/src/eduid/userdb/userdb.py index a235a866f..228c4b9d4 100644 --- a/src/eduid/userdb/userdb.py +++ b/src/eduid/userdb/userdb.py @@ -3,7 +3,6 @@ from dataclasses import dataclass from typing import Any, Generic, Mapping, Optional, TypeVar, Union -import pymongo from bson import ObjectId from bson.errors import InvalidId from pymongo import ReturnDocument diff --git a/src/eduid/webapp/bankid/tests/test_app.py b/src/eduid/webapp/bankid/tests/test_app.py index db9fa8e48..d33823dae 100644 --- a/src/eduid/webapp/bankid/tests/test_app.py +++ b/src/eduid/webapp/bankid/tests/test_app.py @@ -19,7 +19,7 @@ from eduid.webapp.bankid.helpers import BankIDMsg from eduid.webapp.common.api.messages import AuthnStatusMsg, TranslatableMsg from eduid.webapp.common.api.testing import CSRFTestClient -from eduid.webapp.common.authn.acs_enums import AuthnAcsAction, BankIDAcsAction +from eduid.webapp.common.authn.acs_enums import AuthnAcsAction from eduid.webapp.common.authn.cache import OutstandingQueriesCache from eduid.webapp.common.proofing.messages import ProofingMsg from eduid.webapp.common.proofing.testing import ProofingTests diff --git a/src/eduid/webapp/common/api/captcha.py b/src/eduid/webapp/common/api/captcha.py index 48e9ab86b..f084f5605 100644 --- a/src/eduid/webapp/common/api/captcha.py +++ b/src/eduid/webapp/common/api/captcha.py @@ -7,7 +7,6 @@ from eduid.common.config.base import CaptchaConfigMixin from eduid.common.config.exceptions import BadConfiguration -from eduid.webapp.common.api.app import TEduIDBaseAppSubclass __author__ = "lundberg" diff --git a/src/eduid/webapp/eidas/tests/test_app.py b/src/eduid/webapp/eidas/tests/test_app.py index 7a205eb3b..4cb6da88f 100644 --- a/src/eduid/webapp/eidas/tests/test_app.py +++ b/src/eduid/webapp/eidas/tests/test_app.py @@ -8,7 +8,7 @@ from fido2.webauthn import AuthenticatorAttachment -from eduid.common.config.base import AuthnParameters, EduidEnvironment, FrontendAction +from eduid.common.config.base import EduidEnvironment, FrontendAction from eduid.common.misc.timeutil import utc_now from eduid.userdb import NinIdentity from eduid.userdb.credentials import U2F, Webauthn @@ -17,7 +17,7 @@ from eduid.userdb.identity import EIDASIdentity, EIDASLoa, IdentityProofingMethod, PridPersistence from eduid.webapp.common.api.messages import AuthnStatusMsg, CommonMsg, TranslatableMsg, redirect_with_msg from eduid.webapp.common.api.testing import CSRFTestClient -from eduid.webapp.common.authn.acs_enums import AuthnAcsAction, EidasAcsAction +from eduid.webapp.common.authn.acs_enums import AuthnAcsAction from eduid.webapp.common.authn.cache import OutstandingQueriesCache from eduid.webapp.common.proofing.messages import ProofingMsg from eduid.webapp.common.proofing.testing import ProofingTests diff --git a/src/eduid/webapp/jsconfig/settings/jsapps.py b/src/eduid/webapp/jsconfig/settings/jsapps.py index 09ac6ab3b..b3e906f59 100644 --- a/src/eduid/webapp/jsconfig/settings/jsapps.py +++ b/src/eduid/webapp/jsconfig/settings/jsapps.py @@ -3,7 +3,7 @@ from pydantic import Field from eduid.common.config.base import EduidEnvironment, PasswordConfigMixin -from eduid.common.models.generic import AnyUrlStr, HttpUrlStr +from eduid.common.models.generic import HttpUrlStr class JsAppsConfig(PasswordConfigMixin): diff --git a/src/eduid/webapp/ladok/client.py b/src/eduid/webapp/ladok/client.py index 48db01c6f..746979eab 100644 --- a/src/eduid/webapp/ladok/client.py +++ b/src/eduid/webapp/ladok/client.py @@ -3,7 +3,7 @@ from typing import Mapping, Optional import requests -from pydantic import AnyHttpUrl, BaseModel, ConfigDict, Field, ValidationError +from pydantic import BaseModel, ConfigDict, Field, ValidationError __author__ = "lundberg" diff --git a/src/eduid/webapp/letter_proofing/pdf.py b/src/eduid/webapp/letter_proofing/pdf.py index b17013456..b9cb14313 100644 --- a/src/eduid/webapp/letter_proofing/pdf.py +++ b/src/eduid/webapp/letter_proofing/pdf.py @@ -1,5 +1,4 @@ import logging -from collections import OrderedDict from datetime import datetime, timedelta from io import BytesIO, StringIO from pathlib import Path diff --git a/src/eduid/webapp/signup/views.py b/src/eduid/webapp/signup/views.py index 31b68871e..91e952ca2 100644 --- a/src/eduid/webapp/signup/views.py +++ b/src/eduid/webapp/signup/views.py @@ -12,8 +12,7 @@ from eduid.webapp.common.api.helpers import check_magic_cookie from eduid.webapp.common.api.messages import CommonMsg, FluxData, error_response, success_response from eduid.webapp.common.api.schemas.csrf import EmptyRequest -from eduid.webapp.common.api.utils import get_zxcvbn_terms, make_short_code -from eduid.webapp.common.api.validation import is_valid_password +from eduid.webapp.common.api.utils import make_short_code from eduid.webapp.common.session import session from eduid.webapp.signup.app import current_signup_app as current_app from eduid.webapp.signup.helpers import ( diff --git a/src/eduid/webapp/support/helpers.py b/src/eduid/webapp/support/helpers.py index b47ace1e7..1334d06f1 100644 --- a/src/eduid/webapp/support/helpers.py +++ b/src/eduid/webapp/support/helpers.py @@ -4,7 +4,6 @@ from flask import abort from eduid.userdb import User -from eduid.userdb.credentials import Credential from eduid.userdb.db import TUserDbDocument from eduid.webapp.common.api.utils import get_user from eduid.webapp.support.app import current_support_app as current_app diff --git a/src/eduid/workers/job_runner/context.py b/src/eduid/workers/job_runner/context.py index babf359ac..b43ec8d98 100644 --- a/src/eduid/workers/job_runner/context.py +++ b/src/eduid/workers/job_runner/context.py @@ -1,7 +1,6 @@ import logging from os import environ -from eduid.common.clients.amapi_client.amapi_client import AMAPIClient from eduid.common.fastapi.log import init_logging from eduid.common.rpc.am_relay import AmRelay from eduid.common.rpc.msg_relay import MsgRelay diff --git a/src/eduid/workers/job_runner/status.py b/src/eduid/workers/job_runner/status.py index 1249ae7e9..7cc7a0642 100644 --- a/src/eduid/workers/job_runner/status.py +++ b/src/eduid/workers/job_runner/status.py @@ -1,7 +1,7 @@ from os import environ from typing import Mapping -from fastapi import APIRouter, Request, Response +from fastapi import APIRouter, Response from pydantic import BaseModel from eduid.common.fastapi.context_request import ContextRequest, ContextRequestRoute diff --git a/src/eduid/workers/job_runner/testing.py b/src/eduid/workers/job_runner/testing.py index 818898256..8513fc76a 100644 --- a/src/eduid/workers/job_runner/testing.py +++ b/src/eduid/workers/job_runner/testing.py @@ -1,15 +1,10 @@ import os import unittest -from typing import Any import pkg_resources -from jwcrypto.jwk import JWK -from eduid.common.config.parsers import load_config from eduid.userdb.testing import MongoTemporaryInstance from eduid.userdb.user_cleaner.db import CleanerQueueDB -from eduid.workers.job_runner.config import JobRunnerConfig -from eduid.workers.job_runner.context import Context class BaseDBTestCase(unittest.TestCase): diff --git a/src/eduid/workers/job_runner/tests/test_user_cleaner.py b/src/eduid/workers/job_runner/tests/test_user_cleaner.py index 7cb4abf4b..65c71b31e 100644 --- a/src/eduid/workers/job_runner/tests/test_user_cleaner.py +++ b/src/eduid/workers/job_runner/tests/test_user_cleaner.py @@ -1,4 +1,3 @@ -import time from eduid.userdb.fixtures.users import UserFixtures from eduid.userdb.meta import CleanerType From 7e44385d2f26d2a2b160d5af17d1fef7161f343d Mon Sep 17 00:00:00 2001 From: Lasse Yledahl Date: Tue, 3 Sep 2024 13:51:13 +0000 Subject: [PATCH 04/28] remove superfluous import statements --- src/eduid/userdb/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/eduid/userdb/__init__.py b/src/eduid/userdb/__init__.py index 0e09799be..6dc781e20 100644 --- a/src/eduid/userdb/__init__.py +++ b/src/eduid/userdb/__init__.py @@ -11,9 +11,9 @@ __license__ = "BSD" __authors__ = ["Fredrik Thulin"] -import eduid.userdb.exceptions -import eduid.userdb.mail -import eduid.userdb.phone +#import eduid.userdb.exceptions +#import eduid.userdb.mail +#import eduid.userdb.phone from eduid.userdb.db import MongoDB from eduid.userdb.event import EventList from eduid.userdb.identity import EIDASIdentity, NinIdentity, SvipeIdentity From e6adae19252d7424ce320b8bf3bf6bf26086c3bd Mon Sep 17 00:00:00 2001 From: Lasse Yledahl Date: Tue, 3 Sep 2024 13:52:51 +0000 Subject: [PATCH 05/28] add explicit re-export --- src/eduid/common/clients/__init__.py | 2 ++ .../common/clients/gnap_client/__init__.py | 2 ++ .../common/clients/scim_client/__init__.py | 2 ++ src/eduid/graphdb/__init__.py | 5 ++++ src/eduid/graphdb/groupdb/__init__.py | 6 +++++ src/eduid/queue/db/__init__.py | 9 +++++++ src/eduid/queue/db/message/__init__.py | 6 +++++ src/eduid/userdb/__init__.py | 20 ++++++++++++++ src/eduid/userdb/actions/tou/__init__.py | 5 ++++ src/eduid/userdb/credentials/__init__.py | 10 +++++++ src/eduid/userdb/db/__init__.py | 7 +++++ src/eduid/userdb/group_management/__init__.py | 6 +++++ src/eduid/userdb/idp/__init__.py | 5 ++++ src/eduid/userdb/logs/__init__.py | 14 ++++++++++ src/eduid/userdb/maccapi/__init__.py | 5 ++++ src/eduid/userdb/personal_data/__init__.py | 5 ++++ src/eduid/userdb/proofing/__init__.py | 27 +++++++++++++++++++ src/eduid/userdb/reset_password/__init__.py | 9 +++++++ src/eduid/userdb/scimapi/__init__.py | 19 +++++++++++++ src/eduid/userdb/security/__init__.py | 9 +++++++ src/eduid/userdb/signup/__init__.py | 11 ++++++++ src/eduid/userdb/support/__init__.py | 10 +++++++ 22 files changed, 194 insertions(+) diff --git a/src/eduid/common/clients/__init__.py b/src/eduid/common/clients/__init__.py index 4102c0758..7dd30ac4a 100644 --- a/src/eduid/common/clients/__init__.py +++ b/src/eduid/common/clients/__init__.py @@ -2,3 +2,5 @@ from eduid.common.clients.gnap_client import AsyncGNAPClient, GNAPClient from eduid.common.clients.scim_client import SCIMClient + +__all__ = ['AsyncGNAPClient', 'GNAPClient', 'SCIMClient'] diff --git a/src/eduid/common/clients/gnap_client/__init__.py b/src/eduid/common/clients/gnap_client/__init__.py index d70170a96..b07269f80 100644 --- a/src/eduid/common/clients/gnap_client/__init__.py +++ b/src/eduid/common/clients/gnap_client/__init__.py @@ -2,3 +2,5 @@ from eduid.common.clients.gnap_client.async_client import AsyncGNAPClient from eduid.common.clients.gnap_client.sync_client import GNAPClient + +__all__ = ['GNAPClient', 'AsyncGNAPClient'] diff --git a/src/eduid/common/clients/scim_client/__init__.py b/src/eduid/common/clients/scim_client/__init__.py index 916da0e77..4162a376c 100644 --- a/src/eduid/common/clients/scim_client/__init__.py +++ b/src/eduid/common/clients/scim_client/__init__.py @@ -1,3 +1,5 @@ __author__ = "lundberg" from eduid.common.clients.scim_client.scim_client import SCIMClient + +__all__ = ['SCIMClient'] diff --git a/src/eduid/graphdb/__init__.py b/src/eduid/graphdb/__init__.py index 2ccd181f2..84b5b69a2 100644 --- a/src/eduid/graphdb/__init__.py +++ b/src/eduid/graphdb/__init__.py @@ -1,3 +1,8 @@ from eduid.graphdb.db import BaseGraphDB, Neo4jDB +__all__ = [ + 'BaseGraphDB', + 'Neo4jDB', +] + __author__ = "lundberg" diff --git a/src/eduid/graphdb/groupdb/__init__.py b/src/eduid/graphdb/groupdb/__init__.py index f22cbd21a..bc6f720bc 100644 --- a/src/eduid/graphdb/groupdb/__init__.py +++ b/src/eduid/graphdb/groupdb/__init__.py @@ -2,4 +2,10 @@ from eduid.graphdb.groupdb.group import Group from eduid.graphdb.groupdb.user import User +__all__ = [ + 'GroupDB', + 'Group', + 'User', +] + __author__ = "lundberg" diff --git a/src/eduid/queue/db/__init__.py b/src/eduid/queue/db/__init__.py index 4b3a46234..57e0c3f59 100644 --- a/src/eduid/queue/db/__init__.py +++ b/src/eduid/queue/db/__init__.py @@ -2,4 +2,13 @@ from eduid.queue.db.payload import Payload, RawPayload, TestPayload from eduid.queue.db.queue_item import QueueItem, SenderInfo +__all__ = [ + 'QueueDB', + 'Payload', + 'RawPayload', + 'TestPayload', + 'QueueItem', + 'SenderInfo', +] + __author__ = "lundberg" diff --git a/src/eduid/queue/db/message/__init__.py b/src/eduid/queue/db/message/__init__.py index 99a30b196..41536ddd1 100644 --- a/src/eduid/queue/db/message/__init__.py +++ b/src/eduid/queue/db/message/__init__.py @@ -1,4 +1,10 @@ from eduid.queue.db.message.db import MessageDB from eduid.queue.db.message.payload import EduidInviteEmail, EduidSignupEmail +__all__ = [ + 'MessageDB', + 'EduidInviteEmail', + 'EduidSignupEmail', +] + __author__ = "lundberg" diff --git a/src/eduid/userdb/__init__.py b/src/eduid/userdb/__init__.py index 6dc781e20..1b1756a26 100644 --- a/src/eduid/userdb/__init__.py +++ b/src/eduid/userdb/__init__.py @@ -26,3 +26,23 @@ from eduid.userdb.tou import ToUEvent from eduid.userdb.user import User from eduid.userdb.userdb import AmDB, UserDB + +__all__ = [ + 'User', + 'UserDB', + 'AmDB', + 'EventList', + 'ToUEvent', + 'Profile', + 'Nin', + 'NinIdentity', + 'SvipeIdentity', + 'EIDASIdentity', + 'MailAddress', + 'PhoneNumber', + 'OidcIdToken', + 'OidcAuthorization', + 'Orcid', + 'LockedIdentityList', + 'MongoDB', +] \ No newline at end of file diff --git a/src/eduid/userdb/actions/tou/__init__.py b/src/eduid/userdb/actions/tou/__init__.py index a6f372a41..203b439ae 100644 --- a/src/eduid/userdb/actions/tou/__init__.py +++ b/src/eduid/userdb/actions/tou/__init__.py @@ -2,3 +2,8 @@ from .user import ToUUser from .userdb import ToUUserDB + +__all__ = [ + "ToUUser", + "ToUUserDB", +] \ No newline at end of file diff --git a/src/eduid/userdb/credentials/__init__.py b/src/eduid/userdb/credentials/__init__.py index ea9a4f616..182f70615 100644 --- a/src/eduid/userdb/credentials/__init__.py +++ b/src/eduid/userdb/credentials/__init__.py @@ -2,3 +2,13 @@ from eduid.userdb.credentials.fido import U2F, FidoCredential, Webauthn from eduid.userdb.credentials.list import CredentialList from eduid.userdb.credentials.password import Password + +__all__ = [ + 'Credential', + 'CredentialList', + 'Password', + 'U2F', + 'FidoCredential', + 'Webauthn', + 'CredentialProofingMethod', +] \ No newline at end of file diff --git a/src/eduid/userdb/db/__init__.py b/src/eduid/userdb/db/__init__.py index a1409858d..8bbb0f42e 100644 --- a/src/eduid/userdb/db/__init__.py +++ b/src/eduid/userdb/db/__init__.py @@ -2,3 +2,10 @@ # Keep existing imports working from eduid.userdb.db.sync_db import BaseDB, MongoDB, SaveResult, TUserDbDocument + +__all__ = [ + 'BaseDB', + 'MongoDB', + 'SaveResult', + 'TUserDbDocument', +] \ No newline at end of file diff --git a/src/eduid/userdb/group_management/__init__.py b/src/eduid/userdb/group_management/__init__.py index 52885bd64..7575a86e4 100644 --- a/src/eduid/userdb/group_management/__init__.py +++ b/src/eduid/userdb/group_management/__init__.py @@ -1,4 +1,10 @@ from eduid.userdb.group_management.db import GroupManagementInviteStateDB from eduid.userdb.group_management.state import GroupInviteState, GroupRole +__all__ = [ + 'GroupManagementInviteStateDB', + 'GroupInviteState', + 'GroupRole', +] + __author__ = "lundberg" diff --git a/src/eduid/userdb/idp/__init__.py b/src/eduid/userdb/idp/__init__.py index 24a99e3b7..067c188a1 100644 --- a/src/eduid/userdb/idp/__init__.py +++ b/src/eduid/userdb/idp/__init__.py @@ -1,2 +1,7 @@ from .db import IdPUserDb from .user import IdPUser + +__all__ = [ + 'IdPUser', + 'IdPUserDb', +] \ No newline at end of file diff --git a/src/eduid/userdb/logs/__init__.py b/src/eduid/userdb/logs/__init__.py index d347208e7..110640706 100644 --- a/src/eduid/userdb/logs/__init__.py +++ b/src/eduid/userdb/logs/__init__.py @@ -12,4 +12,18 @@ TeleAdressProofingRelation, ) +__all__ = [ + 'ProofingLog', + 'LetterProofing', + 'MailAddressProofing', + 'MFATokenProofing', + 'OrcidProofing', + 'PhoneNumberProofing', + 'SeLegProofing', + 'SeLegProofingFrejaEid', + 'SwedenConnectProofing', + 'TeleAdressProofing', + 'TeleAdressProofingRelation', +] + __author__ = "lundberg" diff --git a/src/eduid/userdb/maccapi/__init__.py b/src/eduid/userdb/maccapi/__init__.py index 36561cd4e..229fe743d 100644 --- a/src/eduid/userdb/maccapi/__init__.py +++ b/src/eduid/userdb/maccapi/__init__.py @@ -1 +1,6 @@ from eduid.userdb.maccapi.userdb import ManagedAccount, ManagedAccountDB + +__all__ = [ + 'ManagedAccount', + 'ManagedAccountDB', +] \ No newline at end of file diff --git a/src/eduid/userdb/personal_data/__init__.py b/src/eduid/userdb/personal_data/__init__.py index 09c900efd..61ed1ddda 100644 --- a/src/eduid/userdb/personal_data/__init__.py +++ b/src/eduid/userdb/personal_data/__init__.py @@ -1,4 +1,9 @@ from eduid.userdb.personal_data.db import PersonalDataUserDB from eduid.userdb.personal_data.user import PersonalDataUser +__all__ = [ + 'PersonalDataUserDB', + 'PersonalDataUser', +] + __author__ = "lundberg" diff --git a/src/eduid/userdb/proofing/__init__.py b/src/eduid/userdb/proofing/__init__.py index 2e56e1486..9509e6145 100644 --- a/src/eduid/userdb/proofing/__init__.py +++ b/src/eduid/userdb/proofing/__init__.py @@ -12,6 +12,9 @@ PhoneProofingStateDB, PhoneProofingUserDB, ) + + + from eduid.userdb.proofing.element import EmailProofingElement, NinProofingElement, PhoneProofingElement from eduid.userdb.proofing.state import ( EmailProofingState, @@ -21,3 +24,27 @@ PhoneProofingState, ) from eduid.userdb.proofing.user import ProofingUser + +__all__ = [ + 'EidasProofingUserDB', + 'EmailProofingStateDB', + 'EmailProofingUserDB', + 'LetterProofingStateDB', + 'LetterProofingUserDB', + 'LookupMobileProofingUserDB', + 'OidcProofingStateDB', + 'OidcProofingUserDB', + 'OrcidProofingStateDB', + 'OrcidProofingUserDB', + 'PhoneProofingStateDB', + 'PhoneProofingUserDB', + 'ProofingUser', + 'LetterProofingState', + 'EmailProofingState', + 'OidcProofingState', + 'OrcidProofingState', + 'PhoneProofingState', + 'EmailProofingElement', + 'NinProofingElement', + 'PhoneProofingElement', +] diff --git a/src/eduid/userdb/reset_password/__init__.py b/src/eduid/userdb/reset_password/__init__.py index b4bbf3634..de52039b0 100644 --- a/src/eduid/userdb/reset_password/__init__.py +++ b/src/eduid/userdb/reset_password/__init__.py @@ -5,3 +5,12 @@ ResetPasswordState, ) from eduid.userdb.reset_password.user import ResetPasswordUser + +__all__ = [ + 'ResetPasswordStateDB', + 'ResetPasswordUserDB', + 'ResetPasswordState', + 'ResetPasswordEmailState', + 'ResetPasswordEmailAndPhoneState', + 'ResetPasswordUser', +] diff --git a/src/eduid/userdb/scimapi/__init__.py b/src/eduid/userdb/scimapi/__init__.py index 58d5f7047..c4211978a 100644 --- a/src/eduid/userdb/scimapi/__init__.py +++ b/src/eduid/userdb/scimapi/__init__.py @@ -17,3 +17,22 @@ ) from eduid.userdb.scimapi.groupdb import GroupExtensions, ScimApiGroup, ScimApiGroupDB from eduid.userdb.scimapi.userdb import ScimApiUser, ScimApiUserDB + +__all__ = [ + 'ScimApiUser', + 'ScimApiUserDB', + 'ScimApiGroup', + 'ScimApiGroupDB', + 'ScimApiEvent', + 'ScimApiEventDB', + 'ScimApiEventResource', + 'ScimApiResourceBase', + 'ScimApiName', + 'ScimApiEmail', + 'ScimApiPhoneNumber', + 'ScimApiProfile', + 'ScimApiLinkedAccount', + 'EventLevel', + 'EventStatus', + 'GroupExtensions', +] \ No newline at end of file diff --git a/src/eduid/userdb/security/__init__.py b/src/eduid/userdb/security/__init__.py index 5416ea575..6939bdb45 100644 --- a/src/eduid/userdb/security/__init__.py +++ b/src/eduid/userdb/security/__init__.py @@ -2,4 +2,13 @@ from eduid.userdb.security.state import PasswordResetEmailAndPhoneState, PasswordResetEmailState, PasswordResetState from eduid.userdb.security.user import SecurityUser +__all__ = [ + 'PasswordResetState', + 'PasswordResetEmailState', + 'PasswordResetEmailAndPhoneState', + 'PasswordResetStateDB', + 'SecurityUser', + 'SecurityUserDB', +] + __author__ = "lundberg" diff --git a/src/eduid/userdb/signup/__init__.py b/src/eduid/userdb/signup/__init__.py index 7765fd71a..b08a8fca6 100644 --- a/src/eduid/userdb/signup/__init__.py +++ b/src/eduid/userdb/signup/__init__.py @@ -2,3 +2,14 @@ from eduid.userdb.signup.invitedb import SignupInviteDB from eduid.userdb.signup.user import SignupUser from eduid.userdb.signup.userdb import SignupUserDB + +__all__ = [ + 'SignupUser', + 'SignupUserDB', + 'Invite', + 'InviteMailAddress', + 'InvitePhoneNumber', + 'InviteType', + 'SCIMReference', + 'SignupInviteDB' +] \ No newline at end of file diff --git a/src/eduid/userdb/support/__init__.py b/src/eduid/userdb/support/__init__.py index e0a9e7451..39cc03622 100644 --- a/src/eduid/userdb/support/__init__.py +++ b/src/eduid/userdb/support/__init__.py @@ -8,4 +8,14 @@ SupportProofingLogDB, ) +__all__ = [ + 'SupportAuthnInfoDB', + 'SupportEmailProofingDB', + 'SupportLetterProofingDB', + 'SupportOidcProofingDB', + 'SupportPhoneProofingDB', + 'SupportProofingDB', + 'SupportProofingLogDB', +] + __author__ = "lundberg" From 01a3e07ce8b699dc6af045671f2f4c149abcd9a8 Mon Sep 17 00:00:00 2001 From: Lasse Yledahl Date: Tue, 3 Sep 2024 14:02:27 +0000 Subject: [PATCH 06/28] make sure strings are f-strings --- src/eduid/maccapi/middleware.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/eduid/maccapi/middleware.py b/src/eduid/maccapi/middleware.py index b2c4650e7..4595b38c7 100644 --- a/src/eduid/maccapi/middleware.py +++ b/src/eduid/maccapi/middleware.py @@ -73,7 +73,7 @@ async def dispatch(self, request: Request, call_next: RequestResponseEndpoint) - try: token.validate_auth_source() except RequestedAccessDenied as e: - self.context.logger.error("Access denied: {e}") + self.context.logger.error(f"Access denied: {e}") return return_error_response( status_code=status.HTTP_401_UNAUTHORIZED, detail="Authentication source or assurance level invalid" ) @@ -81,7 +81,7 @@ async def dispatch(self, request: Request, call_next: RequestResponseEndpoint) - try: data_owner = token.get_data_owner() except RequestedAccessDenied as e: - self.context.logger.error("Access denied: {e}") + self.context.logger.error(f"Access denied: {e}") return return_error_response( status_code=status.HTTP_401_UNAUTHORIZED, detail="Data owner requested in access token denied" ) From 16e96e3b2a82f8b959d733359d9767a583318183 Mon Sep 17 00:00:00 2001 From: Lasse Yledahl Date: Tue, 3 Sep 2024 14:04:21 +0000 Subject: [PATCH 07/28] make normal strings of f-strings without placeholders --- src/eduid/graphdb/groupdb/db.py | 2 +- src/eduid/queue/workers/base.py | 2 +- src/eduid/satosa/scimapi/stepup.py | 2 +- src/eduid/scimapi/context.py | 2 +- src/eduid/scimapi/routers/events.py | 2 +- src/eduid/scimapi/routers/groups.py | 4 ++-- src/eduid/scimapi/routers/invites.py | 2 +- src/eduid/scimapi/routers/login.py | 2 +- src/eduid/scimapi/routers/users.py | 2 +- src/eduid/scimapi/tests/test_login.py | 6 +++--- src/eduid/scimapi/tests/test_scimgroup.py | 10 +++++----- src/eduid/scimapi/tests/test_sciminvite.py | 4 ++-- src/eduid/scimapi/tests/test_search_filter.py | 6 +++--- src/eduid/userdb/userdb.py | 2 +- src/eduid/webapp/common/api/decorators.py | 2 +- src/eduid/webapp/common/session/redis_session.py | 4 ++-- src/eduid/webapp/eidas/proofing.py | 4 ++-- src/eduid/webapp/idp/exceptions.py | 2 +- src/eduid/webapp/idp/logout.py | 4 ++-- src/eduid/webapp/idp/other_device/device1.py | 4 ++-- src/eduid/webapp/idp/other_device/helpers.py | 4 ++-- src/eduid/webapp/idp/tests/data/test_SSO_conf.py | 2 +- src/eduid/webapp/idp/views/error_info.py | 2 +- src/eduid/webapp/idp/views/tou.py | 2 +- src/eduid/webapp/idp/views/use_other.py | 2 +- src/eduid/webapp/lookup_mobile_proofing/views.py | 2 +- .../webapp/reset_password/views/reset_password.py | 4 ++-- src/eduid/webapp/security/helpers.py | 2 +- src/eduid/webapp/signup/helpers.py | 2 +- src/eduid/webapp/svipe_id/proofing.py | 2 +- 30 files changed, 46 insertions(+), 46 deletions(-) diff --git a/src/eduid/graphdb/groupdb/db.py b/src/eduid/graphdb/groupdb/db.py index cb23b185e..6a1e89fc7 100644 --- a/src/eduid/graphdb/groupdb/db.py +++ b/src/eduid/graphdb/groupdb/db.py @@ -375,7 +375,7 @@ def save(self, group: Group) -> Group: raise EduIDGroupDBError(e.message) finally: if tx.closed(): - logger.info(f"Group save successful") + logger.info("Group save successful") else: logger.error("Group save error: ROLLING BACK") tx.close() diff --git a/src/eduid/queue/workers/base.py b/src/eduid/queue/workers/base.py index f8d2f6ae5..2c5bac846 100644 --- a/src/eduid/queue/workers/base.py +++ b/src/eduid/queue/workers/base.py @@ -149,7 +149,7 @@ async def periodic_collection_check(self) -> None: tasks: set[Task] = set() try: while True: - logger.debug(f"Running periodic collection check") + logger.debug("Running periodic collection check") tasks = await self.collect_periodic_tasks() # TODO: Implement some kind of retry of failed events here diff --git a/src/eduid/satosa/scimapi/stepup.py b/src/eduid/satosa/scimapi/stepup.py index 75b197667..b4c33c939 100644 --- a/src/eduid/satosa/scimapi/stepup.py +++ b/src/eduid/satosa/scimapi/stepup.py @@ -232,7 +232,7 @@ def process( if AuthnContext.sp_wants_mfa(context=context) and not AuthnContext.idp_sent_loa(context=context): logger.info("Requesting SP did ask for MFA but and user has no linked accounts") raise SATOSAAuthenticationError( - context.state, f"Requesting SP did ask for MFA but didn't get it and the user has no linked account" + context.state, "Requesting SP did ask for MFA but didn't get it and the user has no linked account" ) return super().process(context, data) diff --git a/src/eduid/scimapi/context.py b/src/eduid/scimapi/context.py index c6d1254ac..616ad9fb5 100644 --- a/src/eduid/scimapi/context.py +++ b/src/eduid/scimapi/context.py @@ -119,6 +119,6 @@ def resource_url(self, resource_type: SCIMResourceType, scim_id: UUID) -> str: def check_version(self, req: ContextRequest, db_obj: Union[ScimApiGroup, ScimApiUser, ScimApiInvite]) -> bool: if req.headers.get("IF-MATCH") == make_etag(db_obj.version): return True - self.logger.error(f"Version mismatch") + self.logger.error("Version mismatch") self.logger.debug(f'{req.headers.get("IF-MATCH")} != {make_etag(db_obj.version)}') return False diff --git a/src/eduid/scimapi/routers/events.py b/src/eduid/scimapi/routers/events.py index a4e223d3f..9f1d7fced 100644 --- a/src/eduid/scimapi/routers/events.py +++ b/src/eduid/scimapi/routers/events.py @@ -64,7 +64,7 @@ async def on_post(req: ContextRequest, resp: Response, create_request: EventCrea } } """ - req.app.context.logger.info(f"Creating event") + req.app.context.logger.info("Creating event") req.app.context.logger.debug(create_request) # TODO: Instead of checking input here we should use dump_only for the fields in the schema diff --git a/src/eduid/scimapi/routers/groups.py b/src/eduid/scimapi/routers/groups.py index d196d819a..a549b27ee 100644 --- a/src/eduid/scimapi/routers/groups.py +++ b/src/eduid/scimapi/routers/groups.py @@ -132,7 +132,7 @@ async def on_put( req.app.context.logger.info("Updating group") req.app.context.logger.debug(update_request) if scim_id != str(update_request.id): - req.app.context.logger.error(f"Id mismatch") + req.app.context.logger.error("Id mismatch") req.app.context.logger.debug(f"{scim_id} != {update_request.id}") raise BadRequest(detail="Id mismatch") @@ -147,7 +147,7 @@ async def on_put( raise BadRequest(detail="Version mismatch") # Check that members exists in their respective db - req.app.context.logger.info(f"Checking if group and user members exists") + req.app.context.logger.info("Checking if group and user members exists") for member in update_request.members: if member.is_group: if not req.context.groupdb.group_exists(str(member.value)): diff --git a/src/eduid/scimapi/routers/invites.py b/src/eduid/scimapi/routers/invites.py index 146d254d2..d5a6189f5 100644 --- a/src/eduid/scimapi/routers/invites.py +++ b/src/eduid/scimapi/routers/invites.py @@ -325,7 +325,7 @@ async def search(req: ContextRequest, query: SearchRequest) -> ListResponse: ] } """ - req.app.context.logger.info(f"Searching for invite(s)") + req.app.context.logger.info("Searching for invite(s)") req.app.context.logger.debug(f"Parsed invite search query: {query}") filter = parse_search_filter(query.filter) diff --git a/src/eduid/scimapi/routers/login.py b/src/eduid/scimapi/routers/login.py index bd0b7b04e..5999faff5 100644 --- a/src/eduid/scimapi/routers/login.py +++ b/src/eduid/scimapi/routers/login.py @@ -23,7 +23,7 @@ async def get_token(req: ContextRequest, resp: Response, token_req: TokenRequest) -> None: if not req.app.config.login_enabled: raise NotFound() - req.app.context.logger.info(f"Logging in") + req.app.context.logger.info("Logging in") if token_req.data_owner not in req.app.context.config.data_owners: raise Unauthorized() now = datetime.datetime.now(tz=datetime.timezone.utc) diff --git a/src/eduid/scimapi/routers/users.py b/src/eduid/scimapi/routers/users.py index 28e5a7c1d..a1ac99734 100644 --- a/src/eduid/scimapi/routers/users.py +++ b/src/eduid/scimapi/routers/users.py @@ -61,7 +61,7 @@ async def on_put(req: ContextRequest, resp: Response, update_request: UserUpdate req.app.context.logger.info(f"Updating user {scim_id}") req.app.context.logger.debug(update_request) if scim_id != str(update_request.id): - req.app.context.logger.error(f"Id mismatch") + req.app.context.logger.error("Id mismatch") req.app.context.logger.debug(f"{scim_id} != {update_request.id}") raise BadRequest(detail="Id mismatch") diff --git a/src/eduid/scimapi/tests/test_login.py b/src/eduid/scimapi/tests/test_login.py index e7b278cf1..c5167836f 100644 --- a/src/eduid/scimapi/tests/test_login.py +++ b/src/eduid/scimapi/tests/test_login.py @@ -16,11 +16,11 @@ def _get_config(self) -> dict: return config def test_get_token(self): - response = self.client.post(url=f"/login", data=json.dumps({"data_owner": "eduid.se"}), headers=self.headers) + response = self.client.post(url="/login", data=json.dumps({"data_owner": "eduid.se"}), headers=self.headers) self._assertResponse(response) def test_use_token(self): - response = self.client.post(url=f"/login", data=json.dumps({"data_owner": "eduid.se"}), headers=self.headers) + response = self.client.post(url="/login", data=json.dumps({"data_owner": "eduid.se"}), headers=self.headers) token = response.headers.get("Authorization") headers = { "Content-Type": "application/scim+json", @@ -37,5 +37,5 @@ def setUp(self) -> None: super().setUp() def test_get_token(self): - response = self.client.post(url=f"/login", data=json.dumps({"data_owner": "eduid.se"}), headers=self.headers) + response = self.client.post(url="/login", data=json.dumps({"data_owner": "eduid.se"}), headers=self.headers) assert response.status_code == 404 diff --git a/src/eduid/scimapi/tests/test_scimgroup.py b/src/eduid/scimapi/tests/test_scimgroup.py index 85d0a526f..4440ca0fe 100644 --- a/src/eduid/scimapi/tests/test_scimgroup.py +++ b/src/eduid/scimapi/tests/test_scimgroup.py @@ -184,7 +184,7 @@ class TestGroupResource_GET(TestGroupResource): def test_get_groups(self): for i in range(9): self.add_group(uuid4(), f"Test Group {i}") - response = self.client.get(url=f"/Groups", headers=self.headers) + response = self.client.get(url="/Groups", headers=self.headers) self.assertEqual([SCIMSchema.API_MESSAGES_20_LIST_RESPONSE.value], response.json().get("schemas")) resources = response.json().get("Resources") expected_num_resources = self.groupdb.graphdb.db.count_nodes() @@ -550,14 +550,14 @@ def test_search_group_unknown_attribute(self): def test_search_group_start_index(self): for i in range(9): - self.add_group(uuid4(), f"Test Group") + self.add_group(uuid4(), "Test Group") self._perform_search( filter='displayName eq "Test Group"', start=5, expected_num_resources=5, expected_total_results=9 ) def test_search_group_count(self): for i in range(9): - self.add_group(uuid4(), f"Test Group") + self.add_group(uuid4(), "Test Group") groups = self.groupdb.get_groups() self.assertEqual(len(groups), 9) @@ -605,11 +605,11 @@ def test_search_group_last_modified(self): self._perform_search(filter=f'meta.lastModified gt "{group1.last_modified.isoformat()}"', expected_group=group2) def test_search_group_last_modified_invalid_datetime_1(self): - json = self._perform_search(filter=f"meta.lastModified ge 1", return_json=True) + json = self._perform_search(filter="meta.lastModified ge 1", return_json=True) self._assertScimError(json, detail="Invalid datetime") def test_search_group_last_modified_invalid_datetime_2(self): - json = self._perform_search(filter=f'meta.lastModified ge "2020-05-12_15:36:99+00:00"', return_json=True) + json = self._perform_search(filter='meta.lastModified ge "2020-05-12_15:36:99+00:00"', return_json=True) self._assertScimError(json, detail="Invalid datetime") def test_schema_violation(self): diff --git a/src/eduid/scimapi/tests/test_sciminvite.py b/src/eduid/scimapi/tests/test_sciminvite.py index 051762eee..f26c2259a 100644 --- a/src/eduid/scimapi/tests/test_sciminvite.py +++ b/src/eduid/scimapi/tests/test_sciminvite.py @@ -384,7 +384,7 @@ def test_create_invite(self): }, } - response = self.client.post(url=f"/Invites/", json=req, headers=self.headers) + response = self.client.post(url="/Invites/", json=req, headers=self.headers) self._assertResponse(response, status_code=201) db_invite = self.invitedb.get_invite_by_scim_id(response.json().get("id")) reference = SCIMReference(data_owner=self.data_owner, scim_id=db_invite.scim_id) @@ -481,7 +481,7 @@ def test_create_invite_do_not_send_email(self): }, } - response = self.client.post(url=f"/Invites/", json=req, headers=self.headers) + response = self.client.post(url="/Invites/", json=req, headers=self.headers) self._assertResponse(response, status_code=201) db_invite = self.invitedb.get_invite_by_scim_id(response.json().get("id")) reference = SCIMReference(data_owner=self.data_owner, scim_id=db_invite.scim_id) diff --git a/src/eduid/scimapi/tests/test_search_filter.py b/src/eduid/scimapi/tests/test_search_filter.py index 491fdf332..5e83bbf80 100644 --- a/src/eduid/scimapi/tests/test_search_filter.py +++ b/src/eduid/scimapi/tests/test_search_filter.py @@ -23,20 +23,20 @@ def test_lastmodified_with_tz(self): self.assertEqual(sf.val, nowstr) def test_str(self): - filter = f'foo eq "123"' + filter = 'foo eq "123"' sf = parse_search_filter(filter) self.assertEqual(sf.attr, "foo") self.assertEqual(sf.op, "eq") self.assertEqual(sf.val, "123") def test_int(self): - filter = f"foo eq 123" + filter = "foo eq 123" sf = parse_search_filter(filter) self.assertEqual(sf.attr, "foo") self.assertEqual(sf.op, "eq") self.assertEqual(sf.val, 123) def test_not_printable(self): - filter = f"foo eq 12\u00093" + filter = "foo eq 12\u00093" with self.assertRaises(BadRequest): parse_search_filter(filter) diff --git a/src/eduid/userdb/userdb.py b/src/eduid/userdb/userdb.py index 228c4b9d4..82f9cede2 100644 --- a/src/eduid/userdb/userdb.py +++ b/src/eduid/userdb/userdb.py @@ -266,7 +266,7 @@ def save(self, user: UserVar) -> UserSaveResult: :param user: User object """ if not isinstance(user, User): - raise EduIDUserDBError(f"user is not a subclass of User") + raise EduIDUserDBError("user is not a subclass of User") spec: dict[str, Any] = {"_id": user.user_id} try: diff --git a/src/eduid/webapp/common/api/decorators.py b/src/eduid/webapp/common/api/decorators.py index 22fa7ea4e..e38a75cec 100644 --- a/src/eduid/webapp/common/api/decorators.py +++ b/src/eduid/webapp/common/api/decorators.py @@ -218,7 +218,7 @@ def unmarshal_decorator( ) logger.warning(f"Error un-marshalling request using {self.schema}: {e.normalized_messages()}") if "password" in _data_str: - logger.debug(f"Failing request has a password in it, not logging JSON data") + logger.debug("Failing request has a password in it, not logging JSON data") else: logger.debug(f"Failing request JSON data:\n{json.dumps(json_data, indent=4, sort_keys=True)}") error_response: FlaskResponse = jsonify(response_data.to_dict()) diff --git a/src/eduid/webapp/common/session/redis_session.py b/src/eduid/webapp/common/session/redis_session.py index 84910cec8..8a0da3621 100644 --- a/src/eduid/webapp/common/session/redis_session.py +++ b/src/eduid/webapp/common/session/redis_session.py @@ -127,7 +127,7 @@ def get_session(self, meta: SessionMeta, new: bool) -> RedisEncryptedSession: else: if not res.load_session(): logger.warning(f"No existing session found for {res}") - raise KeyError(f"Session not found using provided cookie") + raise KeyError("Session not found using provided cookie") return res @@ -140,7 +140,7 @@ def get_redis_pool(cfg: RedisConfig) -> Union[sentinel.SentinelConnectionPool, r return sentinel.SentinelConnectionPool(cfg.sentinel_service_name, manager) else: if not cfg.host: - logger.error(f"Redis configuration without sentinel parameters does not have host") + logger.error("Redis configuration without sentinel parameters does not have host") raise RuntimeError("Redis configuration incorrect") return redis.ConnectionPool(host=cfg.host, port=cfg.port, db=cfg.db) diff --git a/src/eduid/webapp/eidas/proofing.py b/src/eduid/webapp/eidas/proofing.py index 743cd3559..cd9d47d96 100644 --- a/src/eduid/webapp/eidas/proofing.py +++ b/src/eduid/webapp/eidas/proofing.py @@ -304,7 +304,7 @@ def verify_identity(self, user: User) -> VerifyUserResult: # Save user to private db current_app.private_userdb.save(proofing_user) # Ask am to sync user to central db - current_app.logger.info(f"Request sync for user") + current_app.logger.info("Request sync for user") result = current_app.am_relay.request_user_sync(proofing_user) current_app.logger.info(f"Sync result for user: {result}") except AmTaskFailed: @@ -395,7 +395,7 @@ def _find_or_add_credential( ) -> Optional[ElementKey]: if not required_loa: # mainly keep mypy calm - current_app.logger.debug(f"Not recording credential used without required_loa") + current_app.logger.debug("Not recording credential used without required_loa") return None cred: ExternalCredential diff --git a/src/eduid/webapp/idp/exceptions.py b/src/eduid/webapp/idp/exceptions.py index 2e1ee5093..d91c55c37 100644 --- a/src/eduid/webapp/idp/exceptions.py +++ b/src/eduid/webapp/idp/exceptions.py @@ -15,7 +15,7 @@ def _handle_flask_http_exception(error: HTTPException) -> WerkzeugResponse: app.logger.error(f"IdP HTTPException {request}: {error}") app.logger.debug(f"Exception handler invoked on request from {request.remote_addr}: {request}") if app.debug or app.testing: - app.logger.exception(f"Got exception in IdP") + app.logger.exception("Got exception in IdP") # It looks to me like this function get_response() returns a WerkzeugResponse, but it's # declared to return a sans io Response (which doesn't have a body). Don't know why. response: WerkzeugResponse = error.get_response() # type: ignore[assignment] diff --git a/src/eduid/webapp/idp/logout.py b/src/eduid/webapp/idp/logout.py index 27103610d..94fbd239e 100644 --- a/src/eduid/webapp/idp/logout.py +++ b/src/eduid/webapp/idp/logout.py @@ -140,7 +140,7 @@ def perform_logout(self, info: SAMLQueryParams, binding: str) -> WerkzeugRespons assert isinstance(req_info, saml2.request.LogoutRequest) current_app.logger.debug(f"Parsed Logout request ({binding}):\n{req_info.message}") except Exception: - current_app.logger.exception(f"Failed parsing logout request") + current_app.logger.exception("Failed parsing logout request") current_app.logger.debug(f"_perform_logout {binding}:\n{info}") raise BadRequest("Failed parsing logout request") @@ -236,7 +236,7 @@ def _logout_name_id(self, name_id: NameID, req_key: str) -> str: current_app.IDP.session_db.remove_authn_statements(name_id) current_app.logger.info(f"{req_key}: logout name_id={name_id!r}") except KeyError: - current_app.logger.exception(f"Failed removing authn") + current_app.logger.exception("Failed removing authn") raise InternalServerError() return str(STATUS_SUCCESS) # use str() to ensure external value is the right type diff --git a/src/eduid/webapp/idp/other_device/device1.py b/src/eduid/webapp/idp/other_device/device1.py index 800802578..ed2fab186 100644 --- a/src/eduid/webapp/idp/other_device/device1.py +++ b/src/eduid/webapp/idp/other_device/device1.py @@ -59,13 +59,13 @@ def device1_check_response_code( if state.state != OtherDeviceState.AUTHENTICATED: logger.info(f"Not validating response code for use other device in state {state.state}") else: - logger.info(f"Use other device: Incorrect response_code") + logger.info("Use other device: Incorrect response_code") current_app.stats.count("login_using_other_device_incorrect_code") state.bad_attempts += 1 if state.state != OtherDeviceState.DENIED: if state.bad_attempts >= current_app.conf.other_device_max_code_attempts: - logger.info(f"Use other device: too many response code attempts") + logger.info("Use other device: too many response code attempts") current_app.stats.count("login_using_other_device_denied") state.state = OtherDeviceState.DENIED diff --git a/src/eduid/webapp/idp/other_device/helpers.py b/src/eduid/webapp/idp/other_device/helpers.py index 1c3dc63fe..c744d49d1 100644 --- a/src/eduid/webapp/idp/other_device/helpers.py +++ b/src/eduid/webapp/idp/other_device/helpers.py @@ -30,11 +30,11 @@ def _get_other_device_state_using_ref(ref: RequestRef, device: int) -> OtherDevi # Check both callers opinion of what device this is, and the states. Belts and bracers. if device == 1 or ticket.is_other_device_1: if isinstance(ticket.pending_request, IdP_OtherDevicePendingRequest): - current_app.logger.warning(f"Not allowing recursive login using another device") + current_app.logger.warning("Not allowing recursive login using another device") return OtherDeviceRefResult(response=error_response(message=IdPMsg.not_available)) elif device == 2 or ticket.is_other_device_2: if not isinstance(ticket.pending_request, IdP_OtherDevicePendingRequest): - current_app.logger.warning(f"The pending request is not an IdP_OtherDevicePendingRequest") + current_app.logger.warning("The pending request is not an IdP_OtherDevicePendingRequest") return OtherDeviceRefResult(response=error_response(message=IdPMsg.not_available)) state = None diff --git a/src/eduid/webapp/idp/tests/data/test_SSO_conf.py b/src/eduid/webapp/idp/tests/data/test_SSO_conf.py index d0272f023..229fbf325 100644 --- a/src/eduid/webapp/idp/tests/data/test_SSO_conf.py +++ b/src/eduid/webapp/idp/tests/data/test_SSO_conf.py @@ -119,7 +119,7 @@ def get_sp_config(sp_base: str) -> dict: # do not change the binding or service name "assertion_consumer_service": [ (f"{sp_base}/acs/", BINDING_HTTP_POST), - (f"https://localhost:8080/acs/", BINDING_HTTP_POST), + ("https://localhost:8080/acs/", BINDING_HTTP_POST), ], # url and binding to the single logout service view # do not change the binding or service name diff --git a/src/eduid/webapp/idp/views/error_info.py b/src/eduid/webapp/idp/views/error_info.py index cf7c20261..81b1aef98 100644 --- a/src/eduid/webapp/idp/views/error_info.py +++ b/src/eduid/webapp/idp/views/error_info.py @@ -17,7 +17,7 @@ @MarshalWith(ErrorInfoResponseSchema) def error_info() -> FluxData: current_app.logger.debug("\n\n") - current_app.logger.debug(f"--- Error info ---") + current_app.logger.debug("--- Error info ---") try: user = get_user() diff --git a/src/eduid/webapp/idp/views/tou.py b/src/eduid/webapp/idp/views/tou.py index 5eedecdb2..aba5b9051 100644 --- a/src/eduid/webapp/idp/views/tou.py +++ b/src/eduid/webapp/idp/views/tou.py @@ -76,7 +76,7 @@ def tou( return error_response(message=CommonMsg.out_of_sync) if not res: - current_app.logger.error(f"Failed saving/syncing user after accepting ToU") + current_app.logger.error("Failed saving/syncing user after accepting ToU") return error_response(message=IdPMsg.general_failure) return success_response(payload={"finished": True}) diff --git a/src/eduid/webapp/idp/views/use_other.py b/src/eduid/webapp/idp/views/use_other.py index 4f2890bf0..545dfa8c3 100644 --- a/src/eduid/webapp/idp/views/use_other.py +++ b/src/eduid/webapp/idp/views/use_other.py @@ -199,7 +199,7 @@ def use_other_2( current_app.logger.debug(f"Extra debug: Full other device state:\n{state.to_json()}") if not state: - current_app.logger.debug(f"Other device: No state found, bailing out") + current_app.logger.debug("Other device: No state found, bailing out") return error_response(message=IdPMsg.state_not_found) now = utc_now() # ensure coherent results of 'is this expired?' checks diff --git a/src/eduid/webapp/lookup_mobile_proofing/views.py b/src/eduid/webapp/lookup_mobile_proofing/views.py index d75e66ef7..90de82fa0 100644 --- a/src/eduid/webapp/lookup_mobile_proofing/views.py +++ b/src/eduid/webapp/lookup_mobile_proofing/views.py @@ -60,7 +60,7 @@ def proofing(user: User, nin: str) -> FluxData: return error_response(message=CommonMsg.temp_problem) return success_response(message=MobileMsg.verify_success) except AmTaskFailed: - current_app.logger.exception(f"Verifying nin for user failed") + current_app.logger.exception("Verifying nin for user failed") return error_response(message=CommonMsg.temp_problem) except LockedIdentityViolation: current_app.logger.exception("Verifying NIN for user failed") diff --git a/src/eduid/webapp/reset_password/views/reset_password.py b/src/eduid/webapp/reset_password/views/reset_password.py index d175dac55..6a79ef051 100644 --- a/src/eduid/webapp/reset_password/views/reset_password.py +++ b/src/eduid/webapp/reset_password/views/reset_password.py @@ -135,7 +135,7 @@ def start_reset_pw(email: str) -> FluxData: current_app.logger.exception(f"User with email {email} has to complete signup") return error_response(message=ResetPwMsg.invalid_user) except MailTaskFailed: - current_app.logger.exception(f"Sending password reset email failed") + current_app.logger.exception("Sending password reset email failed") return error_response(message=ResetPwMsg.email_send_failure) current_app.stats.count(name="email_sent", value=1) @@ -314,7 +314,7 @@ def choose_extra_security_phone(email_code: str, phone_index: int) -> FluxData: try: send_verify_phone_code(context.state, phone_number["number"]) except MsgTaskFailed: - current_app.logger.exception(f"Sending sms failed") + current_app.logger.exception("Sending sms failed") return error_response(message=ResetPwMsg.send_sms_failure) current_app.stats.count(name="extra_security_phone_sent") diff --git a/src/eduid/webapp/security/helpers.py b/src/eduid/webapp/security/helpers.py index 5080f5887..3ea103c28 100644 --- a/src/eduid/webapp/security/helpers.py +++ b/src/eduid/webapp/security/helpers.py @@ -237,7 +237,7 @@ def update_user_official_name(security_user: SecurityUser, navet_data: NavetData current_app.logger.debug(f"proofing_log_entry: {proofing_log_entry}") return False - current_app.logger.info(f"Recorded verification in the proofing log") + current_app.logger.info("Recorded verification in the proofing log") # Save user to private db current_app.private_userdb.save(security_user) # Ask am to sync user to central db diff --git a/src/eduid/webapp/signup/helpers.py b/src/eduid/webapp/signup/helpers.py index a48c57b5a..25a77394d 100644 --- a/src/eduid/webapp/signup/helpers.py +++ b/src/eduid/webapp/signup/helpers.py @@ -351,7 +351,7 @@ def complete_and_update_invite(user: User, invite_code: str): session.signup.invite.finish_url = invite.finish_url session.signup.invite.completed = True - current_app.logger.info(f"Invite completed") + current_app.logger.info("Invite completed") current_app.logger.debug(f"invite_code: {invite.invite_code}") current_app.stats.count(name=f"{invite.invite_type.value}_invite_completed") diff --git a/src/eduid/webapp/svipe_id/proofing.py b/src/eduid/webapp/svipe_id/proofing.py index b5c27f1f2..99fb572ce 100644 --- a/src/eduid/webapp/svipe_id/proofing.py +++ b/src/eduid/webapp/svipe_id/proofing.py @@ -140,7 +140,7 @@ def _verify_foreign_identity(self, user: User) -> VerifyUserResult: # Save user to private db current_app.private_userdb.save(proofing_user) # Ask am to sync user to central db - current_app.logger.info(f"Request sync for user") + current_app.logger.info("Request sync for user") result = current_app.am_relay.request_user_sync(proofing_user) current_app.logger.info(f"Sync result for user: {result}") except AmTaskFailed: From a9bddd5c2bd3ec24c2c8873b31ada41d85e8a430 Mon Sep 17 00:00:00 2001 From: Lasse Yledahl Date: Tue, 3 Sep 2024 14:06:56 +0000 Subject: [PATCH 08/28] ignore rule E741 (names to avoid) for now --- ruff.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ruff.toml b/ruff.toml index fad38e917..1eb98ea6f 100644 --- a/ruff.toml +++ b/ruff.toml @@ -1,3 +1,6 @@ # Set the maximum line length to 120. line-length = 120 target-version = "py310" + +[lint] +ignore = ["E741"] From 4f39c1af23aa169c28844b0a967fd65ba9a07ff6 Mon Sep 17 00:00:00 2001 From: Lasse Yledahl Date: Tue, 3 Sep 2024 14:28:14 +0000 Subject: [PATCH 09/28] remove unused variables --- src/eduid/userdb/tests/test_db.py | 6 +++--- src/eduid/webapp/common/authn/eduid_saml2.py | 2 +- src/eduid/webapp/idp/tests/test_logout.py | 4 ++-- src/eduid/webapp/letter_proofing/tests/test_app.py | 2 +- src/eduid/workers/lookup_mobile/test/test_decorators.py | 4 ++-- src/eduid/workers/msg/tests/test_decorators.py | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/eduid/userdb/tests/test_db.py b/src/eduid/userdb/tests/test_db.py index 41b3aa4a7..afe976c6a 100644 --- a/src/eduid/userdb/tests/test_db.py +++ b/src/eduid/userdb/tests/test_db.py @@ -14,7 +14,7 @@ def test_full_uri(self): uri = "mongodb://db.example.com:1111/testdb" mdb = db.MongoDB(uri, db_name="testdb") conn = mdb.get_connection() - database = mdb.get_database() + mdb.get_database() self.assertIsNotNone(conn) self.assertEqual(mdb._db_uri, uri) self.assertEqual(mdb._database_name, "testdb") @@ -22,7 +22,7 @@ def test_full_uri(self): def test_uri_without_path_component(self): uri = "mongodb://db.example.com:1111" mdb = db.MongoDB(uri, db_name="testdb") - database = mdb.get_database() + mdb.get_database() self.assertEqual(mdb._db_uri, uri + "/testdb") self.assertEqual(mdb._database_name, "testdb") @@ -30,7 +30,7 @@ def test_uri_without_port(self): uri = "mongodb://db.example.com/" mdb = db.MongoDB(uri) self.assertEqual(mdb._db_uri, uri) - database = mdb.get_database("testdb") + mdb.get_database("testdb") self.assertEqual(mdb.sanitized_uri, "mongodb://db.example.com/") def test_uri_with_username_and_password(self): diff --git a/src/eduid/webapp/common/authn/eduid_saml2.py b/src/eduid/webapp/common/authn/eduid_saml2.py index a22b555c0..16ea06412 100644 --- a/src/eduid/webapp/common/authn/eduid_saml2.py +++ b/src/eduid/webapp/common/authn/eduid_saml2.py @@ -132,7 +132,7 @@ def get_authn_response( except ParseError as e: logger.error(f"SAML response is not correctly formatted: {repr(e)}") raise BadSAMLResponse(EduidErrorsContext.SAML_RESPONSE_FAIL) - except UnsolicitedResponse as e: + except UnsolicitedResponse: logger.error("Unsolicited SAML response") # Extra debug to try and find the cause for some of these that seem to be incorrect logger.debug(f"Session: {session}") diff --git a/src/eduid/webapp/idp/tests/test_logout.py b/src/eduid/webapp/idp/tests/test_logout.py index 0c577cd4c..5defd268f 100644 --- a/src/eduid/webapp/idp/tests/test_logout.py +++ b/src/eduid/webapp/idp/tests/test_logout.py @@ -32,7 +32,7 @@ def test_basic_logout(self): # pre-accept ToU for this test self.add_test_user_tou() - with self.browser.session_transaction() as sess: + with self.browser.session_transaction(): # Patch the VCCSClient so we do not need a vccs server with patch.object(VCCSClient, "authenticate"): VCCSClient.authenticate.return_value = True @@ -91,7 +91,7 @@ def test_basic_logout_redirect(self): # pre-accept ToU for this test self.add_test_user_tou() - with self.browser.session_transaction() as sess: + with self.browser.session_transaction(): # Patch the VCCSClient so we do not need a vccs server with patch.object(VCCSClient, "authenticate"): VCCSClient.authenticate.return_value = True diff --git a/src/eduid/webapp/letter_proofing/tests/test_app.py b/src/eduid/webapp/letter_proofing/tests/test_app.py index c3191b34f..e140da6f1 100644 --- a/src/eduid/webapp/letter_proofing/tests/test_app.py +++ b/src/eduid/webapp/letter_proofing/tests/test_app.py @@ -410,7 +410,7 @@ def test_locked_identity_correct_nin(self, mock_get_postal_address: MagicMock, m user.locked_identity.add(NinIdentity(number=self.test_user_nin, created_by="test", is_verified=True)) self.app.central_userdb.save(user) with self.session_cookie(self.browser, self.test_user_eppn): - response = self.send_letter(self.test_user_nin) + self.send_letter(self.test_user_nin) @patch("eduid.common.rpc.am_relay.AmRelay.request_user_sync") @patch("eduid.common.rpc.msg_relay.MsgRelay.get_postal_address") diff --git a/src/eduid/workers/lookup_mobile/test/test_decorators.py b/src/eduid/workers/lookup_mobile/test/test_decorators.py index 253f86f87..b1950b040 100644 --- a/src/eduid/workers/lookup_mobile/test/test_decorators.py +++ b/src/eduid/workers/lookup_mobile/test/test_decorators.py @@ -75,7 +75,7 @@ def no_name(self): no_name(self) - result = c.find() + c.find() self.assertEqual(c.count_documents({}), 0) TransactionAudit.enable() @@ -85,5 +85,5 @@ def no_name2(self): return {"baka": "kaka"} no_name2(self) - result = c.find() + c.find() self.assertEqual(c.count_documents({}), 1) diff --git a/src/eduid/workers/msg/tests/test_decorators.py b/src/eduid/workers/msg/tests/test_decorators.py index e3787d59f..17f412d79 100644 --- a/src/eduid/workers/msg/tests/test_decorators.py +++ b/src/eduid/workers/msg/tests/test_decorators.py @@ -59,7 +59,7 @@ def no_name(): no_name() - result = c.find({}) + c.find({}) self.assertEqual(c.count_documents({}), 0) TransactionAudit.enable(self.msg_settings.mongo_uri) @@ -69,5 +69,5 @@ def no_name2(): return {"baka": "kaka"} no_name2() - result = c.find({}) + c.find({}) self.assertEqual(c.count_documents({}), 1) From fcaf0ce72cdbe5c76454f6e4404dc46321c05e91 Mon Sep 17 00:00:00 2001 From: Lasse Yledahl Date: Tue, 3 Sep 2024 14:35:23 +0000 Subject: [PATCH 10/28] use 'is' for comparisons with None --- src/eduid/maccapi/tests/test_maccapi.py | 6 +++--- src/eduid/workers/lookup_mobile/test/test_lookup.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/eduid/maccapi/tests/test_maccapi.py b/src/eduid/maccapi/tests/test_maccapi.py index 02c7d3d50..a7f951657 100644 --- a/src/eduid/maccapi/tests/test_maccapi.py +++ b/src/eduid/maccapi/tests/test_maccapi.py @@ -56,8 +56,8 @@ def test_create_user(self): assert payload["scope"] == "eduid.se" assert payload["user"]["given_name"] == self.user1["given_name"] assert payload["user"]["surname"] == self.user1["surname"] - assert payload["user"]["eppn"] != None - assert payload["user"]["password"] != None + assert payload["user"]["eppn"] is not None + assert payload["user"]["password"] is not None def test_create_multiple_users(self): claims = { @@ -140,7 +140,7 @@ def test_reset_password(self): assert payload["user"]["eppn"] == eppn assert payload["user"]["given_name"] == self.user1["given_name"] assert payload["user"]["surname"] == self.user1["surname"] - assert payload["user"]["password"] != None + assert payload["user"]["password"] is not None new_password = payload["user"]["password"] assert self._is_presentable_format(new_password) diff --git a/src/eduid/workers/lookup_mobile/test/test_lookup.py b/src/eduid/workers/lookup_mobile/test/test_lookup.py index 35416c859..bfab5532f 100644 --- a/src/eduid/workers/lookup_mobile/test/test_lookup.py +++ b/src/eduid/workers/lookup_mobile/test/test_lookup.py @@ -12,7 +12,7 @@ def test_find_NIN_by_mobile(self): assert mobile_verifier.find_NIN_by_mobile("+46701740610") == "200202027140" assert mobile_verifier.find_NIN_by_mobile("+46701740608") == "197512126371" assert mobile_verifier.find_NIN_by_mobile("+46701740609") == "197512126371" - assert mobile_verifier.find_NIN_by_mobile("+46701740699") == None + assert mobile_verifier.find_NIN_by_mobile("+46701740699") is None def test_find_mobiles_by_NIN(self): # TODO: Actually connects to teleadress? From 49832f142c9b7b1fb831b24eab5fa17ff5ea1e96 Mon Sep 17 00:00:00 2001 From: Lasse Yledahl Date: Tue, 3 Sep 2024 14:55:52 +0000 Subject: [PATCH 11/28] avoid comparisons to boolean literals --- src/eduid/satosa/scimapi/scim_attributes.py | 2 +- src/eduid/vccs/server/endpoints/revoke_creds.py | 2 +- src/eduid/webapp/authn/tests/test_authn.py | 2 +- src/eduid/webapp/common/authn/tests/test_cache.py | 2 +- src/eduid/webapp/email/tests/test_app.py | 8 ++++---- src/eduid/webapp/idp/tests/test_api.py | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/eduid/satosa/scimapi/scim_attributes.py b/src/eduid/satosa/scimapi/scim_attributes.py index faae90a1c..b8f0bd02f 100644 --- a/src/eduid/satosa/scimapi/scim_attributes.py +++ b/src/eduid/satosa/scimapi/scim_attributes.py @@ -115,7 +115,7 @@ def process( default_allow = self.config.allow_users_not_in_database.get("default", False) allow_users_not_in_database = self.config.allow_users_not_in_database.get(frontend_name, default_allow) - if allow_users_not_in_database == False: + if not allow_users_not_in_database: raise SATOSAAuthenticationError(context.state, "User not found in database") if user_groups: diff --git a/src/eduid/vccs/server/endpoints/revoke_creds.py b/src/eduid/vccs/server/endpoints/revoke_creds.py index ba0d6875a..93db930e7 100644 --- a/src/eduid/vccs/server/endpoints/revoke_creds.py +++ b/src/eduid/vccs/server/endpoints/revoke_creds.py @@ -77,7 +77,7 @@ async def revoke_creds(req: Request, request: RevokeCredsRequestV1) -> RevokeCre f"operation=revoke, reason={repr(factor.reason)}, reference={repr(factor.reference)}, " f"credential_id={cred.credential_id}, result={res}" ) - if res == True: + if res: this_result = True else: req.app.logger.warning(f"Credential not found: {factor.credential_id}") diff --git a/src/eduid/webapp/authn/tests/test_authn.py b/src/eduid/webapp/authn/tests/test_authn.py index 0366380de..70d644811 100644 --- a/src/eduid/webapp/authn/tests/test_authn.py +++ b/src/eduid/webapp/authn/tests/test_authn.py @@ -798,7 +798,7 @@ def test_chpass_assertion_consumer_service(self): def test_terminate_assertion_consumer_service(self): res = self.acs("/terminate", self.test_user.eppn) assert res.session.common.eppn == self.test_user.eppn - assert res.session.common.is_logged_in == True + assert res.session.common.is_logged_in authn = res.session.authn.sp.authns[res.authn_ref] assert authn.post_authn_action == AuthnAcsAction.terminate_account assert authn.authn_instant is not None diff --git a/src/eduid/webapp/common/authn/tests/test_cache.py b/src/eduid/webapp/common/authn/tests/test_cache.py index 836cc82c3..1e88d6dfc 100644 --- a/src/eduid/webapp/common/authn/tests/test_cache.py +++ b/src/eduid/webapp/common/authn/tests/test_cache.py @@ -74,4 +74,4 @@ def test_init(self): ic = IdentityCache(PySAML2Dicts({})) assert isinstance(ic._db, SessionCacheAdapter) - assert ic._sync == False + assert not ic._sync diff --git a/src/eduid/webapp/email/tests/test_app.py b/src/eduid/webapp/email/tests/test_app.py index ee591e777..3c4ff4a5f 100644 --- a/src/eduid/webapp/email/tests/test_app.py +++ b/src/eduid/webapp/email/tests/test_app.py @@ -550,8 +550,8 @@ def test_verify(self): assert mail_address_element is not None assert mail_address_element.email == email - assert mail_address_element.is_verified == True - assert mail_address_element.is_primary == False + assert mail_address_element.is_verified + assert not mail_address_element.is_primary assert self.app.proofing_log.db_count() == 1 def test_verify_unknown(self): @@ -606,8 +606,8 @@ def test_verify_email_uppercase(self): assert mail_address_element is not None assert mail_address_element.email, email.lower() - assert mail_address_element.is_verified == True - assert mail_address_element.is_primary == False + assert mail_address_element.is_verified + assert not mail_address_element.is_primary assert self.app.proofing_log.db_count() == 1 def test_handle_multiple_email_proofings(self): diff --git a/src/eduid/webapp/idp/tests/test_api.py b/src/eduid/webapp/idp/tests/test_api.py index c5f9fb471..4d405c8df 100644 --- a/src/eduid/webapp/idp/tests/test_api.py +++ b/src/eduid/webapp/idp/tests/test_api.py @@ -319,7 +319,7 @@ def _call_mfa( assert ( payload.get("webauthn_options") == mock_stv.return_value.webauthn_options ), f"webauthn_options: {payload.get('webauthn_options')}, Expected: {mock_stv.return_value.webauthn_options}" - assert payload.get("finished") == False, "Expected finished=False" + assert not payload.get("finished"), "Expected finished=False" logger.debug(f"MFA endpoint returned (challenge):\n{json.dumps(response.json, indent=4)}") From 2c80cfef0b6ba37c89c36a47a01e4e3160c7e9de Mon Sep 17 00:00:00 2001 From: Lasse Yledahl Date: Tue, 3 Sep 2024 15:12:42 +0000 Subject: [PATCH 12/28] use 'is' for type comparisons --- src/eduid/vccs/client/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/eduid/vccs/client/__init__.py b/src/eduid/vccs/client/__init__.py index 92f95b3b6..87abdc40b 100644 --- a/src/eduid/vccs/client/__init__.py +++ b/src/eduid/vccs/client/__init__.py @@ -327,7 +327,7 @@ def authenticate(self, user_id: str, factors: Sequence[VCCSFactor]) -> bool: response = self._execute(auth_req, "auth_response") resp_auth = response["authenticated"] - if type(resp_auth) != bool: + if type(resp_auth) is not bool: raise TypeError(f"Authenticated value type error : {resp_auth!r}") return resp_auth is True @@ -344,7 +344,7 @@ def add_credentials(self, user_id: str, factors: Sequence[VCCSFactor]) -> bool: response = self._execute(add_creds_req, "add_creds_response") success = response["success"] - if type(success) != bool: + if type(success) is not bool: raise TypeError(f"Operation success value type error : {success!r}") return success is True @@ -362,7 +362,7 @@ def revoke_credentials(self, user_id: str, factors: Sequence[VCCSRevokeFactor]) response = self._execute(revoke_creds_req, "revoke_creds_response") success = response["success"] - if type(success) != bool: + if type(success) is not bool: raise TypeError(f"Operation success value type error : {success!r}") return success is True From b69e2d7770f7b0e32c6a6b15ad6985195c447a25 Mon Sep 17 00:00:00 2001 From: Lasse Yledahl Date: Tue, 3 Sep 2024 15:30:45 +0000 Subject: [PATCH 13/28] remove unnecessary trailing comma --- src/eduid/webapp/signup/tests/test_app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/eduid/webapp/signup/tests/test_app.py b/src/eduid/webapp/signup/tests/test_app.py index 465786724..27a70a1d4 100644 --- a/src/eduid/webapp/signup/tests/test_app.py +++ b/src/eduid/webapp/signup/tests/test_app.py @@ -1408,7 +1408,7 @@ def test_complete_invite_new_user(self): email=invite.get_primary_mail_address(), given_name=state_payload["state"]["name"]["given_name"], surname=state_payload["state"]["name"]["surname"], - ), + ) self._create_user(expect_success=True) res = self._complete_invite() assert res.reached_state == SignupState.S7_COMPLETE_INVITE From ac20eba4e8f0b10fe4b2e902fe88b7e643002d43 Mon Sep 17 00:00:00 2001 From: Lasse Yledahl Date: Tue, 3 Sep 2024 15:33:54 +0000 Subject: [PATCH 14/28] remove commented imports --- src/eduid/userdb/__init__.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/eduid/userdb/__init__.py b/src/eduid/userdb/__init__.py index 1b1756a26..ff39720ef 100644 --- a/src/eduid/userdb/__init__.py +++ b/src/eduid/userdb/__init__.py @@ -11,9 +11,6 @@ __license__ = "BSD" __authors__ = ["Fredrik Thulin"] -#import eduid.userdb.exceptions -#import eduid.userdb.mail -#import eduid.userdb.phone from eduid.userdb.db import MongoDB from eduid.userdb.event import EventList from eduid.userdb.identity import EIDASIdentity, NinIdentity, SvipeIdentity From 770b3c2dd4be1f5a7fa36406c6f7ca92e1889ff3 Mon Sep 17 00:00:00 2001 From: Lasse Yledahl Date: Tue, 3 Sep 2024 15:43:18 +0000 Subject: [PATCH 15/28] ruff reformat --- src/eduid/common/clients/__init__.py | 2 +- .../common/clients/gnap_client/__init__.py | 2 +- .../common/clients/scim_client/__init__.py | 2 +- src/eduid/common/config/base.py | 1 - src/eduid/graphdb/__init__.py | 4 +- src/eduid/graphdb/groupdb/__init__.py | 6 +-- src/eduid/queue/db/__init__.py | 12 +++--- src/eduid/queue/db/message/__init__.py | 6 +-- src/eduid/queue/workers/sink.py | 2 +- src/eduid/satosa/scimapi/accr.py | 1 - src/eduid/userdb/__init__.py | 36 ++++++++-------- src/eduid/userdb/actions/tou/__init__.py | 2 +- src/eduid/userdb/admin/__init__.py | 10 +++-- src/eduid/userdb/credentials/__init__.py | 16 +++---- src/eduid/userdb/db/__init__.py | 12 +++--- src/eduid/userdb/group_management/__init__.py | 6 +-- src/eduid/userdb/idp/__init__.py | 8 ++-- src/eduid/userdb/logs/__init__.py | 24 +++++------ src/eduid/userdb/maccapi/__init__.py | 6 +-- src/eduid/userdb/personal_data/__init__.py | 4 +- src/eduid/userdb/proofing/__init__.py | 43 +++++++++---------- src/eduid/userdb/reset_password/__init__.py | 12 +++--- src/eduid/userdb/scimapi/__init__.py | 34 +++++++-------- src/eduid/userdb/security/__init__.py | 12 +++--- src/eduid/userdb/security/db.py | 2 +- src/eduid/userdb/signup/__init__.py | 18 ++++---- src/eduid/userdb/support/__init__.py | 14 +++--- .../webapp/common/authn/tests/responses.py | 4 +- src/eduid/webapp/common/proofing/methods.py | 1 - src/eduid/webapp/eidas/tests/test_app.py | 1 - src/eduid/webapp/email/verifications.py | 1 - src/eduid/webapp/idp/login.py | 1 + src/eduid/webapp/idp/mischttp.py | 1 + src/eduid/webapp/idp/service.py | 1 + src/eduid/webapp/idp/tests/test_login.py | 1 - src/eduid/webapp/personal_data/views.py | 1 - src/eduid/webapp/security/helpers.py | 1 - src/eduid/webapp/security/views/webauthn.py | 2 - src/eduid/webapp/signup/schemas.py | 18 ++++---- src/eduid/webapp/support/helpers.py | 2 +- .../am/tests/test_proofing_fetchers.py | 4 +- src/eduid/workers/job_runner/scheduler.py | 1 - .../job_runner/tests/test_user_cleaner.py | 1 - 43 files changed, 164 insertions(+), 174 deletions(-) diff --git a/src/eduid/common/clients/__init__.py b/src/eduid/common/clients/__init__.py index 7dd30ac4a..49ddd7662 100644 --- a/src/eduid/common/clients/__init__.py +++ b/src/eduid/common/clients/__init__.py @@ -3,4 +3,4 @@ from eduid.common.clients.gnap_client import AsyncGNAPClient, GNAPClient from eduid.common.clients.scim_client import SCIMClient -__all__ = ['AsyncGNAPClient', 'GNAPClient', 'SCIMClient'] +__all__ = ["AsyncGNAPClient", "GNAPClient", "SCIMClient"] diff --git a/src/eduid/common/clients/gnap_client/__init__.py b/src/eduid/common/clients/gnap_client/__init__.py index b07269f80..93bbbd7c7 100644 --- a/src/eduid/common/clients/gnap_client/__init__.py +++ b/src/eduid/common/clients/gnap_client/__init__.py @@ -3,4 +3,4 @@ from eduid.common.clients.gnap_client.async_client import AsyncGNAPClient from eduid.common.clients.gnap_client.sync_client import GNAPClient -__all__ = ['GNAPClient', 'AsyncGNAPClient'] +__all__ = ["GNAPClient", "AsyncGNAPClient"] diff --git a/src/eduid/common/clients/scim_client/__init__.py b/src/eduid/common/clients/scim_client/__init__.py index 4162a376c..cd1986066 100644 --- a/src/eduid/common/clients/scim_client/__init__.py +++ b/src/eduid/common/clients/scim_client/__init__.py @@ -2,4 +2,4 @@ from eduid.common.clients.scim_client.scim_client import SCIMClient -__all__ = ['SCIMClient'] +__all__ = ["SCIMClient"] diff --git a/src/eduid/common/config/base.py b/src/eduid/common/config/base.py index 906148af8..19e3c9c86 100644 --- a/src/eduid/common/config/base.py +++ b/src/eduid/common/config/base.py @@ -340,7 +340,6 @@ class ErrorsConfigMixin(BaseModel): class Pysaml2SPConfigMixin(BaseModel): - # Authn algorithms authn_sign_alg: str = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256" authn_digest_alg: str = "http://www.w3.org/2001/04/xmlenc#sha256" diff --git a/src/eduid/graphdb/__init__.py b/src/eduid/graphdb/__init__.py index 84b5b69a2..fa99d1588 100644 --- a/src/eduid/graphdb/__init__.py +++ b/src/eduid/graphdb/__init__.py @@ -1,8 +1,8 @@ from eduid.graphdb.db import BaseGraphDB, Neo4jDB __all__ = [ - 'BaseGraphDB', - 'Neo4jDB', + "BaseGraphDB", + "Neo4jDB", ] __author__ = "lundberg" diff --git a/src/eduid/graphdb/groupdb/__init__.py b/src/eduid/graphdb/groupdb/__init__.py index bc6f720bc..e73edc025 100644 --- a/src/eduid/graphdb/groupdb/__init__.py +++ b/src/eduid/graphdb/groupdb/__init__.py @@ -3,9 +3,9 @@ from eduid.graphdb.groupdb.user import User __all__ = [ - 'GroupDB', - 'Group', - 'User', + "GroupDB", + "Group", + "User", ] __author__ = "lundberg" diff --git a/src/eduid/queue/db/__init__.py b/src/eduid/queue/db/__init__.py index 57e0c3f59..93d269d0d 100644 --- a/src/eduid/queue/db/__init__.py +++ b/src/eduid/queue/db/__init__.py @@ -3,12 +3,12 @@ from eduid.queue.db.queue_item import QueueItem, SenderInfo __all__ = [ - 'QueueDB', - 'Payload', - 'RawPayload', - 'TestPayload', - 'QueueItem', - 'SenderInfo', + "QueueDB", + "Payload", + "RawPayload", + "TestPayload", + "QueueItem", + "SenderInfo", ] __author__ = "lundberg" diff --git a/src/eduid/queue/db/message/__init__.py b/src/eduid/queue/db/message/__init__.py index 41536ddd1..e673c0262 100644 --- a/src/eduid/queue/db/message/__init__.py +++ b/src/eduid/queue/db/message/__init__.py @@ -2,9 +2,9 @@ from eduid.queue.db.message.payload import EduidInviteEmail, EduidSignupEmail __all__ = [ - 'MessageDB', - 'EduidInviteEmail', - 'EduidSignupEmail', + "MessageDB", + "EduidInviteEmail", + "EduidSignupEmail", ] __author__ = "lundberg" diff --git a/src/eduid/queue/workers/sink.py b/src/eduid/queue/workers/sink.py index 60e83431a..c6c7da494 100644 --- a/src/eduid/queue/workers/sink.py +++ b/src/eduid/queue/workers/sink.py @@ -1,4 +1,4 @@ -""" Test worker that just logs received items """ +"""Test worker that just logs received items""" import asyncio import logging diff --git a/src/eduid/satosa/scimapi/accr.py b/src/eduid/satosa/scimapi/accr.py index 61e99cafd..9c3dd5743 100644 --- a/src/eduid/satosa/scimapi/accr.py +++ b/src/eduid/satosa/scimapi/accr.py @@ -109,7 +109,6 @@ class response(ResponseMicroService): """ def __init__(self, config: Mapping[str, Any], internal_attributes: dict[str, Any], *args: Any, **kwargs: Any): - super().__init__(*args, **kwargs) def process(self, context: satosa.context.Context, data: satosa.internal.InternalData) -> ProcessReturnType: diff --git a/src/eduid/userdb/__init__.py b/src/eduid/userdb/__init__.py index ff39720ef..2cfa58764 100644 --- a/src/eduid/userdb/__init__.py +++ b/src/eduid/userdb/__init__.py @@ -25,21 +25,21 @@ from eduid.userdb.userdb import AmDB, UserDB __all__ = [ - 'User', - 'UserDB', - 'AmDB', - 'EventList', - 'ToUEvent', - 'Profile', - 'Nin', - 'NinIdentity', - 'SvipeIdentity', - 'EIDASIdentity', - 'MailAddress', - 'PhoneNumber', - 'OidcIdToken', - 'OidcAuthorization', - 'Orcid', - 'LockedIdentityList', - 'MongoDB', -] \ No newline at end of file + "User", + "UserDB", + "AmDB", + "EventList", + "ToUEvent", + "Profile", + "Nin", + "NinIdentity", + "SvipeIdentity", + "EIDASIdentity", + "MailAddress", + "PhoneNumber", + "OidcIdToken", + "OidcAuthorization", + "Orcid", + "LockedIdentityList", + "MongoDB", +] diff --git a/src/eduid/userdb/actions/tou/__init__.py b/src/eduid/userdb/actions/tou/__init__.py index 203b439ae..7d7179c4a 100644 --- a/src/eduid/userdb/actions/tou/__init__.py +++ b/src/eduid/userdb/actions/tou/__init__.py @@ -6,4 +6,4 @@ __all__ = [ "ToUUser", "ToUUserDB", -] \ No newline at end of file +] diff --git a/src/eduid/userdb/admin/__init__.py b/src/eduid/userdb/admin/__init__.py index 5a290abb9..921c4a58c 100644 --- a/src/eduid/userdb/admin/__init__.py +++ b/src/eduid/userdb/admin/__init__.py @@ -83,8 +83,9 @@ def save_with_backup(self, raw: RawData, dry_run: bool = True) -> Any: if not os.path.isdir(self._backupbase): sys.stderr.write( - "\n\nBackup basedir {} not found, " - "running in a container without the volume mounted?\n".format(self._backupbase) + "\n\nBackup basedir {} not found, " "running in a container without the volume mounted?\n".format( + self._backupbase + ) ) sys.exit(1) @@ -207,8 +208,9 @@ def _make_backupdir(self, db_coll: str, _id: str) -> str: if not os.path.isdir(self._backupbase): sys.stderr.write( - "\n\nBackup basedir {} not found, running in a container " - "without the volume mounted?\n".format(self._backupbase) + "\n\nBackup basedir {} not found, running in a container " "without the volume mounted?\n".format( + self._backupbase + ) ) sys.exit(1) diff --git a/src/eduid/userdb/credentials/__init__.py b/src/eduid/userdb/credentials/__init__.py index 182f70615..edaba1a28 100644 --- a/src/eduid/userdb/credentials/__init__.py +++ b/src/eduid/userdb/credentials/__init__.py @@ -4,11 +4,11 @@ from eduid.userdb.credentials.password import Password __all__ = [ - 'Credential', - 'CredentialList', - 'Password', - 'U2F', - 'FidoCredential', - 'Webauthn', - 'CredentialProofingMethod', -] \ No newline at end of file + "Credential", + "CredentialList", + "Password", + "U2F", + "FidoCredential", + "Webauthn", + "CredentialProofingMethod", +] diff --git a/src/eduid/userdb/db/__init__.py b/src/eduid/userdb/db/__init__.py index 8bbb0f42e..c8cc0a0d6 100644 --- a/src/eduid/userdb/db/__init__.py +++ b/src/eduid/userdb/db/__init__.py @@ -3,9 +3,9 @@ # Keep existing imports working from eduid.userdb.db.sync_db import BaseDB, MongoDB, SaveResult, TUserDbDocument -__all__ = [ - 'BaseDB', - 'MongoDB', - 'SaveResult', - 'TUserDbDocument', -] \ No newline at end of file +__all__ = [ + "BaseDB", + "MongoDB", + "SaveResult", + "TUserDbDocument", +] diff --git a/src/eduid/userdb/group_management/__init__.py b/src/eduid/userdb/group_management/__init__.py index 7575a86e4..04d60d364 100644 --- a/src/eduid/userdb/group_management/__init__.py +++ b/src/eduid/userdb/group_management/__init__.py @@ -2,9 +2,9 @@ from eduid.userdb.group_management.state import GroupInviteState, GroupRole __all__ = [ - 'GroupManagementInviteStateDB', - 'GroupInviteState', - 'GroupRole', + "GroupManagementInviteStateDB", + "GroupInviteState", + "GroupRole", ] __author__ = "lundberg" diff --git a/src/eduid/userdb/idp/__init__.py b/src/eduid/userdb/idp/__init__.py index 067c188a1..52fa07057 100644 --- a/src/eduid/userdb/idp/__init__.py +++ b/src/eduid/userdb/idp/__init__.py @@ -1,7 +1,7 @@ from .db import IdPUserDb from .user import IdPUser -__all__ = [ - 'IdPUser', - 'IdPUserDb', -] \ No newline at end of file +__all__ = [ + "IdPUser", + "IdPUserDb", +] diff --git a/src/eduid/userdb/logs/__init__.py b/src/eduid/userdb/logs/__init__.py index 110640706..9ce82651b 100644 --- a/src/eduid/userdb/logs/__init__.py +++ b/src/eduid/userdb/logs/__init__.py @@ -12,18 +12,18 @@ TeleAdressProofingRelation, ) -__all__ = [ - 'ProofingLog', - 'LetterProofing', - 'MailAddressProofing', - 'MFATokenProofing', - 'OrcidProofing', - 'PhoneNumberProofing', - 'SeLegProofing', - 'SeLegProofingFrejaEid', - 'SwedenConnectProofing', - 'TeleAdressProofing', - 'TeleAdressProofingRelation', +__all__ = [ + "ProofingLog", + "LetterProofing", + "MailAddressProofing", + "MFATokenProofing", + "OrcidProofing", + "PhoneNumberProofing", + "SeLegProofing", + "SeLegProofingFrejaEid", + "SwedenConnectProofing", + "TeleAdressProofing", + "TeleAdressProofingRelation", ] __author__ = "lundberg" diff --git a/src/eduid/userdb/maccapi/__init__.py b/src/eduid/userdb/maccapi/__init__.py index 229fe743d..2ff420727 100644 --- a/src/eduid/userdb/maccapi/__init__.py +++ b/src/eduid/userdb/maccapi/__init__.py @@ -1,6 +1,6 @@ from eduid.userdb.maccapi.userdb import ManagedAccount, ManagedAccountDB __all__ = [ - 'ManagedAccount', - 'ManagedAccountDB', -] \ No newline at end of file + "ManagedAccount", + "ManagedAccountDB", +] diff --git a/src/eduid/userdb/personal_data/__init__.py b/src/eduid/userdb/personal_data/__init__.py index 61ed1ddda..9d87d65ef 100644 --- a/src/eduid/userdb/personal_data/__init__.py +++ b/src/eduid/userdb/personal_data/__init__.py @@ -2,8 +2,8 @@ from eduid.userdb.personal_data.user import PersonalDataUser __all__ = [ - 'PersonalDataUserDB', - 'PersonalDataUser', + "PersonalDataUserDB", + "PersonalDataUser", ] __author__ = "lundberg" diff --git a/src/eduid/userdb/proofing/__init__.py b/src/eduid/userdb/proofing/__init__.py index 9509e6145..8b27afbe4 100644 --- a/src/eduid/userdb/proofing/__init__.py +++ b/src/eduid/userdb/proofing/__init__.py @@ -14,7 +14,6 @@ ) - from eduid.userdb.proofing.element import EmailProofingElement, NinProofingElement, PhoneProofingElement from eduid.userdb.proofing.state import ( EmailProofingState, @@ -26,25 +25,25 @@ from eduid.userdb.proofing.user import ProofingUser __all__ = [ - 'EidasProofingUserDB', - 'EmailProofingStateDB', - 'EmailProofingUserDB', - 'LetterProofingStateDB', - 'LetterProofingUserDB', - 'LookupMobileProofingUserDB', - 'OidcProofingStateDB', - 'OidcProofingUserDB', - 'OrcidProofingStateDB', - 'OrcidProofingUserDB', - 'PhoneProofingStateDB', - 'PhoneProofingUserDB', - 'ProofingUser', - 'LetterProofingState', - 'EmailProofingState', - 'OidcProofingState', - 'OrcidProofingState', - 'PhoneProofingState', - 'EmailProofingElement', - 'NinProofingElement', - 'PhoneProofingElement', + "EidasProofingUserDB", + "EmailProofingStateDB", + "EmailProofingUserDB", + "LetterProofingStateDB", + "LetterProofingUserDB", + "LookupMobileProofingUserDB", + "OidcProofingStateDB", + "OidcProofingUserDB", + "OrcidProofingStateDB", + "OrcidProofingUserDB", + "PhoneProofingStateDB", + "PhoneProofingUserDB", + "ProofingUser", + "LetterProofingState", + "EmailProofingState", + "OidcProofingState", + "OrcidProofingState", + "PhoneProofingState", + "EmailProofingElement", + "NinProofingElement", + "PhoneProofingElement", ] diff --git a/src/eduid/userdb/reset_password/__init__.py b/src/eduid/userdb/reset_password/__init__.py index de52039b0..13d29c587 100644 --- a/src/eduid/userdb/reset_password/__init__.py +++ b/src/eduid/userdb/reset_password/__init__.py @@ -7,10 +7,10 @@ from eduid.userdb.reset_password.user import ResetPasswordUser __all__ = [ - 'ResetPasswordStateDB', - 'ResetPasswordUserDB', - 'ResetPasswordState', - 'ResetPasswordEmailState', - 'ResetPasswordEmailAndPhoneState', - 'ResetPasswordUser', + "ResetPasswordStateDB", + "ResetPasswordUserDB", + "ResetPasswordState", + "ResetPasswordEmailState", + "ResetPasswordEmailAndPhoneState", + "ResetPasswordUser", ] diff --git a/src/eduid/userdb/scimapi/__init__.py b/src/eduid/userdb/scimapi/__init__.py index c4211978a..9048eb712 100644 --- a/src/eduid/userdb/scimapi/__init__.py +++ b/src/eduid/userdb/scimapi/__init__.py @@ -19,20 +19,20 @@ from eduid.userdb.scimapi.userdb import ScimApiUser, ScimApiUserDB __all__ = [ - 'ScimApiUser', - 'ScimApiUserDB', - 'ScimApiGroup', - 'ScimApiGroupDB', - 'ScimApiEvent', - 'ScimApiEventDB', - 'ScimApiEventResource', - 'ScimApiResourceBase', - 'ScimApiName', - 'ScimApiEmail', - 'ScimApiPhoneNumber', - 'ScimApiProfile', - 'ScimApiLinkedAccount', - 'EventLevel', - 'EventStatus', - 'GroupExtensions', -] \ No newline at end of file + "ScimApiUser", + "ScimApiUserDB", + "ScimApiGroup", + "ScimApiGroupDB", + "ScimApiEvent", + "ScimApiEventDB", + "ScimApiEventResource", + "ScimApiResourceBase", + "ScimApiName", + "ScimApiEmail", + "ScimApiPhoneNumber", + "ScimApiProfile", + "ScimApiLinkedAccount", + "EventLevel", + "EventStatus", + "GroupExtensions", +] diff --git a/src/eduid/userdb/security/__init__.py b/src/eduid/userdb/security/__init__.py index 6939bdb45..cf581e014 100644 --- a/src/eduid/userdb/security/__init__.py +++ b/src/eduid/userdb/security/__init__.py @@ -3,12 +3,12 @@ from eduid.userdb.security.user import SecurityUser __all__ = [ - 'PasswordResetState', - 'PasswordResetEmailState', - 'PasswordResetEmailAndPhoneState', - 'PasswordResetStateDB', - 'SecurityUser', - 'SecurityUserDB', + "PasswordResetState", + "PasswordResetEmailState", + "PasswordResetEmailAndPhoneState", + "PasswordResetStateDB", + "SecurityUser", + "SecurityUserDB", ] __author__ = "lundberg" diff --git a/src/eduid/userdb/security/db.py b/src/eduid/userdb/security/db.py index 5a0b72b4d..941066b06 100644 --- a/src/eduid/userdb/security/db.py +++ b/src/eduid/userdb/security/db.py @@ -67,7 +67,7 @@ def get_state_by_eppn(self, eppn: str) -> Optional[PasswordResetState]: @staticmethod def init_state( - data: Mapping[str, Any] + data: Mapping[str, Any], ) -> Optional[Union[PasswordResetEmailState, PasswordResetEmailAndPhoneState]]: _data = dict(copy.deepcopy(data)) # to not modify callers data method = _data.pop("method", None) diff --git a/src/eduid/userdb/signup/__init__.py b/src/eduid/userdb/signup/__init__.py index b08a8fca6..fa2618cc4 100644 --- a/src/eduid/userdb/signup/__init__.py +++ b/src/eduid/userdb/signup/__init__.py @@ -4,12 +4,12 @@ from eduid.userdb.signup.userdb import SignupUserDB __all__ = [ - 'SignupUser', - 'SignupUserDB', - 'Invite', - 'InviteMailAddress', - 'InvitePhoneNumber', - 'InviteType', - 'SCIMReference', - 'SignupInviteDB' -] \ No newline at end of file + "SignupUser", + "SignupUserDB", + "Invite", + "InviteMailAddress", + "InvitePhoneNumber", + "InviteType", + "SCIMReference", + "SignupInviteDB", +] diff --git a/src/eduid/userdb/support/__init__.py b/src/eduid/userdb/support/__init__.py index 39cc03622..6a0a09e72 100644 --- a/src/eduid/userdb/support/__init__.py +++ b/src/eduid/userdb/support/__init__.py @@ -9,13 +9,13 @@ ) __all__ = [ - 'SupportAuthnInfoDB', - 'SupportEmailProofingDB', - 'SupportLetterProofingDB', - 'SupportOidcProofingDB', - 'SupportPhoneProofingDB', - 'SupportProofingDB', - 'SupportProofingLogDB', + "SupportAuthnInfoDB", + "SupportEmailProofingDB", + "SupportLetterProofingDB", + "SupportOidcProofingDB", + "SupportPhoneProofingDB", + "SupportProofingDB", + "SupportProofingLogDB", ] __author__ = "lundberg" diff --git a/src/eduid/webapp/common/authn/tests/responses.py b/src/eduid/webapp/common/authn/tests/responses.py index c05117edf..908627166 100644 --- a/src/eduid/webapp/common/authn/tests/responses.py +++ b/src/eduid/webapp/common/authn/tests/responses.py @@ -109,9 +109,7 @@ def logout_response(session_id: str) -> str: -""".format( - now=timestamp.strftime("%Y-%m-%dT%H:%M:%SZ"), session_id=session_id - ) +""".format(now=timestamp.strftime("%Y-%m-%dT%H:%M:%SZ"), session_id=session_id) return saml_logout_response diff --git a/src/eduid/webapp/common/proofing/methods.py b/src/eduid/webapp/common/proofing/methods.py index d792b520f..73a258172 100644 --- a/src/eduid/webapp/common/proofing/methods.py +++ b/src/eduid/webapp/common/proofing/methods.py @@ -124,7 +124,6 @@ def get_proofing_method( frontend_action: FrontendAction, config: ProofingConfigMixin, ) -> Optional[Union[ProofingMethodFreja, ProofingMethodEidas, ProofingMethodSvipe, ProofingMethodBankID]]: - authn_params = config.frontend_action_authn_parameters.get(frontend_action) assert authn_params is not None # please mypy diff --git a/src/eduid/webapp/eidas/tests/test_app.py b/src/eduid/webapp/eidas/tests/test_app.py index 4cb6da88f..fc459d7f2 100644 --- a/src/eduid/webapp/eidas/tests/test_app.py +++ b/src/eduid/webapp/eidas/tests/test_app.py @@ -1250,7 +1250,6 @@ def test_mfa_authentication_verified_user(self, mock_request_user_sync: MagicMoc assert cred.level in self.app.conf.required_loa def test_mfa_authentication_too_old_authn_instant(self): - self.reauthn( endpoint="/mfa-authenticate", next_url=self.default_redirect_url, diff --git a/src/eduid/webapp/email/verifications.py b/src/eduid/webapp/email/verifications.py index 284a345a2..ad9255f94 100644 --- a/src/eduid/webapp/email/verifications.py +++ b/src/eduid/webapp/email/verifications.py @@ -35,7 +35,6 @@ def new_proofing_state(email: str, user: User): def send_verification_code(email: str, user: User) -> bool: - state = new_proofing_state(email, user) if state is None: return False diff --git a/src/eduid/webapp/idp/login.py b/src/eduid/webapp/idp/login.py index eb09e5e16..2a3cf9399 100644 --- a/src/eduid/webapp/idp/login.py +++ b/src/eduid/webapp/idp/login.py @@ -58,6 +58,7 @@ """ Code handling Single Sign On logins. """ + import hmac import pprint import time diff --git a/src/eduid/webapp/idp/mischttp.py b/src/eduid/webapp/idp/mischttp.py index 421601b96..14f6e9bb4 100644 --- a/src/eduid/webapp/idp/mischttp.py +++ b/src/eduid/webapp/idp/mischttp.py @@ -58,6 +58,7 @@ """ Miscellaneous HTTP related functions. """ + from __future__ import annotations import logging diff --git a/src/eduid/webapp/idp/service.py b/src/eduid/webapp/idp/service.py index c5aba7ec8..c5c33014f 100644 --- a/src/eduid/webapp/idp/service.py +++ b/src/eduid/webapp/idp/service.py @@ -58,6 +58,7 @@ """ Common code for SSO login/logout requests. """ + from abc import ABC from typing import Any, Optional diff --git a/src/eduid/webapp/idp/tests/test_login.py b/src/eduid/webapp/idp/tests/test_login.py index c7f33fcbd..062dc8fe6 100644 --- a/src/eduid/webapp/idp/tests/test_login.py +++ b/src/eduid/webapp/idp/tests/test_login.py @@ -28,7 +28,6 @@ class IdPTestLoginAPI(IdPAPITests): - def test_login_start(self) -> None: result = self._try_login(test_user=TestUser(eppn=None, password=None)) diff --git a/src/eduid/webapp/personal_data/views.py b/src/eduid/webapp/personal_data/views.py index a63dbc205..20eba64af 100644 --- a/src/eduid/webapp/personal_data/views.py +++ b/src/eduid/webapp/personal_data/views.py @@ -98,7 +98,6 @@ def get_user_preferences(user: User) -> FluxData: @MarshalWith(UserPreferencesResponseSchema) @require_user def set_user_preferences(user: User, always_use_security_key: bool) -> FluxData: - # When we get more user preferences we should probably split them into different groups # and have a separate endpoint for each group and FrontendAction. frontend_action = FrontendAction.CHANGE_SECURITY_PREFERENCES_AUTHN diff --git a/src/eduid/webapp/security/helpers.py b/src/eduid/webapp/security/helpers.py index 3ea103c28..08f0c4db0 100644 --- a/src/eduid/webapp/security/helpers.py +++ b/src/eduid/webapp/security/helpers.py @@ -254,7 +254,6 @@ def get_approved_security_keys() -> dict[str, Any]: # a way to reuse is_authenticator_mfa_approved() from security app parsed_entries: List[AuthenticatorInformation] = [] for metadata_entry in current_app.fido_mds.metadata.entries: - user_verification_methods = [ detail.user_verification_method for detail in metadata_entry.metadata_statement.get_user_verification_details() diff --git a/src/eduid/webapp/security/views/webauthn.py b/src/eduid/webapp/security/views/webauthn.py index 9ea99fc5f..d3a9304e6 100644 --- a/src/eduid/webapp/security/views/webauthn.py +++ b/src/eduid/webapp/security/views/webauthn.py @@ -86,7 +86,6 @@ def make_credentials(creds: Sequence[FidoCredential]) -> list[AttestedCredential @MarshalWith(FluxStandardAction) @require_user def registration_begin(user: User, authenticator: str) -> FluxData: - frontend_action = FrontendAction.ADD_SECURITY_KEY_AUTHN _need_reauthn = check_reauthn(frontend_action=frontend_action, user=user) @@ -239,7 +238,6 @@ def registration_complete( @MarshalWith(SecurityResponseSchema) @require_user def remove(user: User, credential_key: str) -> FluxData: - frontend_action = FrontendAction.REMOVE_SECURITY_KEY_AUTHN _need_reauthn = check_reauthn(frontend_action=frontend_action, user=user) diff --git a/src/eduid/webapp/signup/schemas.py b/src/eduid/webapp/signup/schemas.py index 80004f4e3..7eb947d7c 100644 --- a/src/eduid/webapp/signup/schemas.py +++ b/src/eduid/webapp/signup/schemas.py @@ -80,9 +80,9 @@ def throttle_delta_to_seconds(self, out_data, **kwargs): throttle_time_left = time_left(sent_at, current_app.conf.throttle_resend).total_seconds() if throttle_time_left > 0: out_data["payload"]["state"]["email"]["throttle_time_left"] = throttle_time_left - out_data["payload"]["state"]["email"][ - "throttle_time_max" - ] = current_app.conf.throttle_resend.total_seconds() + out_data["payload"]["state"]["email"]["throttle_time_max"] = ( + current_app.conf.throttle_resend.total_seconds() + ) return out_data @pre_dump @@ -92,17 +92,17 @@ def email_verification_timeout_delta_to_seconds(self, out_data, **kwargs): verification_time_left = time_left(sent_at, current_app.conf.email_verification_timeout).total_seconds() if verification_time_left > 0: out_data["payload"]["state"]["email"]["expires_time_left"] = verification_time_left - out_data["payload"]["state"]["email"][ - "expires_time_max" - ] = current_app.conf.email_verification_timeout.total_seconds() + out_data["payload"]["state"]["email"]["expires_time_max"] = ( + current_app.conf.email_verification_timeout.total_seconds() + ) return out_data @pre_dump def bad_attempts_max(self, out_data, **kwargs): if out_data["payload"].get("state", {}).get("email"): - out_data["payload"]["state"]["email"][ - "bad_attempts_max" - ] = current_app.conf.email_verification_max_bad_attempts + out_data["payload"]["state"]["email"]["bad_attempts_max"] = ( + current_app.conf.email_verification_max_bad_attempts + ) return out_data diff --git a/src/eduid/webapp/support/helpers.py b/src/eduid/webapp/support/helpers.py index 1334d06f1..7beeb16c1 100644 --- a/src/eduid/webapp/support/helpers.py +++ b/src/eduid/webapp/support/helpers.py @@ -32,7 +32,7 @@ def get_credentials_aux_data(user: User) -> list[TUserDbDocument]: def require_support_personnel( - f: Callable[..., TRequireSupportPersonnelResult] + f: Callable[..., TRequireSupportPersonnelResult], ) -> Callable[..., TRequireSupportPersonnelResult]: @wraps(f) def require_support_decorator(*args: Any, **kwargs: Any): diff --git a/src/eduid/workers/am/tests/test_proofing_fetchers.py b/src/eduid/workers/am/tests/test_proofing_fetchers.py index 085499914..ecbb9a3c1 100644 --- a/src/eduid/workers/am/tests/test_proofing_fetchers.py +++ b/src/eduid/workers/am/tests/test_proofing_fetchers.py @@ -187,8 +187,8 @@ def test_append_attributes_letter_proofing_data(self): "$unset": {"nins": None}, } - assert normalised_data(fetched3) == normalised_data( - expected + assert ( + normalised_data(fetched3) == normalised_data(expected) ), f"Fetched (3d time) letter proofing data with appended attributes has unexpected data: {DeepDiff(fetched, expected)}" diff --git a/src/eduid/workers/job_runner/scheduler.py b/src/eduid/workers/job_runner/scheduler.py index 44d1e1ea3..ebffd1c85 100644 --- a/src/eduid/workers/job_runner/scheduler.py +++ b/src/eduid/workers/job_runner/scheduler.py @@ -7,7 +7,6 @@ class JobScheduler(AsyncIOScheduler): - def schedule_jobs(self, context: Context): """ Schedule all jobs configured for host or environment diff --git a/src/eduid/workers/job_runner/tests/test_user_cleaner.py b/src/eduid/workers/job_runner/tests/test_user_cleaner.py index 65c71b31e..1b66cdcdd 100644 --- a/src/eduid/workers/job_runner/tests/test_user_cleaner.py +++ b/src/eduid/workers/job_runner/tests/test_user_cleaner.py @@ -1,4 +1,3 @@ - from eduid.userdb.fixtures.users import UserFixtures from eduid.userdb.meta import CleanerType from eduid.userdb.user_cleaner.db import CleanerQueueUser From 988c8c106e223387492c67b3995fad92bce4a9d2 Mon Sep 17 00:00:00 2001 From: Lasse Yledahl Date: Wed, 4 Sep 2024 08:15:14 +0000 Subject: [PATCH 16/28] remove double import --- src/eduid/webapp/idp/tests/test_SSO.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/eduid/webapp/idp/tests/test_SSO.py b/src/eduid/webapp/idp/tests/test_SSO.py index 7da0e227e..1cf2c152d 100644 --- a/src/eduid/webapp/idp/tests/test_SSO.py +++ b/src/eduid/webapp/idp/tests/test_SSO.py @@ -18,7 +18,7 @@ from eduid.webapp.common.session import session from eduid.webapp.common.session.logindata import ExternalMfaData from eduid.webapp.common.session.namespaces import IdP_SAMLPendingRequest, RequestRef -from eduid.webapp.idp.assurance_data import EduidAuthnContextClass, SwamidAssurance +from eduid.webapp.idp.assurance_data import SwamidAssurance from eduid.webapp.idp.helpers import IdPMsg from eduid.webapp.idp.idp_authn import AuthnData from eduid.webapp.idp.idp_saml import IdP_SAMLRequest, ServiceInfo From 1b65f4c40006215f8a3e53b8e1cf57f450ce0d80 Mon Sep 17 00:00:00 2001 From: Lasse Yledahl Date: Wed, 4 Sep 2024 08:26:12 +0000 Subject: [PATCH 17/28] follow pycodestyle readability, E713 --- src/eduid/common/config/parsers/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/eduid/common/config/parsers/__init__.py b/src/eduid/common/config/parsers/__init__.py index c8e495c45..fdd6ca528 100644 --- a/src/eduid/common/config/parsers/__init__.py +++ b/src/eduid/common/config/parsers/__init__.py @@ -45,7 +45,7 @@ def load_config( # Looks like there could be a FlaskConfig mixed into the config config["flask"] = FlaskConfig(**config) - if "celery_config" in config and not "celery" in config: + if "celery_config" in config and "celery" not in config: config["celery"] = config["celery_config"] if "app_name" not in config: From e188757de30996e04083f7d021a731f28b360eb9 Mon Sep 17 00:00:00 2001 From: Lasse Yledahl Date: Wed, 4 Sep 2024 09:39:29 +0000 Subject: [PATCH 18/28] do not use bare except --- src/eduid/scimapi/routers/utils/groups.py | 2 +- src/eduid/webapp/common/authn/fido_tokens.py | 2 +- src/eduid/webapp/idp/decorators.py | 2 +- src/eduid/webapp/idp/views/next.py | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/eduid/scimapi/routers/utils/groups.py b/src/eduid/scimapi/routers/utils/groups.py index 8028940ba..1c2c09c02 100644 --- a/src/eduid/scimapi/routers/utils/groups.py +++ b/src/eduid/scimapi/routers/utils/groups.py @@ -93,7 +93,7 @@ def filter_lastmodified( raise BadRequest(scim_type="invalidFilter", detail="Invalid datetime") try: _parsed = datetime.fromisoformat(filter.val) - except: + except Exception: raise BadRequest(scim_type="invalidFilter", detail="Invalid datetime") return req.context.groupdb.get_groups_by_last_modified(operator=filter.op, value=_parsed, skip=skip, limit=limit) diff --git a/src/eduid/webapp/common/authn/fido_tokens.py b/src/eduid/webapp/common/authn/fido_tokens.py index 32f32b496..118103d7f 100644 --- a/src/eduid/webapp/common/authn/fido_tokens.py +++ b/src/eduid/webapp/common/authn/fido_tokens.py @@ -152,7 +152,7 @@ def _decode(key: str) -> bytes: data = request_dict[key] data += "=" * (len(data) % 4) return base64.urlsafe_b64decode(data) - except: + except Exception: logger.exception(f"Failed to find/b64decode Webauthn parameter {key}: {request_dict.get(key)}") raise VerificationProblem("mfa.bad-token-response") # XXX add bad-token-response to frontend diff --git a/src/eduid/webapp/idp/decorators.py b/src/eduid/webapp/idp/decorators.py index fb9bd7a9b..b07e82bbe 100644 --- a/src/eduid/webapp/idp/decorators.py +++ b/src/eduid/webapp/idp/decorators.py @@ -43,7 +43,7 @@ def require_ticket_decorator(*args, **kwargs): ticket.known_device_info = BrowserDeviceInfo.from_public( this_device, current_app.known_device_db.app_secret_box ) - except: + except Exception: logger.exception("Couldn't parse the this_device supplied") logger.debug(f"Extra debug: Known device: {this_device}") pass diff --git a/src/eduid/webapp/idp/views/next.py b/src/eduid/webapp/idp/views/next.py index a63faf1e6..236cc85f1 100644 --- a/src/eduid/webapp/idp/views/next.py +++ b/src/eduid/webapp/idp/views/next.py @@ -163,7 +163,7 @@ def next_view(ticket: LoginContext, sso_session: Optional[SSOSession]) -> FluxDa try: # Logging stats is optional, make sure we never fail a login because of it _log_user_agent() - except: + except Exception: current_app.logger.exception("Producing User-Agent stats failed") if current_app.conf.known_devices_feature_enabled: @@ -181,7 +181,7 @@ def next_view(ticket: LoginContext, sso_session: Optional[SSOSession]) -> FluxDa try: # Logging stats is optional, make sure we never fail a login because of it _geo_statistics(ticket=ticket, sso_session=sso_session) - except: + except Exception: current_app.logger.exception("Producing Geo stats failed") if isinstance(ticket, LoginContextSAML): @@ -312,7 +312,7 @@ def _get_service_info(ticket: LoginContext) -> dict[str, Any]: try: if ticket.service_info is not None: return ticket.service_info.to_dict() - except: + except Exception: current_app.logger.exception("Failed getting service info for SP") return {} From 2a0366b2ea6d39b80add5ec598c60c62eaea1117 Mon Sep 17 00:00:00 2001 From: Lasse Yledahl Date: Wed, 4 Sep 2024 09:46:56 +0000 Subject: [PATCH 19/28] remove old try/except --- src/eduid/userdb/user.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/eduid/userdb/user.py b/src/eduid/userdb/user.py index 033e6e44c..4815aa7ce 100644 --- a/src/eduid/userdb/user.py +++ b/src/eduid/userdb/user.py @@ -400,11 +400,7 @@ def _parse_ladok(cls, data: dict[str, Any]) -> Optional[Ladok]: """ ladok = data.pop("ladok", None) if ladok is not None: - # TODO: This try/except is to flush out old format of ladok data from development, remove soon! - try: - return Ladok.from_dict(ladok) - except: - return None + return Ladok.from_dict(ladok) return None @classmethod From 68e48886fe9ec4d257cc3d71721158dc757df750 Mon Sep 17 00:00:00 2001 From: Lasse Yledahl Date: Thu, 5 Sep 2024 12:08:56 +0000 Subject: [PATCH 20/28] make sure mocked function applies to test --- .../webapp/security/tests/test_webauthn.py | 32 +++++++------------ 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/src/eduid/webapp/security/tests/test_webauthn.py b/src/eduid/webapp/security/tests/test_webauthn.py index ef262c17f..0ec2ea12b 100644 --- a/src/eduid/webapp/security/tests/test_webauthn.py +++ b/src/eduid/webapp/security/tests/test_webauthn.py @@ -3,6 +3,8 @@ from typing import Any, Mapping, Optional from unittest.mock import patch +from fido_mds import FidoMetadataStore + from fido2.webauthn import AttestationObject, AuthenticatorAttachment, CollectedClientData from werkzeug.http import dump_cookie @@ -23,7 +25,7 @@ # result of calling Fido2Server.register_begin from fido_mds import Attestation from fido_mds.models.webauthn import AttestationFormat -from fido_mds.tests.data import IPHONE_12, MICROSOFT_SURFACE_1796, NEXUS_5, YUBIKEY_4, YUBIKEY_5_NFC +from fido_mds.tests.data import IPHONE_12, MICROSOFT_SURFACE_1796, NEXUS_5, YUBIKEY_4, YUBIKEY_5_NFC, NONE_ATTESTATION # CTAP1 security key STATE = {"challenge": "u3zHzb7krB4c4wj0Uxuhsz2lCXqLnwV9ZxMhvL2lcfo", "user_verification": "discouraged"} @@ -352,20 +354,19 @@ def _remove( response2 = client.post("/webauthn/remove", json=data) return user_token, json.loads(response2.data) - def _apple_special_verify_attestation(self, attestation: Attestation, client_data: bytes) -> bool: + def _apple_special_verify_attestation(self: FidoMetadataStore, attestation: Attestation, client_data: bytes) -> bool: if attestation.fmt is AttestationFormat.PACKED: - return self.app.fido_mds.verify_packed_attestation(attestation=attestation, client_data=client_data) + return self.verify_packed_attestation(attestation=attestation, client_data=client_data) if attestation.fmt is AttestationFormat.APPLE: - # apple attestation cert is only valid for three days + # apple attestation cert in fido_mds test data is only valid for three days return True if attestation.fmt is AttestationFormat.TPM: - return self.app.fido_mds.verify_tpm_attestation(attestation=attestation, client_data=client_data) + return self.verify_tpm_attestation(attestation=attestation, client_data=client_data) if attestation.fmt is AttestationFormat.ANDROID_SAFETYNET: - return self.app.fido_mds.verify_android_safetynet_attestation( - attestation=attestation, client_data=client_data - ) + # android attestation cert in fido_mds test data is only valid for three months + return True if attestation.fmt is AttestationFormat.FIDO_U2F: - return self.app.fido_mds.verify_fido_u2f_attestation(attestation=attestation, client_data=client_data) + return self.verify_fido_u2f_attestation(attestation=attestation, client_data=client_data) raise NotImplementedError(f"verification of {attestation.fmt.value} not implemented") # actual tests @@ -566,17 +567,8 @@ def test_remove_wrong_csrf(self): self.assertEqual(data["type"], "POST_WEBAUTHN_WEBAUTHN_REMOVE_FAIL") self.assertEqual(data["payload"]["error"]["csrf_token"], ["CSRF failed to validate"]) - @patch("fido_mds.FidoMetadataStore.verify_attestation") - def test_authenticator_information(self, mock_verify_attestation): - mock_verify_attestation = self._apple_special_verify_attestation - - none_attestation_object = """o2NmbXRkbm9uZWdhdHRTdG10oGhhdXRoRGF0YViYxj7KDbeWdwEtucH8hAuBSeGOZxHTsdSGjUDkRxEY - LMJdAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCRvlr2y1QgLxAbJYI1H-HBYDyMcpQECAyYgASFYIGjY1rmhCeHsVeb2o2sNKcJp67MJG785al2g1uAM - IVwJIlggsQ4QvdBJpB721HU4hbYknS-JhNtE0kM01_c2FKHm7Lc""" - none_client_data = """eyJ0eXBlIjoid2ViYXV0aG4uY3JlYXRlIiwiY2hhbGxlbmdlIjoiMFlJdWs0S0s2YjhCaU1yOFh6dUFFM2c2Z1d - ZOWEyd1RkWlpuamhjQXNJTSIsIm9yaWdpbiI6Imh0dHBzOi8vZGFzaGJvYXJkLmRldi5lZHVpZC5zZSJ9""" - NONE_ATTESTATION = (none_attestation_object, none_client_data) - + @patch("fido_mds.FidoMetadataStore.verify_attestation", _apple_special_verify_attestation) + def test_authenticator_information(self): authenticators = [YUBIKEY_4, YUBIKEY_5_NFC, MICROSOFT_SURFACE_1796, NEXUS_5, IPHONE_12, NONE_ATTESTATION] for authenticator in authenticators: with self.app.test_request_context(): From 4b22ec637e7f3dc694195e0dee2bb0384ff136ab Mon Sep 17 00:00:00 2001 From: Lasse Yledahl Date: Thu, 5 Sep 2024 12:10:28 +0000 Subject: [PATCH 21/28] remove import directory from repository migration work --- import/eduid_msg/.coveragerc | 13 ---- .../.github/workflows/codeql-analysis.yml | 68 ------------------- .../.github/workflows/run-tests.yaml | 55 --------------- import/eduid_msg/.gitignore | 6 -- import/eduid_msg/.jenkins.yaml | 39 ----------- import/eduid_msg/Dockerfile | 33 --------- import/eduid_msg/LICENSE.txt | 25 ------- import/eduid_msg/Makefile | 22 ------ import/eduid_msg/README.rst | 1 - import/eduid_msg/docker/build.sh | 18 ----- import/eduid_msg/docker/setup.sh | 13 ---- import/eduid_msg/docker/start.sh | 47 ------------- import/eduid_msg/pytest.ini | 3 - import/eduid_msg/setup.cfg | 9 --- import/eduid_msg/setup.py | 54 --------------- import/import-repos.sh | 34 ---------- import/move-files.sh | 35 ---------- import/update-imports.sh | 63 ----------------- 18 files changed, 538 deletions(-) delete mode 100644 import/eduid_msg/.coveragerc delete mode 100644 import/eduid_msg/.github/workflows/codeql-analysis.yml delete mode 100644 import/eduid_msg/.github/workflows/run-tests.yaml delete mode 100644 import/eduid_msg/.gitignore delete mode 100644 import/eduid_msg/.jenkins.yaml delete mode 100644 import/eduid_msg/Dockerfile delete mode 100644 import/eduid_msg/LICENSE.txt delete mode 100644 import/eduid_msg/Makefile delete mode 100644 import/eduid_msg/README.rst delete mode 100755 import/eduid_msg/docker/build.sh delete mode 100755 import/eduid_msg/docker/setup.sh delete mode 100755 import/eduid_msg/docker/start.sh delete mode 100644 import/eduid_msg/pytest.ini delete mode 100644 import/eduid_msg/setup.cfg delete mode 100755 import/eduid_msg/setup.py delete mode 100755 import/import-repos.sh delete mode 100755 import/move-files.sh delete mode 100755 import/update-imports.sh diff --git a/import/eduid_msg/.coveragerc b/import/eduid_msg/.coveragerc deleted file mode 100644 index 6d5d3b445..000000000 --- a/import/eduid_msg/.coveragerc +++ /dev/null @@ -1,13 +0,0 @@ -[run] -branch = True -source = eduid_webapp - -[report] -exclude_lines = - if self.debug: - pragma: no cover - raise NotImplementedError - if __name__ == .__main__.: -ignore_errors = True -omit = - tests/* diff --git a/import/eduid_msg/.github/workflows/codeql-analysis.yml b/import/eduid_msg/.github/workflows/codeql-analysis.yml deleted file mode 100644 index 66f290b43..000000000 --- a/import/eduid_msg/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,68 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -name: "CodeQL" - -on: - push: - branches: [master] - pull_request: - # The branches below must be a subset of the branches above - branches: [master] - schedule: - - cron: '0 6 * * 4' - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - language: ['python'] - env: - PIP_INDEX_URL: https://pypi.sunet.se/simple/ - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - # We must fetch at least the immediate parents so that if this is - # a pull request then we can checkout the head. - fetch-depth: 2 - - # If this run was triggered by a pull request event, then checkout - # the head of the pull request instead of the merge commit. - - run: git checkout HEAD^2 - if: ${{ github.event_name == 'pull_request' }} - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v1 - - # ℹī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - - #- run: | - # make bootstrap - # make release - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 diff --git a/import/eduid_msg/.github/workflows/run-tests.yaml b/import/eduid_msg/.github/workflows/run-tests.yaml deleted file mode 100644 index e6076291d..000000000 --- a/import/eduid_msg/.github/workflows/run-tests.yaml +++ /dev/null @@ -1,55 +0,0 @@ -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - -name: Python package - -on: [push, pull_request] - -jobs: - - unittests: - runs-on: ubuntu-18.04 - strategy: - matrix: - python-version: [3.8] - env: - PIP_INDEX_URL: https://pypi.sunet.se/simple/ - - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r test_requirements.txt - - - name: Fetch docker images - run: | - docker pull docker.sunet.se/eduid/mongodb:latest - - - name: Test with pytest - run: | - make test - - typecheck: - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - - - name: Set up Python 3.x - uses: actions/setup-python@v2 - with: - python-version: 3.x - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install mypy pydantic - - - name: Run mypy to check types - run: | - make typecheck diff --git a/import/eduid_msg/.gitignore b/import/eduid_msg/.gitignore deleted file mode 100644 index c62bb0ff8..000000000 --- a/import/eduid_msg/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -*.pyc -build/ -.idea/ -*.egg-info -dist/ -.mypy_cache/ diff --git a/import/eduid_msg/.jenkins.yaml b/import/eduid_msg/.jenkins.yaml deleted file mode 100644 index a749d3e6f..000000000 --- a/import/eduid_msg/.jenkins.yaml +++ /dev/null @@ -1,39 +0,0 @@ -builders: - - script -upstream: - - eduid-userdb - - pysmscom - - eduid-common -triggers: - cron: "@weekly" -slack: - room: "eduid-builds" -python_module: eduid_msg -python_source_directory: eduid_msg -clean_workspace: true -publish_over_ssh: - - pypi.sunet.se - -extra_jobs: - - name: eduid-msg-docker - builders: - - docker - docker_name: eduid/eduid-msg - managed_scripts: - - docker_build_prep.sh - - docker_tag.sh - triggers: - github_push: false - cron: null - upstream: - - eduid-docker-python3env - - eduid_msg - -script: - - "python3.7 -m venv venv" - - ". venv/bin/activate" - - "pip install -U setuptools wheel mypy" - - "pip install --index-url https://pypi.sunet.se -r test_requirements.txt" - - "pytest" - - "mypy --ignore-missing-imports eduid_msg" - - "python setup.py sdist bdist_wheel --universal" diff --git a/import/eduid_msg/Dockerfile b/import/eduid_msg/Dockerfile deleted file mode 100644 index 235f49962..000000000 --- a/import/eduid_msg/Dockerfile +++ /dev/null @@ -1,33 +0,0 @@ -FROM docker.sunet.se/eduid/python3env - -MAINTAINER eduid-dev - -VOLUME ["/opt/eduid/eduid-msg/etc", "/var/log/eduid", "/opt/eduid/src"] - -RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y locales - -RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ - dpkg-reconfigure --frontend=noninteractive locales && \ - update-locale LANG=en_US.UTF-8 - -ENV LANG en_US.UTF-8 - -COPY . /src/eduid_msg -COPY docker/setup.sh /opt/eduid/setup.sh -RUN /opt/eduid/setup.sh - -COPY docker/start.sh /start.sh - -# Add Dockerfile to the container as documentation -COPY Dockerfile /Dockerfile - -# revision.txt is dynamically updated by the CI for every build, -# to ensure build.sh is executed every time -COPY docker/revision.txt /revision.txt - -COPY docker/build.sh /opt/eduid/build.sh -RUN /opt/eduid/build.sh - -WORKDIR / - -CMD ["bash", "/start.sh"] diff --git a/import/eduid_msg/LICENSE.txt b/import/eduid_msg/LICENSE.txt deleted file mode 100644 index 4be21ee76..000000000 --- a/import/eduid_msg/LICENSE.txt +++ /dev/null @@ -1,25 +0,0 @@ -Copyright 2013, 2014, 2015, 2018 SUNET. All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are -permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, this list of - conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, this list - of conditions and the following disclaimer in the documentation and/or other materials - provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY SUNET ``AS IS'' AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SUNET OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -The views and conclusions contained in the software and documentation are those of the -authors and should not be interpreted as representing official policies, either expressed -or implied, of SUNET. diff --git a/import/eduid_msg/Makefile b/import/eduid_msg/Makefile deleted file mode 100644 index 03b664da8..000000000 --- a/import/eduid_msg/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -SOURCE= eduid_msg -EDUIDCOMMON= ../eduid-common/src -EDUIDUSERDB= ../eduid-userdb/src -PIPCOMPILE= pip-compile --generate-hashes --extra-index-url https://pypi.sunet.se/simple - -test: - pytest --log-cli-level DEBUG - -reformat: - isort --line-width 120 --atomic --project eduid_webapp $(SOURCE) - black --line-length 120 --target-version py37 --skip-string-normalization $(SOURCE) - -typecheck: - mypy --ignore-missing-imports $(SOURCE) - -typecheck_extra: - mypy --ignore-missing-imports $(EDUIDCOMMON) $(EDUIDUSERDB) $(SOURCE) - -%ments.txt: %ments.in - CUSTOM_COMPILE_COMMAND="make update_deps" $(PIPCOMPILE) $< > $@ - -update_deps: $(patsubst %ments.in,%ments.txt,$(wildcard *ments.in)) diff --git a/import/eduid_msg/README.rst b/import/eduid_msg/README.rst deleted file mode 100644 index e016732c9..000000000 --- a/import/eduid_msg/README.rst +++ /dev/null @@ -1 +0,0 @@ -eduID Message Manager diff --git a/import/eduid_msg/docker/build.sh b/import/eduid_msg/docker/build.sh deleted file mode 100755 index d6a27edde..000000000 --- a/import/eduid_msg/docker/build.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# -# Run build commands that should never be docker-build cached -# - -set -e -set -x - -PYPI="https://pypi.sunet.se/simple/" -ping -c 1 -q pypiserver.docker && PYPI="http://pypiserver.docker:8080/simple/" - -echo "#############################################################" -echo "$0: Using PyPi URL ${PYPI}" -echo "#############################################################" - -/opt/eduid/bin/pip install --pre -i ${PYPI} /src/eduid_msg - -/opt/eduid/bin/pip freeze diff --git a/import/eduid_msg/docker/setup.sh b/import/eduid_msg/docker/setup.sh deleted file mode 100755 index a9e7efec8..000000000 --- a/import/eduid_msg/docker/setup.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -set -e - -# APT dependencys for eduid_msg -apt-get update -apt-get -y install \ - libxml2-dev \ - libxslt-dev \ - zlib1g-dev -apt-get clean -rm -rf /var/lib/apt/lists/* - diff --git a/import/eduid_msg/docker/start.sh b/import/eduid_msg/docker/start.sh deleted file mode 100755 index 81fc9f565..000000000 --- a/import/eduid_msg/docker/start.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh - -set -e -set -x - -# tmp test -export LANG=en_US.UTF-8 -export LANGUAGE=en_US:en - -# activate python virtualenv -. /opt/eduid/bin/activate - -# These could be set from Puppet if multiple instances are deployed -eduid_name=${eduid_name-'eduid-msg'} -eduid_queue=${eduid_queue-'msg'} -# this is a Python module name, so can't have hyphen -app_name=$(echo $eduid_name | tr "-" "_") -base_dir=${base_dir-"/opt/eduid/${eduid_name}"} -# These *can* be set from Puppet, but are less expected to... -log_dir=${log_dir-'/var/log/eduid'} -logfile=${logfile-"${log_dir}/${eduid_name}.log"} - -chown eduid: "${log_dir}" - -celery_args=${celery_args-'--loglevel INFO'} -if [ -f /opt/eduid/src/setup.py ]; then - celery_args='--loglevel DEBUG' -else - if [ -f "${cfg_dir}/${app_name}_DEBUG" ]; then - # eduid-dev environment - celery_args='--loglevel DEBUG' - fi -fi - -touch "${logfile}" -chown eduid: "${logfile}" -chmod 640 "${logfile}" - -# nice to have in docker run output, to check what -# version of something is actually running. -/opt/eduid/bin/pip freeze -test -f revision.txt && cat revision.txt; true - -echo "$0: Starting Celery app '${app_name}' (queue: ${eduid_queue})" -exec celery worker --app="${app_name}.worker" -Q ${eduid_queue} --events \ - --uid eduid --gid eduid --logfile="${logfile}" \ - $celery_args diff --git a/import/eduid_msg/pytest.ini b/import/eduid_msg/pytest.ini deleted file mode 100644 index 109207d81..000000000 --- a/import/eduid_msg/pytest.ini +++ /dev/null @@ -1,3 +0,0 @@ -[pytest] -addopts = --cov=./ -norecursedirs = build diff --git a/import/eduid_msg/setup.cfg b/import/eduid_msg/setup.cfg deleted file mode 100644 index 24aecf8d6..000000000 --- a/import/eduid_msg/setup.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[easy_install] -index_url = https://pypi.sunet.se/simple/ - -[aliases] -testing = develop easy_install eduid_msg[testing] - -[isort] -known_eduid = eduid_userdb,eduid_common -sections = FUTURE,STDLIB,THIRDPARTY,EDUID,FIRSTPARTY diff --git a/import/eduid_msg/setup.py b/import/eduid_msg/setup.py deleted file mode 100755 index 78717d45e..000000000 --- a/import/eduid_msg/setup.py +++ /dev/null @@ -1,54 +0,0 @@ -from pathlib import PurePath -from typing import List - -from setuptools import find_packages, setup - -__author__ = 'leifj' - -version = '0.11.2' - - -def load_requirements(path: PurePath) -> List[str]: - """ Load dependencies from a requirements.txt style file, ignoring comments etc. """ - res = [] - with open(path) as fd: - for line in fd.readlines(): - while line.endswith('\n') or line.endswith('\\'): - line = line[:-1] - line = line.strip() - if not line or line.startswith('-') or line.startswith('#'): - continue - res += [line] - return res - - -here = PurePath(__file__) -README = open(here.with_name('README.rst')).read() - -install_requires = load_requirements(here.with_name('requirements.txt')) -test_requires = load_requirements(here.with_name('test_requirements.txt')) - - -setup( - name='eduid_msg', - version=version, - description="eduID Message Manager", - long_description=README, - classifiers=[ - # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers - ], - keywords='identity federation saml', - author='Leif Johansson', - author_email='leifj@sunet.se', - url='http://eduid.se/', - license='BSD', - packages=find_packages(), - include_package_data=True, - package_data={}, - zip_safe=False, - install_requires=install_requires, - test_requires=test_requires, - extras_require={'testing': []}, - test_suite='eduid_msg', - python_requires='>=3.7', -) diff --git a/import/import-repos.sh b/import/import-repos.sh deleted file mode 100755 index f072081af..000000000 --- a/import/import-repos.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# -# This script was used to import all the eduID backend repositories into this new common repository. -# -# A lot of this came from https://stackoverflow.com/questions/13040958/merge-two-git-repositories-without-breaking-file-history -# - -set -e -set -x - -SUBMODULES="eduid-am eduid-common eduid-graphdb eduid-lookup-mobile eduid_msg eduid-userdb eduid-queue eduid-scimapi eduid-webapp" - -git branch -D import-old-repos || true -git checkout -b import-old-repos - -for mod in ${SUBMODULES}; do - - # Add a remote for and fetch the old repo - # (the '--fetch' (or '-f') option will make git immediately fetch commits to the local repo after adding the remote) - git remote rm "old_${mod}" || true - git remote add --fetch "old_${mod}" "https://github.com/SUNET/${mod}.git" - - # Merge the files from old_a/master into new/import-old-repos - git merge "old_${mod}"/master --allow-unrelated-histories || \ - git merge "old_${mod}"/main --allow-unrelated-histories - - # Move the old_a repo files and folders into a subdirectory so they don't collide with the other repo coming later - rm -rf "import/${mod}" - mkdir "import/${mod}" - git mv -k ./* .??* "import/${mod}" - - # Commit the move - git commit -m "Move ${mod} files into subdir while merging repositories" -done diff --git a/import/move-files.sh b/import/move-files.sh deleted file mode 100755 index aeeddfc2b..000000000 --- a/import/move-files.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -# -# After import, move all the sources into a common src/eduid and adjust imports. -# - -set -e -set -x - -function move { - src="${1}" - dst="${2}" - - if [ -d "${src}" ]; then - parent=$(dirname "${dst}") - test -d "${parent}" || mkdir -p "${parent}" - git mv "${src}" "${dst}" - fi -} - -git checkout import-old-repos -git branch -D move-imported-files-to-new-structure || true -git checkout -b move-imported-files-to-new-structure - -move import/eduid-am/eduid_am src/eduid/workers/am -move import/eduid-common/src/eduid_common/ src/eduid/common -move import/eduid-graphdb/src/eduid_graphdb/ src/eduid/graphdb -move import/eduid-lookup-mobile/eduid_lookup_mobile/ src/eduid/workers/lookup_mobile -move import/eduid_msg/eduid_msg/ src/eduid/workers/msg -move import/eduid-queue/src/eduid_queue/ src/eduid/queue -move import/eduid-scimapi/src/eduid_scimapi/ src/eduid/scimapi -move import/eduid-scimapi/src/eduid_satosa_plugins/ src/eduid/satosa -move import/eduid-userdb/src/eduid_userdb/ src/eduid/userdb -move import/eduid-webapp/src/eduid_webapp/ src/eduid/webapp - -git commit -m "move imported files to new directory strucure" diff --git a/import/update-imports.sh b/import/update-imports.sh deleted file mode 100755 index 9cfc42505..000000000 --- a/import/update-imports.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash - -set -e - -function replace { - where="${1}" - old="${2}" - new="${3}" - - find "${where}" -type f -name '*.py' -print0 | xargs -0 grep --files-with-matches "${old}" | while read -r f; do - sed -i -e "s#${old}#${new}#g" "${f}" - done -} - -git checkout src || true - -git checkout move-imported-files-to-new-structure -git branch -D update-imports || true -git checkout -b update-imports - - -replace src/ " eduid_am" " eduid.workers.am" -replace src/ " eduid_common" " eduid.common" -replace src/ " eduid_graphdb" " eduid.graphdb" -replace src/ " eduid_lookup_mobile" " eduid.workers.lookup_mobile" -replace src/ " eduid_msg" " eduid.workers.msg" -replace src/ " eduid_queue" " eduid.queue" -replace src/ " eduid_scimapi" " eduid.scimapi" -replace src/ " eduid_satosa_plugins" " eduid.satosa" -replace src/ " eduid_userdb" " eduid.userdb" -replace src/ " eduid_webapp" " eduid.webapp" - -replace src/ "(eduid_am" "(eduid.workers.am" -replace src/ "(eduid_common" "(eduid.common" -replace src/ "(eduid_graphdb" "(eduid.graphdb" -replace src/ "(eduid_lookup_mobile" "(eduid.workers.lookup_mobile" -replace src/ "(eduid_msg" "(eduid.workers.msg" -replace src/ "(eduid_queue" "(eduid.queue" -replace src/ "(eduid_scimapi" "(eduid.scimapi" -replace src/ "(eduid_satosa_plugins" "(eduid.satosa" -replace src/ "(eduid_userdb" "(eduid.userdb" -replace src/ "(eduid_webapp" "(eduid.webapp" - -replace src/ "^eduid_common" "eduid.common" -replace src/ "eduid_common.api." "eduid.common.api." -replace src/ "eduid_common.authn." "eduid.common.authn." -replace src/ "eduid_common.config." "eduid.common.config." - -replace src/ "eduid_webapp.actions." "eduid.webapp.actions." -replace src/ "patch('eduid_webapp." "patch('eduid.webapp." -replace src/ "patch('eduid_userdb." "patch('eduid.userdb." - -replace src/ "eduid_am.tasks" "eduid.workers.am.tasks" - -replace src/eduid/common/api/translation.py "eduid_webapp" "eduid.webapp" - - -# special cases -sed -i -e "s#self.eduid.userdb#self.eduid_userdb#g" src/eduid/satosa/scimapi/scim_attributes.py - -replace src/eduid/workers/ "class eduid.workers." "class eduid_" - -git commit -m "update imports after moving imported files" src/ From d14a576f3cf45951a03428a964daa4b28159b0a4 Mon Sep 17 00:00:00 2001 From: Lasse Yledahl Date: Thu, 5 Sep 2024 12:31:15 +0000 Subject: [PATCH 22/28] use ruff for reformat and add lint rule with ruff check --- Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 8fba39bdd..b99a56f35 100644 --- a/Makefile +++ b/Makefile @@ -13,8 +13,10 @@ test: PYTHONPATH=$(SRCDIR) pytest -vvv -ra --log-cli-level DEBUG reformat: - isort --line-width 120 --atomic --project eduid $(SOURCE) - black --line-length 120 --target-version py310 $(SOURCE) + ruff format + +lint: + ruff check typecheck: MYPYPATH=$(SRCDIR) mypy $(MYPY_ARGS) --namespace-packages -p eduid From f83fc2f04a0ab9e4b603e5aeb6509a0d40005b8a Mon Sep 17 00:00:00 2001 From: Lasse Yledahl Date: Thu, 5 Sep 2024 12:34:45 +0000 Subject: [PATCH 23/28] clean up imports from linting check --- src/eduid/satosa/scimapi/statsd.py | 1 - src/eduid/webapp/common/proofing/methods.py | 2 +- src/eduid/webapp/freja_eid/callback_actions.py | 2 +- src/eduid/webapp/freja_eid/helpers.py | 5 +---- src/eduid/webapp/freja_eid/proofing.py | 2 +- src/eduid/webapp/freja_eid/settings/common.py | 2 +- src/eduid/webapp/freja_eid/views.py | 1 - src/eduid/webapp/svipe_id/settings/common.py | 2 +- src/eduid/workers/msg/tasks.py | 1 - 9 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/eduid/satosa/scimapi/statsd.py b/src/eduid/satosa/scimapi/statsd.py index a033034d1..cb5f17f81 100644 --- a/src/eduid/satosa/scimapi/statsd.py +++ b/src/eduid/satosa/scimapi/statsd.py @@ -2,7 +2,6 @@ import re from typing import Any, Mapping -import satosa.internal from satosa.context import Context from satosa.internal import InternalData from satosa.micro_services.base import ResponseMicroService diff --git a/src/eduid/webapp/common/proofing/methods.py b/src/eduid/webapp/common/proofing/methods.py index 0ec1215d0..4ffc6ea3e 100644 --- a/src/eduid/webapp/common/proofing/methods.py +++ b/src/eduid/webapp/common/proofing/methods.py @@ -14,7 +14,7 @@ from eduid.webapp.common.authn.session_info import SessionInfo from eduid.webapp.common.proofing.messages import ProofingMsg from eduid.webapp.eidas.saml_session_info import ForeignEidSessionInfo, NinSessionInfo -from eduid.webapp.freja_eid.helpers import FrejaEIDDocumentUserInfo, FrejaEIDTokenResponse +from eduid.webapp.freja_eid.helpers import FrejaEIDDocumentUserInfo from eduid.webapp.svipe_id.helpers import SvipeDocumentUserInfo logger = logging.getLogger(__name__) diff --git a/src/eduid/webapp/freja_eid/callback_actions.py b/src/eduid/webapp/freja_eid/callback_actions.py index d92108213..23604985d 100644 --- a/src/eduid/webapp/freja_eid/callback_actions.py +++ b/src/eduid/webapp/freja_eid/callback_actions.py @@ -4,7 +4,7 @@ from eduid.webapp.common.proofing.messages import ProofingMsg from eduid.webapp.freja_eid.app import current_freja_eid_app as current_app from eduid.webapp.freja_eid.callback_enums import FrejaEIDAction -from eduid.webapp.freja_eid.helpers import FrejaEIDDocumentUserInfo, FrejaEIDMsg, FrejaEIDTokenResponse +from eduid.webapp.freja_eid.helpers import FrejaEIDDocumentUserInfo, FrejaEIDMsg from eduid.webapp.freja_eid.proofing import get_proofing_functions __author__ = "lundberg" diff --git a/src/eduid/webapp/freja_eid/helpers.py b/src/eduid/webapp/freja_eid/helpers.py index 396fb02e3..be2738b6c 100644 --- a/src/eduid/webapp/freja_eid/helpers.py +++ b/src/eduid/webapp/freja_eid/helpers.py @@ -1,13 +1,10 @@ -import datetime import logging from datetime import date from enum import Enum, unique from typing import Any, Optional -from iso3166 import countries -from pydantic import BaseModel, ConfigDict, Field, field_validator +from pydantic import BaseModel, ConfigDict, Field -from eduid.common.utils import uuid4_str from eduid.userdb.identity import FrejaRegistrationLevel from eduid.webapp.common.api.messages import TranslatableMsg from eduid.webapp.common.session import session diff --git a/src/eduid/webapp/freja_eid/proofing.py b/src/eduid/webapp/freja_eid/proofing.py index 6fd981f2e..2ee9dce72 100644 --- a/src/eduid/webapp/freja_eid/proofing.py +++ b/src/eduid/webapp/freja_eid/proofing.py @@ -32,7 +32,7 @@ ) from eduid.webapp.common.proofing.methods import ProofingMethod from eduid.webapp.freja_eid.app import current_freja_eid_app as current_app -from eduid.webapp.freja_eid.helpers import FrejaEIDDocumentUserInfo, FrejaEIDMsg, FrejaEIDTokenResponse +from eduid.webapp.freja_eid.helpers import FrejaEIDDocumentUserInfo, FrejaEIDMsg __author__ = "lundberg" diff --git a/src/eduid/webapp/freja_eid/settings/common.py b/src/eduid/webapp/freja_eid/settings/common.py index 50ac2def0..77af9ad8e 100644 --- a/src/eduid/webapp/freja_eid/settings/common.py +++ b/src/eduid/webapp/freja_eid/settings/common.py @@ -1,6 +1,6 @@ from typing import Union -from pydantic import AnyUrl, BaseModel, Field +from pydantic import Field from eduid.common.clients.oidc_client.base import AuthlibClientConfig from eduid.common.config.base import ( diff --git a/src/eduid/webapp/freja_eid/views.py b/src/eduid/webapp/freja_eid/views.py index c2659955c..07fa7c0a0 100644 --- a/src/eduid/webapp/freja_eid/views.py +++ b/src/eduid/webapp/freja_eid/views.py @@ -1,4 +1,3 @@ -import json from dataclasses import dataclass from typing import Optional from urllib.parse import parse_qs, urlparse diff --git a/src/eduid/webapp/svipe_id/settings/common.py b/src/eduid/webapp/svipe_id/settings/common.py index 6ee951b2f..7b2979552 100644 --- a/src/eduid/webapp/svipe_id/settings/common.py +++ b/src/eduid/webapp/svipe_id/settings/common.py @@ -1,6 +1,6 @@ from typing import Union -from pydantic import AnyUrl, BaseModel, Field +from pydantic import Field from eduid.common.clients.oidc_client.base import AuthlibClientConfig from eduid.common.config.base import ( diff --git a/src/eduid/workers/msg/tasks.py b/src/eduid/workers/msg/tasks.py index 26fd9444f..c73eb122f 100644 --- a/src/eduid/workers/msg/tasks.py +++ b/src/eduid/workers/msg/tasks.py @@ -2,7 +2,6 @@ import logging import smtplib from collections import OrderedDict -from ssl import SSLContext from typing import Any, Optional from celery import Task From 03a4e5072445d6627bdaec16f57630a2947168ac Mon Sep 17 00:00:00 2001 From: Lasse Yledahl Date: Thu, 5 Sep 2024 12:35:19 +0000 Subject: [PATCH 24/28] make reformat --- src/eduid/satosa/scimapi/statsd.py | 1 - src/eduid/webapp/security/tests/test_webauthn.py | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/eduid/satosa/scimapi/statsd.py b/src/eduid/satosa/scimapi/statsd.py index cb5f17f81..286743093 100644 --- a/src/eduid/satosa/scimapi/statsd.py +++ b/src/eduid/satosa/scimapi/statsd.py @@ -29,7 +29,6 @@ class RequesterCounter(ResponseMicroService): """ def __init__(self, config: Mapping[str, Any], *args: Any, **kwargs: Any): - super().__init__(*args, **kwargs) statsd_config = StatsConfigMixin(**config) diff --git a/src/eduid/webapp/security/tests/test_webauthn.py b/src/eduid/webapp/security/tests/test_webauthn.py index 0ec2ea12b..80edbb5a0 100644 --- a/src/eduid/webapp/security/tests/test_webauthn.py +++ b/src/eduid/webapp/security/tests/test_webauthn.py @@ -354,7 +354,9 @@ def _remove( response2 = client.post("/webauthn/remove", json=data) return user_token, json.loads(response2.data) - def _apple_special_verify_attestation(self: FidoMetadataStore, attestation: Attestation, client_data: bytes) -> bool: + def _apple_special_verify_attestation( + self: FidoMetadataStore, attestation: Attestation, client_data: bytes + ) -> bool: if attestation.fmt is AttestationFormat.PACKED: return self.verify_packed_attestation(attestation=attestation, client_data=client_data) if attestation.fmt is AttestationFormat.APPLE: @@ -568,7 +570,7 @@ def test_remove_wrong_csrf(self): self.assertEqual(data["payload"]["error"]["csrf_token"], ["CSRF failed to validate"]) @patch("fido_mds.FidoMetadataStore.verify_attestation", _apple_special_verify_attestation) - def test_authenticator_information(self): + def test_authenticator_information(self): authenticators = [YUBIKEY_4, YUBIKEY_5_NFC, MICROSOFT_SURFACE_1796, NEXUS_5, IPHONE_12, NONE_ATTESTATION] for authenticator in authenticators: with self.app.test_request_context(): From a0a1ebcfc74d92f82709d8395fccd3dc208d4998 Mon Sep 17 00:00:00 2001 From: Lasse Yledahl Date: Thu, 5 Sep 2024 13:25:40 +0000 Subject: [PATCH 25/28] test linting in github workflow --- .github/workflows/run-tests.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/run-tests.yaml b/.github/workflows/run-tests.yaml index 7345e83b2..6acda0fb1 100644 --- a/.github/workflows/run-tests.yaml +++ b/.github/workflows/run-tests.yaml @@ -67,3 +67,19 @@ jobs: mypy --version make typecheck + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install Python + uses: actions/setup-python@v5 + with: + python-version: "3.10" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install ruff + # Update output format to enable automatic inline annotations. + - name: Run Ruff + run: ruff check --output-format=github . + From b1788bac519ed1b88f78c2d528dbf3125900c625 Mon Sep 17 00:00:00 2001 From: Lasse Yledahl Date: Fri, 6 Sep 2024 10:28:49 +0000 Subject: [PATCH 26/28] updates to vscode settings in devcontainer for ruff --- .devcontainer/devcontainer.json | 5 ----- .vscode/extensions.json | 1 - .vscode/settings.json | 8 +++----- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 00d2b1f29..33b961d86 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -7,22 +7,17 @@ "vscode": { "settings": { "python.defaultInterpreterPath": "/usr/local/bin/python", - "python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8", - "python.formatting.blackPath": "/usr/local/py-utils/bin/black", - "python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf", "cSpell.language": "en-GB,en,sv" }, "extensions": [ "ms-python.python", "ms-python.vscode-pylance", "ms-python.mypy-type-checker", - "ms-python.black-formatter", "tabbyml.vscode-tabby", "GitHub.vscode-pull-request-github", "streetsidesoftware.code-spell-checker", "streetsidesoftware.code-spell-checker-swedish", "ms-vscode.makefile-tools", - "ms-python.isort", "charliermarsh.ruff" ] } diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 4b39c1ede..7b641fe44 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,6 +1,5 @@ { "recommendations": [ "streetsidesoftware.code-spell-checker", - "ms-python.isort" ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index a97b8628a..4d7f10f50 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,12 +4,10 @@ ], "python.testing.unittestEnabled": false, "python.testing.pytestEnabled": true, - "black-formatter.args": [ - "--line-length 120" - ], "[python]": { - "editor.defaultFormatter": "ms-python.black-formatter" - }, + "editor.formatOnSave": true, + "editor.defaultFormatter": "charliermarsh.ruff" + }, "terminal.integrated.env.linux": { "PYTHONPATH": "${workspaceFolder}/src" }, From c7425e31d738e5d2afecfcf5a3aa939786169cab Mon Sep 17 00:00:00 2001 From: Lasse Yledahl Date: Mon, 9 Sep 2024 13:14:28 +0000 Subject: [PATCH 27/28] add ruff as isort replacement --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index b99a56f35..fa3ae0783 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,9 @@ test: PYTHONPATH=$(SRCDIR) pytest -vvv -ra --log-cli-level DEBUG reformat: + # sort imports and remove unused imports + ruff check --select F401,I --fix + # reformat ruff format lint: From 69abb0b4015ddd2de26dd2613630364e576f6951 Mon Sep 17 00:00:00 2001 From: Lasse Yledahl Date: Mon, 9 Sep 2024 13:15:32 +0000 Subject: [PATCH 28/28] make reformat --- src/eduid/userdb/proofing/__init__.py | 2 -- src/eduid/userdb/tests/test_async_db.py | 1 - src/eduid/vccs/server/run.py | 3 +-- src/eduid/webapp/common/api/views/status.py | 3 +-- src/eduid/webapp/security/tests/test_webauthn.py | 5 ++--- 5 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/eduid/userdb/proofing/__init__.py b/src/eduid/userdb/proofing/__init__.py index 8b27afbe4..e3a2f3a17 100644 --- a/src/eduid/userdb/proofing/__init__.py +++ b/src/eduid/userdb/proofing/__init__.py @@ -12,8 +12,6 @@ PhoneProofingStateDB, PhoneProofingUserDB, ) - - from eduid.userdb.proofing.element import EmailProofingElement, NinProofingElement, PhoneProofingElement from eduid.userdb.proofing.state import ( EmailProofingState, diff --git a/src/eduid/userdb/tests/test_async_db.py b/src/eduid/userdb/tests/test_async_db.py index 24b891b10..b23dc41c5 100644 --- a/src/eduid/userdb/tests/test_async_db.py +++ b/src/eduid/userdb/tests/test_async_db.py @@ -1,7 +1,6 @@ from unittest import IsolatedAsyncioTestCase from unittest.mock import patch - from eduid.userdb.db.async_db import AsyncBaseDB, AsyncMongoDB from eduid.userdb.testing import AsyncMongoTestCase diff --git a/src/eduid/vccs/server/run.py b/src/eduid/vccs/server/run.py index d277b1cf7..53d1c1c74 100644 --- a/src/eduid/vccs/server/run.py +++ b/src/eduid/vccs/server/run.py @@ -4,11 +4,10 @@ from fastapi import FastAPI from fastapi.exceptions import RequestValidationError +from ndnkdf import ndnkdf from starlette.responses import JSONResponse from starlette.status import HTTP_422_UNPROCESSABLE_ENTITY -from ndnkdf import ndnkdf - from eduid.vccs.server.config import init_config from eduid.vccs.server.db import CredentialDB from eduid.vccs.server.endpoints.add_creds import add_creds_router diff --git a/src/eduid/webapp/common/api/views/status.py b/src/eduid/webapp/common/api/views/status.py index 963e3245a..389a15ed5 100644 --- a/src/eduid/webapp/common/api/views/status.py +++ b/src/eduid/webapp/common/api/views/status.py @@ -3,9 +3,8 @@ from datetime import datetime, timedelta from typing import TYPE_CHECKING, Any, Literal, Mapping, Optional, cast, overload -from flask import Blueprint +from flask import Blueprint, jsonify from flask import current_app as flask_current_app -from flask import jsonify from flask.wrappers import Response from eduid.common.config.base import EduIDBaseAppConfig diff --git a/src/eduid/webapp/security/tests/test_webauthn.py b/src/eduid/webapp/security/tests/test_webauthn.py index 80edbb5a0..b636c435d 100644 --- a/src/eduid/webapp/security/tests/test_webauthn.py +++ b/src/eduid/webapp/security/tests/test_webauthn.py @@ -3,9 +3,8 @@ from typing import Any, Mapping, Optional from unittest.mock import patch -from fido_mds import FidoMetadataStore - from fido2.webauthn import AttestationObject, AuthenticatorAttachment, CollectedClientData +from fido_mds import FidoMetadataStore from werkzeug.http import dump_cookie from eduid.common.config.base import EduidEnvironment, FrontendAction @@ -25,7 +24,7 @@ # result of calling Fido2Server.register_begin from fido_mds import Attestation from fido_mds.models.webauthn import AttestationFormat -from fido_mds.tests.data import IPHONE_12, MICROSOFT_SURFACE_1796, NEXUS_5, YUBIKEY_4, YUBIKEY_5_NFC, NONE_ATTESTATION +from fido_mds.tests.data import IPHONE_12, MICROSOFT_SURFACE_1796, NEXUS_5, NONE_ATTESTATION, YUBIKEY_4, YUBIKEY_5_NFC # CTAP1 security key STATE = {"challenge": "u3zHzb7krB4c4wj0Uxuhsz2lCXqLnwV9ZxMhvL2lcfo", "user_verification": "discouraged"}