Compare commits

...

2 commits

Author SHA1 Message Date
dece 895b0dec47 style: run Black over the whole project 2022-08-09 23:48:14 +02:00
dece 4beead146f pip: add dev deps 2022-08-09 23:47:53 +02:00
29 changed files with 553 additions and 202 deletions

View file

@ -4,6 +4,15 @@ url = "https://pypi.org/simple"
verify_ssl = true verify_ssl = true
[dev-packages] [dev-packages]
python-lsp-server = "*"
rope = "*"
pyflakes = "*"
mccabe = "*"
pycodestyle = "*"
black = "*"
python-lsp-black = "*"
mypy = "*"
pylsp-mypy = "*"
[packages] [packages]
irc = "*" irc = "*"

366
Pipfile.lock generated
View file

@ -1,7 +1,7 @@
{ {
"_meta": { "_meta": {
"hash": { "hash": {
"sha256": "cd3456f770a7bd477ad79cd1ce56fd05fb3e3b08167b430021c3aee8fa4b3fcf" "sha256": "7efa513c27dbd60153dad1bbd870d6ee19d085a5daaf7b4a356f98caab790fd3"
}, },
"pipfile-spec": 6, "pipfile-spec": 6,
"requires": {}, "requires": {},
@ -16,55 +16,60 @@
"default": { "default": {
"certifi": { "certifi": {
"hashes": [ "hashes": [
"sha256:2bbf76fd432960138b3ef6dda3dde0544f27cbf8546c458e60baf371917ba9ee", "sha256:84c85a9078b11105f04f3036a9482ae10e4621616db313fe045dd24743a0820d",
"sha256:50b1e4f8446b06f41be7dd6338db18e0990601dce795c2b1686458aa7e8fa7d8" "sha256:fe86415d55e84719d75f8b69414f6438ac3547d2078ab91b67e779ef69378412"
], ],
"version": "==2021.5.30" "version": "==2022.6.15"
}, },
"charset-normalizer": { "charset-normalizer": {
"hashes": [ "hashes": [
"sha256:7098e7e862f6370a2a8d1a6398cd359815c45d12626267652c3f13dec58e2367", "sha256:5189b6f22b01957427f35b6a08d9a0bc45b46d3788ef5a92e978433c7a35f8a5",
"sha256:fa471a601dfea0f492e4f4fca035cd82155e65dc45c9b83bf4322dfab63755dd" "sha256:575e708016ff3a5e3681541cb9d79312c416835686d054a23accb873b254f413"
], ],
"markers": "python_version >= '3'", "version": "==2.1.0"
"version": "==2.0.5"
}, },
"idna": { "idna": {
"hashes": [ "hashes": [
"sha256:14475042e284991034cb48e06f6851428fb14c4dc953acd9be9a5e95c7b6dd7a", "sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff",
"sha256:467fbad99067910785144ce333826c71fb0e63a425657295239737f7ecd125f3" "sha256:9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d"
], ],
"markers": "python_version >= '3'", "version": "==3.3"
"version": "==3.2"
}, },
"irc": { "irc": {
"hashes": [ "hashes": [
"sha256:99fd5d1fa1d054dee4fbb81e0d5193dc1e8200db751d5da9a97850a62162b9ab", "sha256:5114aee1247ff634abed80f3349d75ccab35616a4b76be2a25add7ef189db0e5",
"sha256:b5179428448947d364edcdcef8cb34a2a7033b4e78e58fec32d092091eab786f" "sha256:b6f737932dd4791f3b18e319de7b7daf02d2285a6bea263d101f4d8e553807ec"
], ],
"index": "pypi", "index": "pypi",
"version": "==19.0.1" "version": "==20.1.0"
}, },
"jaraco.classes": { "jaraco.classes": {
"hashes": [ "hashes": [
"sha256:22ac35313cf4b145bf7b217cc51be2d98a3d2db1c8558a30ca259d9f0b9c0b7d", "sha256:6745f113b0b588239ceb49532aa09c3ebb947433ce311ef2f8e3ad64ebb74594",
"sha256:ed54b728af1937dc16b7236fbaf34ba561ba1ace572b03fffa5486ed363ecf34" "sha256:e6ef6fd3fcf4579a7a019d87d1e56a883f4e4c35cfe925f86731abc58804e647"
], ],
"version": "==3.2.1" "version": "==3.2.2"
}, },
"jaraco.collections": { "jaraco.collections": {
"hashes": [ "hashes": [
"sha256:344d14769d716e7496af879ac71b3c6ebdd46abc64bd9ec21d15248365aa3ac9", "sha256:072b93eb35f9e48508485755534e66a34ef1cc84af291fd27f39b44d4c0dd2c3",
"sha256:6fdf48b6268d44b589a9d7359849f5c4ea6447b59845e489da261996fbc41b79" "sha256:1ca12fa4b7067dfc8d7f791c1a8660d970a2bf2f80536ba0aa5cbb71fe1261f1"
], ],
"version": "==3.4.0" "version": "==3.5.2"
},
"jaraco.context": {
"hashes": [
"sha256:9327d3e6901923e5a7097aa2df4b9c2bc13f845c7672692e3827ebd1b3d67606",
"sha256:a58e94dd67871639abc091b57d32842449b230777570ef2bcec3dc16b912613e"
],
"version": "==4.1.2"
}, },
"jaraco.functools": { "jaraco.functools": {
"hashes": [ "hashes": [
"sha256:7c788376d69cf41da675b186c85366fe9ac23c92a70697c455ef9135c25edf31", "sha256:c8774f73323de42250a659934215da1d899b02c66a6133f1cb79f02a5aff4f38",
"sha256:bfcf7da71e2a0e980189b0744b59dba6c1dcf66dcd7a30f8a4413e478046b314" "sha256:d0adcf91710a0853efe9f23a78fad586bf67df572f0d6d8e0fa36d289ae1c1d9"
], ],
"version": "==3.3.0" "version": "==3.5.1"
}, },
"jaraco.logging": { "jaraco.logging": {
"hashes": [ "hashes": [
@ -75,54 +80,323 @@
}, },
"jaraco.stream": { "jaraco.stream": {
"hashes": [ "hashes": [
"sha256:0ede0988de595d15a72fa95f1eec4dee20fdede30e8d2ddee1b9c2a963eb67ef", "sha256:3af4b0441090ee65bd6dde930d29f93f50c4a2fe6048e2a9d288285f5e4dc441",
"sha256:86c57fedffd4d5a4b18817f99ddf62ac8ed0a1bc31a1c41b9a88df9c6bb56e0b" "sha256:7fe38f25767b717afcf3ca79ec8fff06e85ae166fb5e42da58cc2a581bc9db39"
], ],
"version": "==3.0.2" "version": "==3.0.3"
}, },
"jaraco.text": { "jaraco.text": {
"hashes": [ "hashes": [
"sha256:dc900b7916cefdaf943fbd43870abc8b0a6ff68f2c8c33e212fd51139219f68d", "sha256:450957c3f8fb9a553d9d3e60738733ab1c5cc27b36a463342adb937e9a70ab3e",
"sha256:ede4e9103443b62b3d1d193257dfb85aab7c69a6cef78a0887d64bb307a03bc3" "sha256:e4418d632425d741b8f9128cdf8fd9c0c878dc1450a7430dbd4bf6296eeac915"
], ],
"version": "==3.5.1" "version": "==3.8.1"
}, },
"more-itertools": { "more-itertools": {
"hashes": [ "hashes": [
"sha256:70401259e46e216056367a0a6034ee3d3f95e0bf59d3aa6a4eb77837171ed996", "sha256:1bc4f91ee5b1b31ac7ceacc17c09befe6a40a503907baf9c839c229b5095cfd2",
"sha256:8c746e0d09871661520da4f1241ba6b908dc903839733c8203b552cffaf173bd" "sha256:c09443cd3d5438b8dafccd867a6bc1cb0894389e90cb53d227456b0b0bccb750"
], ],
"version": "==8.9.0" "version": "==8.14.0"
}, },
"pytz": { "pytz": {
"hashes": [ "hashes": [
"sha256:83a4a90894bf38e243cf052c8b58f381bfe9a7a483f6a9cab140bc7f702ac4da", "sha256:1e760e2fe6a8163bc0b3d9a19c4f84342afa0a2affebfaa84b01b978a02ecaa7",
"sha256:eb10ce3e7736052ed3623d49975ce333bcd712c7bb19a58b9e2089d4057d0798" "sha256:e68985985296d9a66a881eb3193b0906246245294a881e7c8afe623866ac6a5c"
], ],
"version": "==2021.1" "version": "==2022.1"
}, },
"requests": { "requests": {
"hashes": [ "hashes": [
"sha256:6c1246513ecd5ecd4528a0906f910e8f0f9c6b8ec72030dc9fd154dc1a6efd24", "sha256:7c5599b102feddaa661c826c56ab4fee28bfd17f5abca1ebbe3e7f19d7c97983",
"sha256:b8aa58f8cf793ffd8782d3d8cb19e66ef36f7aba4353eec859e74678b01b07a7" "sha256:8fefa2a1a1365bf5520aac41836fbee479da67864514bdb821f31ce07ce65349"
], ],
"index": "pypi", "index": "pypi",
"version": "==2.26.0" "version": "==2.28.1"
}, },
"tempora": { "tempora": {
"hashes": [ "hashes": [
"sha256:c54da0f05405f04eb67abbb1dff4448fd91428b58cb00f0f645ea36f6a927950", "sha256:31fa5bb33b2641026211f23e808eb8bd351901988b167d45f323c8f450ecf211",
"sha256:ef2d8bb35902d5ea7da95df33456685a6d305b97f311725c12e55c13d85c0938" "sha256:e65d32ae68ad772ee738d802689f689b3f883e165e8dadd39aa89ef317b12b99"
], ],
"version": "==4.1.1" "version": "==5.0.2"
}, },
"urllib3": { "urllib3": {
"hashes": [ "hashes": [
"sha256:39fb8672126159acb139a7718dd10806104dec1e2f0f6c88aab05d17df10c8d4", "sha256:c33ccba33c819596124764c23a97d25f32b28433ba0dedeb77d873a38722c9bc",
"sha256:f57b4c16c62fa2760b7e3d97c35b255512fb6b59a259730f36ba32ce9f8e342f" "sha256:ea6e8fb210b19d950fab93b60c9009226c63a28808bc8386e05301e25883ac0a"
], ],
"version": "==1.26.6" "version": "==1.26.11"
} }
}, },
"develop": {} "develop": {
"black": {
"hashes": [
"sha256:074458dc2f6e0d3dab7928d4417bb6957bb834434516f21514138437accdbe90",
"sha256:187d96c5e713f441a5829e77120c269b6514418f4513a390b0499b0987f2ff1c",
"sha256:2ea29072e954a4d55a2ff58971b83365eba5d3d357352a07a7a4df0d95f51c78",
"sha256:4af5bc0e1f96be5ae9bd7aaec219c901a94d6caa2484c21983d043371c733fc4",
"sha256:560558527e52ce8afba936fcce93a7411ab40c7d5fe8c2463e279e843c0328ee",
"sha256:568ac3c465b1c8b34b61cd7a4e349e93f91abf0f9371eda1cf87194663ab684e",
"sha256:6797f58943fceb1c461fb572edbe828d811e719c24e03375fd25170ada53825e",
"sha256:6c1734ab264b8f7929cef8ae5f900b85d579e6cbfde09d7387da8f04771b51c6",
"sha256:6c6d39e28aed379aec40da1c65434c77d75e65bb59a1e1c283de545fb4e7c6c9",
"sha256:7ba9be198ecca5031cd78745780d65a3f75a34b2ff9be5837045dce55db83d1c",
"sha256:94783f636bca89f11eb5d50437e8e17fbc6a929a628d82304c80fa9cd945f256",
"sha256:a218d7e5856f91d20f04e931b6f16d15356db1c846ee55f01bac297a705ca24f",
"sha256:a3db5b6409b96d9bd543323b23ef32a1a2b06416d525d27e0f67e74f1446c8f2",
"sha256:ac609cf8ef5e7115ddd07d85d988d074ed00e10fbc3445aee393e70164a2219c",
"sha256:b154e6bbde1e79ea3260c4b40c0b7b3109ffcdf7bc4ebf8859169a6af72cd70b",
"sha256:b270a168d69edb8b7ed32c193ef10fd27844e5c60852039599f9184460ce0807",
"sha256:b9fd45787ba8aa3f5e0a0a98920c1012c884622c6c920dbe98dbd05bc7c70fbf",
"sha256:c85928b9d5f83b23cee7d0efcb310172412fbf7cb9d9ce963bd67fd141781def",
"sha256:c9a3ac16efe9ec7d7381ddebcc022119794872abce99475345c5a61aa18c45ad",
"sha256:cfaf3895a9634e882bf9d2363fed5af8888802d670f58b279b0bece00e9a872d",
"sha256:e439798f819d49ba1c0bd9664427a05aab79bfba777a6db94fd4e56fae0cb849",
"sha256:f586c26118bc6e714ec58c09df0157fe2d9ee195c764f630eb0d8e7ccce72e69",
"sha256:f6fe02afde060bbeef044af7996f335fbe90b039ccf3f5eb8f16df8b20f77666"
],
"index": "pypi",
"version": "==22.6.0"
},
"click": {
"hashes": [
"sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e",
"sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48"
],
"version": "==8.1.3"
},
"jedi": {
"hashes": [
"sha256:637c9635fcf47945ceb91cd7f320234a7be540ded6f3e99a50cb6febdfd1ba8d",
"sha256:74137626a64a99c8eb6ae5832d99b3bdd7d29a3850fe2aa80a4126b2a7d949ab"
],
"version": "==0.18.1"
},
"mccabe": {
"hashes": [
"sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325",
"sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e"
],
"index": "pypi",
"version": "==0.7.0"
},
"mypy": {
"hashes": [
"sha256:02ef476f6dcb86e6f502ae39a16b93285fef97e7f1ff22932b657d1ef1f28655",
"sha256:0d054ef16b071149917085f51f89555a576e2618d5d9dd70bd6eea6410af3ac9",
"sha256:19830b7dba7d5356d3e26e2427a2ec91c994cd92d983142cbd025ebe81d69cf3",
"sha256:1f7656b69974a6933e987ee8ffb951d836272d6c0f81d727f1d0e2696074d9e6",
"sha256:23488a14a83bca6e54402c2e6435467a4138785df93ec85aeff64c6170077fb0",
"sha256:23c7ff43fff4b0df93a186581885c8512bc50fc4d4910e0f838e35d6bb6b5e58",
"sha256:25c5750ba5609a0c7550b73a33deb314ecfb559c350bb050b655505e8aed4103",
"sha256:2ad53cf9c3adc43cf3bea0a7d01a2f2e86db9fe7596dfecb4496a5dda63cbb09",
"sha256:3fa7a477b9900be9b7dd4bab30a12759e5abe9586574ceb944bc29cddf8f0417",
"sha256:40b0f21484238269ae6a57200c807d80debc6459d444c0489a102d7c6a75fa56",
"sha256:4b21e5b1a70dfb972490035128f305c39bc4bc253f34e96a4adf9127cf943eb2",
"sha256:5a361d92635ad4ada1b1b2d3630fc2f53f2127d51cf2def9db83cba32e47c856",
"sha256:77a514ea15d3007d33a9e2157b0ba9c267496acf12a7f2b9b9f8446337aac5b0",
"sha256:855048b6feb6dfe09d3353466004490b1872887150c5bb5caad7838b57328cc8",
"sha256:9796a2ba7b4b538649caa5cecd398d873f4022ed2333ffde58eaf604c4d2cb27",
"sha256:98e02d56ebe93981c41211c05adb630d1d26c14195d04d95e49cd97dbc046dc5",
"sha256:b793b899f7cf563b1e7044a5c97361196b938e92f0a4343a5d27966a53d2ec71",
"sha256:d1ea5d12c8e2d266b5fb8c7a5d2e9c0219fedfeb493b7ed60cd350322384ac27",
"sha256:d2022bfadb7a5c2ef410d6a7c9763188afdb7f3533f22a0a32be10d571ee4bbe",
"sha256:d3348e7eb2eea2472db611486846742d5d52d1290576de99d59edeb7cd4a42ca",
"sha256:d744f72eb39f69312bc6c2abf8ff6656973120e2eb3f3ec4f758ed47e414a4bf",
"sha256:ef943c72a786b0f8d90fd76e9b39ce81fb7171172daf84bf43eaf937e9f220a9",
"sha256:f2899a3cbd394da157194f913a931edfd4be5f274a88041c9dc2d9cdcb1c315c"
],
"index": "pypi",
"version": "==0.971"
},
"mypy-extensions": {
"hashes": [
"sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d",
"sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"
],
"version": "==0.4.3"
},
"packaging": {
"hashes": [
"sha256:dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb",
"sha256:ef103e05f519cdc783ae24ea4e2e0f508a9c99b2d4969652eed6a2e1ea5bd522"
],
"version": "==21.3"
},
"parso": {
"hashes": [
"sha256:8c07be290bb59f03588915921e29e8a50002acaf2cdc5fa0e0114f91709fafa0",
"sha256:c001d4636cd3aecdaf33cbb40aebb59b094be2a74c556778ef5576c175e19e75"
],
"version": "==0.8.3"
},
"pathspec": {
"hashes": [
"sha256:7d15c4ddb0b5c802d161efc417ec1a2558ea2653c2e8ad9c19098201dc1c993a",
"sha256:e564499435a2673d586f6b2130bb5b95f04a3ba06f81b8f895b651a3c76aabb1"
],
"version": "==0.9.0"
},
"platformdirs": {
"hashes": [
"sha256:027d8e83a2d7de06bbac4e5ef7e023c02b863d7ea5d079477e722bb41ab25788",
"sha256:58c8abb07dcb441e6ee4b11d8df0ac856038f944ab98b7be6b27b2a3c7feef19"
],
"version": "==2.5.2"
},
"pluggy": {
"hashes": [
"sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159",
"sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3"
],
"version": "==1.0.0"
},
"pycodestyle": {
"hashes": [
"sha256:2c9607871d58c76354b697b42f5d57e1ada7d261c261efac224b664affdc5785",
"sha256:d1735fc58b418fd7c5f658d28d943854f8a849b01a5d0a1e6f3f3fdd0166804b"
],
"index": "pypi",
"version": "==2.9.1"
},
"pyflakes": {
"hashes": [
"sha256:4579f67d887f804e67edb544428f264b7b24f435b263c4614f384135cea553d2",
"sha256:491feb020dca48ccc562a8c0cbe8df07ee13078df59813b83959cbdada312ea3"
],
"index": "pypi",
"version": "==2.5.0"
},
"pylsp-mypy": {
"hashes": [
"sha256:473bf16027c3a69d8052c184ba72f049ce137b10eeefea0b1414c9e589ec79a9",
"sha256:e709a244eb56768765f334de550bd9101d2312fa2a6dd077c7bbf939b7b3fba1"
],
"index": "pypi",
"version": "==0.6.2"
},
"pyparsing": {
"hashes": [
"sha256:2b020ecf7d21b687f219b71ecad3631f644a47f01403fa1d1036b0c6416d70fb",
"sha256:5026bae9a10eeaefb61dab2f09052b9f4307d44aee4eda64b309723d8d206bbc"
],
"version": "==3.0.9"
},
"python-lsp-black": {
"hashes": [
"sha256:9793e69122f7ab51dffa980f026e456b4be62a3400df5c89b6ecf9278b74913a",
"sha256:d7eaeab2a377e96a82cc26afe2f8f2e1cf7c6eaefdcdeab026343e2e559dcce9"
],
"index": "pypi",
"version": "==1.2.1"
},
"python-lsp-jsonrpc": {
"hashes": [
"sha256:079b143be64b0a378bdb21dff5e28a8c1393fe7e8a654ef068322d754e545fc7",
"sha256:7bec170733db628d3506ea3a5288ff76aa33c70215ed223abdb0d95e957660bd"
],
"version": "==1.0.0"
},
"python-lsp-server": {
"hashes": [
"sha256:77aac9861b0e23cafb251f116448157e6c45957e625097ed4846891281cffc18",
"sha256:e5c094c19925022a27c4068f414b2bb653243f8fb0d768e39735289d7a89380d"
],
"index": "pypi",
"version": "==1.5.0"
},
"pytoolconfig": {
"hashes": [
"sha256:2512a1f261a40e73cef2e58e786184261b60c802ae7ed01249342b1949ec3aa2",
"sha256:825d97b052e58b609c2684b04efeb543075588d33a4916a6dc2ae39676458c7d"
],
"version": "==1.2.2"
},
"rope": {
"hashes": [
"sha256:4e8ede637d8f43eb83847ef9ea7edbf4ceb9d641deea592ed38a8875cde64265",
"sha256:f0c82bd7167c2926339c6f0d9ecf7c93d6866cbe380c78639fa1bc4ac037c097"
],
"index": "pypi",
"version": "==1.3.0"
},
"toml": {
"hashes": [
"sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b",
"sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"
],
"version": "==0.10.2"
},
"tomli": {
"hashes": [
"sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc",
"sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"
],
"markers": "python_version < '3.11'",
"version": "==2.0.1"
},
"typing-extensions": {
"hashes": [
"sha256:25642c956049920a5aa49edcdd6ab1e06d7e5d467fc00e0506c44ac86fbfca02",
"sha256:e6d2677a32f47fc7eb2795db1dd15c1f34eff616bcaf2cfb5e997f854fa1c4a6"
],
"version": "==4.3.0"
},
"ujson": {
"hashes": [
"sha256:025758cf6561af6986d77cd4af9367ab56dde5c7c50f13f59e6964b4b25df73e",
"sha256:0551c1ba0bc9e05b69d9c18266dbc93252b5fa3cd9940051bc88a0dd33607b19",
"sha256:05e411627e5d6ee773232960ca7307e66017f78e3fa74f7e95c3a8cc5cb05415",
"sha256:0b46aee21e5d75426c4058dfdb42f7e7b1d130c664ee5027a8dbbc50872dc32b",
"sha256:0bcde3135265ecdd5714a7de4fdc167925390d7b17ca325e59980f4114c962b8",
"sha256:1120c8263f7d85e89533a2b46d80cc6def15114772010ede4d197739e111dba6",
"sha256:13297a7d501f9c8c53e409d4fa57cc574e4fbfbe8807ef2c4c7ce2e3ec933a85",
"sha256:191f88d5865740497b9827ef9b7c12f37a79872ac984e09f0901a10024019380",
"sha256:1a2e645325f844f9c890c9d956fc2d35ca91f38c857278238ef6516c2f99cf7c",
"sha256:2974b17bc522ef86d98b498959d82f03c02e07d9eb08746026415298f4a4bca3",
"sha256:2d98248f1df1e1aab67e0374ab98945dd36bc1764753d71fd8aea5f296360b76",
"sha256:31bdb6d771d5ef6d37134b42211500bfe176c55d399f3317e569783dc42ed38e",
"sha256:3212847d3885bfd4f5fd56cdc37645a8f8e8a80d6cb569505da22fd9eb0e1a02",
"sha256:326a96324ed9215b0bc9f1a5af324fb33900b6b0901516bcc421475d6596de0d",
"sha256:381c97d326d1ec569d318cc0ae83940ea2df125ede1000871680fefd5b7fdea9",
"sha256:39bb702ca1612253b5e4b6004e0f20208c98a446606aa351f9a7ba5ceaff0eb8",
"sha256:3a0707f381f97e1287c0dbf94d95bd6c0bbf6e4eeeaa656f0076b7883010c818",
"sha256:400e4ca8a59f71398e8fa56c4d2d6f535e2a121ddb57284ec15752ffce2dd63a",
"sha256:422653083c6df6cec17fdb5d6106c209aad9b0c94131c53b073980403db22167",
"sha256:511aa641a5b91d19280183b134fb6c473039d4dd82e987ac810cffba783521ac",
"sha256:5df8b6369ee5ee2685fcc917f6c46b34e599c6e9a512fada6dfd752b909fa06a",
"sha256:67f4e2fa81e1d99c01e7b1978ab0cbf3c9a8b663f683a709f87baad110d5b940",
"sha256:68c7f753aec490c6566fd3cd301887c413ac3a588316e446f30a4134ac665668",
"sha256:6a20f2f6e8818c1ab89dd4be6bbad3fc2ddb15287f89e7ea35f3eb849afebbd9",
"sha256:6b953e09441e307504130755e5bd6b15850178d591f66292bba4608c4f7f9b00",
"sha256:754f422aba8db8201a1073f25e2f732effc6471f8755708b16e6ebf19dd23634",
"sha256:784dbd12925845a3f0757a956447e2fd31418abb5aeaebf3aca1203195f16fd1",
"sha256:7d4c9ccd30e621e714ec24ca911ad8873567dc1ac1e5e914405ea9dd16b9d40c",
"sha256:7e12272361e9722777c83b3f5b0bb91d402531f36e80c6e5fafb6acb89e897e3",
"sha256:8cce79ce47c37132373fbdf55b683883c262a3a60763130e080b8394c1201d32",
"sha256:8cd6117e33233f2de6bc896eea6a5a59b58a37db08f371157264e0ec5e51c76a",
"sha256:8d472efa9c92e1b2933a22d2f1dbd5237087997136b24ac2b913bf4e8be03135",
"sha256:91edcf9978ee401119e9c8589376ae37fd3e6e75ee365c49385cb005eaff1535",
"sha256:9ae1d0094ce730e39e09656bc14074d9573cdd80adec1a55b06d8bf1f9613a01",
"sha256:aa00b746138835271653b0c3da171d2a8b510c579381f71e8b8e03484d50d825",
"sha256:aaa77af91df3f71858a1f792c74d3f2d3abf3875f93ab1a2b9a24b3797743b02",
"sha256:b045ca5497a950cc3492840adb3bcb3b9e305ed6599ed14c6aeaa08011aa463f",
"sha256:b40a3757a563ef77c3f2f9ea1732c2924e8b3b2bda3fa89513f949472ad40b6e",
"sha256:baa76a6f707a6d22437fe9c7ec9719672fb04d4d9435a3e80ee9b1aaeb2089d9",
"sha256:cec010d318a0238b1333ea9f40d5603d374cc026c29c4471e2661712c6682da1",
"sha256:dd0d4ec694cab8a0a4d85f45f81ae0065465c4670f0db72ba48d6c4e7ae42834",
"sha256:e2a9ddb5c6d1427056b8d62a1a172a18ae522b14d9ba5996b8281b09cba87edd",
"sha256:e844be0831042aa91e847e5ab03bddd1089ab1a8dd0a1bf90411abf864f058b2",
"sha256:e91947fda8354ea7faf698b084ebcdbabd239e7b15d8436fb74394f59a207ac9",
"sha256:ea7fbc540bc04d5b05e5cd54e60ee8745ac665eedf2bad2ba9d12d5c7a7b7d2e",
"sha256:ee29cf5cfc1e841708297633e1ce749aa851fb96830bbe51f2e5940741ff2441",
"sha256:ef985eb2770900a485431910bd3f333b56d1a34b65f8c26a6ed8e8adf55f98d9",
"sha256:f5c547d49a7e9d3f231e9323171bbbbcef63173fb007a2787cd4f05ac6269315",
"sha256:fbea46c0fbc1c3bc8f957afd8dbb25b4ea3a356e18ee6dd79ace6cf32bd4cff7",
"sha256:fd82932aaa224abd7d01e823b77aef9970f5ac1695027331d99e7f5fda9d37f5"
],
"version": "==5.4.0"
}
}
} }

View file

@ -5,7 +5,7 @@ import time
import signal import signal
from pathlib import Path from pathlib import Path
import irc.client import irc.client # type: ignore
from irc.client import NickMask from irc.client import NickMask
from edmond.log import Logger from edmond.log import Logger
@ -52,8 +52,10 @@ class Bot(irc.client.SimpleIRCClient, Logger):
return storage return storage
except (OSError, json.decoder.JSONDecodeError) as exc: except (OSError, json.decoder.JSONDecodeError) as exc:
self.log_e(f"Could not load storage file: {exc}") self.log_e(f"Could not load storage file: {exc}")
self.log_w("If it's not the first time Edm0nd is run, you may lose" self.log_w(
" data when closing the program.") "If it's not the first time Edm0nd is run, you may lose"
" data when closing the program."
)
return {} return {}
def __save_storage(self): def __save_storage(self):
@ -129,7 +131,7 @@ class Bot(irc.client.SimpleIRCClient, Logger):
plugin_files = os.listdir(Path(__file__).parent / "plugins") plugin_files = os.listdir(Path(__file__).parent / "plugins")
plugin_names = map( plugin_names = map(
lambda f: os.path.splitext(f)[0], lambda f: os.path.splitext(f)[0],
filter(lambda f: f.endswith(".py"), plugin_files) filter(lambda f: f.endswith(".py"), plugin_files),
) )
for plugin_name in plugin_names: for plugin_name in plugin_names:
module = importlib.import_module(f"edmond.plugins.{plugin_name}") module = importlib.import_module(f"edmond.plugins.{plugin_name}")
@ -138,10 +140,10 @@ class Bot(irc.client.SimpleIRCClient, Logger):
self.log_e(f"Dependencies not found for plugin {plugin_name}.") self.log_e(f"Dependencies not found for plugin {plugin_name}.")
continue continue
# Get plugin class name from its module name. # Get plugin class name from its module name.
class_name = "".join(map( class_name = (
lambda w: w.capitalize(), "".join(map(lambda w: w.capitalize(), plugin_name.split("_")))
plugin_name.split("_") + "Plugin"
)) + "Plugin" )
plugin_class = getattr(module, class_name) plugin_class = getattr(module, class_name)
self.plugins.append(plugin_class(self)) self.plugins.append(plugin_class(self))
self.values[plugin_name] = {} self.values[plugin_name] = {}

View file

@ -9,17 +9,17 @@ import ctypes.util
class _AnsiColorStreamHandler(logging.StreamHandler): class _AnsiColorStreamHandler(logging.StreamHandler):
DEFAULT = '\x1b[0m' DEFAULT = "\x1b[0m"
RED = '\x1b[31m' RED = "\x1b[31m"
GREEN = '\x1b[32m' GREEN = "\x1b[32m"
YELLOW = '\x1b[33m' YELLOW = "\x1b[33m"
CYAN = '\x1b[36m' CYAN = "\x1b[36m"
CRITICAL = RED CRITICAL = RED
ERROR = RED ERROR = RED
WARNING = YELLOW WARNING = YELLOW
INFO = GREEN INFO = GREEN
DEBUG = CYAN DEBUG = CYAN
def __init__(self, stream=None): def __init__(self, stream=None):
super().__init__(stream) super().__init__(stream)
@ -49,37 +49,37 @@ class _AnsiColorStreamHandler(logging.StreamHandler):
# pylint: disable=W0212 # pylint: disable=W0212
class _WinColorStreamHandler(logging.StreamHandler): class _WinColorStreamHandler(logging.StreamHandler):
STD_INPUT_HANDLE = -10 STD_INPUT_HANDLE = -10
STD_OUTPUT_HANDLE = -11 STD_OUTPUT_HANDLE = -11
STD_ERROR_HANDLE = -12 STD_ERROR_HANDLE = -12
FOREGROUND_BLACK = 0x0000 FOREGROUND_BLACK = 0x0000
FOREGROUND_BLUE = 0x0001 FOREGROUND_BLUE = 0x0001
FOREGROUND_GREEN = 0x0002 FOREGROUND_GREEN = 0x0002
FOREGROUND_CYAN = 0x0003 FOREGROUND_CYAN = 0x0003
FOREGROUND_RED = 0x0004 FOREGROUND_RED = 0x0004
FOREGROUND_MAGENTA = 0x0005 FOREGROUND_MAGENTA = 0x0005
FOREGROUND_YELLOW = 0x0006 FOREGROUND_YELLOW = 0x0006
FOREGROUND_GREY = 0x0007 FOREGROUND_GREY = 0x0007
FOREGROUND_INTENSITY = 0x0008 FOREGROUND_INTENSITY = 0x0008
FOREGROUND_WHITE = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED FOREGROUND_WHITE = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED
BACKGROUND_BLACK = 0x0000 BACKGROUND_BLACK = 0x0000
BACKGROUND_BLUE = 0x0010 BACKGROUND_BLUE = 0x0010
BACKGROUND_GREEN = 0x0020 BACKGROUND_GREEN = 0x0020
BACKGROUND_CYAN = 0x0030 BACKGROUND_CYAN = 0x0030
BACKGROUND_RED = 0x0040 BACKGROUND_RED = 0x0040
BACKGROUND_MAGENTA = 0x0050 BACKGROUND_MAGENTA = 0x0050
BACKGROUND_YELLOW = 0x0060 BACKGROUND_YELLOW = 0x0060
BACKGROUND_GREY = 0x0070 BACKGROUND_GREY = 0x0070
BACKGROUND_INTENSITY = 0x0080 BACKGROUND_INTENSITY = 0x0080
DEFAULT = FOREGROUND_WHITE DEFAULT = FOREGROUND_WHITE
CRITICAL = FOREGROUND_RED | FOREGROUND_INTENSITY CRITICAL = FOREGROUND_RED | FOREGROUND_INTENSITY
ERROR = FOREGROUND_RED | FOREGROUND_INTENSITY ERROR = FOREGROUND_RED | FOREGROUND_INTENSITY
WARNING = FOREGROUND_YELLOW | FOREGROUND_INTENSITY WARNING = FOREGROUND_YELLOW | FOREGROUND_INTENSITY
INFO = FOREGROUND_GREEN INFO = FOREGROUND_GREEN
DEBUG = FOREGROUND_CYAN DEBUG = FOREGROUND_CYAN
def __init__(self, stream=None): def __init__(self, stream=None):
super().__init__(stream) super().__init__(stream)
@ -116,23 +116,31 @@ class _WinColorStreamHandler(logging.StreamHandler):
return cls.DEFAULT return cls.DEFAULT
def _set_color_code(self, code): def _set_color_code(self, code):
ctypes.windll.kernel32.SetConsoleTextAttribute(self.output_handle, code) ctypes.windll.kernel32.SetConsoleTextAttribute(
self.output_handle, code
)
if platform.system() == "Windows": ColorStreamHandler = (
ColorStreamHandler = _WinColorStreamHandler _WinColorStreamHandler
else: if platform.system() == "Windows"
ColorStreamHandler = _AnsiColorStreamHandler else _AnsiColorStreamHandler
)
_LOG_LEVEL = logging.DEBUG _LOG_LEVEL = logging.DEBUG
_FORMAT = "%(asctime)s %(levelname)-8s %(message)s" _FORMAT = "%(asctime)s %(levelname)-8s %(message)s"
_DATE_FORMAT = "%H:%M:%S" _DATE_FORMAT = "%H:%M:%S"
def get_logger( name="pyshgck", level=_LOG_LEVEL def get_logger(
, log_format=_FORMAT, date_format=_DATE_FORMAT name="pyshgck",
, into_stderr=True, into_log_file=None ): level=_LOG_LEVEL,
log_format=_FORMAT,
date_format=_DATE_FORMAT,
into_stderr=True,
into_log_file=None,
):
logger = logging.getLogger(name) logger = logging.getLogger(name)
logger.setLevel(level) logger.setLevel(level)
formatter = logging.Formatter(fmt=log_format, datefmt=date_format) formatter = logging.Formatter(fmt=log_format, datefmt=date_format)
@ -153,7 +161,6 @@ def get_logger( name="pyshgck", level=_LOG_LEVEL
class Logger: class Logger:
def log_d(self, message): def log_d(self, message):
self.logger.debug(message) self.logger.debug(message)

View file

@ -179,7 +179,7 @@ class Plugin:
return False return False
# Is it a question I can answer? # Is it a question I can answer?
question = message[len(words[0]):].strip() question = message[len(words[0]) :].strip()
for preamble in self.config.get("questions", []): for preamble in self.config.get("questions", []):
aliases = self.config.get("aliases", {}).get(preamble, []) aliases = self.config.get("aliases", {}).get(preamble, [])
for q in (preamble, *aliases): for q in (preamble, *aliases):
@ -189,7 +189,7 @@ class Plugin:
return False return False
def __save_question(self, question, matched, preamble): def __save_question(self, question, matched, preamble):
content = question[len(matched):].strip() content = question[len(matched) :].strip()
content = content.rstrip("?").rstrip() content = content.rstrip("?").rstrip()
question = Question(preamble, content) question = Question(preamble, content)
self.question = question self.question = question
@ -310,7 +310,7 @@ class Plugin:
If it causes an issue with a plugin requiring the original target even If it causes an issue with a plugin requiring the original target even
on private message, override this method. on private message, override this method.
""" """
if (on_pubmsg := getattr(self, "on_pubmsg", None)): if on_pubmsg := getattr(self, "on_pubmsg", None):
event.target = NickMask(event.source).nick event.target = NickMask(event.source).nick
return on_pubmsg(event) return on_pubmsg(event)
return False return False

View file

@ -78,10 +78,9 @@ class AmbiencePlugin(Plugin):
return "".join(item * reps for item in random_items) return "".join(item * reps for item in random_items)
def apply_effect(self, chunk, word): def apply_effect(self, chunk, word):
return { return {1: self.insert_word, 2: self.interleave_word,}[
1: self.insert_word, random.randint(1, 2)
2: self.interleave_word, ](chunk, word)
}[random.randint(1, 2)](chunk, word)
def insert_word(self, chunk, word): def insert_word(self, chunk, word):
index = random.randint(0, len(chunk)) index = random.randint(0, len(chunk))
@ -89,6 +88,5 @@ class AmbiencePlugin(Plugin):
def interleave_word(self, chunk, word): def interleave_word(self, chunk, word):
return "".join( return "".join(
a + b a + b for a, b in zip_longest(chunk, word, fillvalue="")
for a, b in zip_longest(chunk, word, fillvalue='')
) )

View file

@ -22,8 +22,7 @@ class BeersPlugin(Plugin):
beer = random.choice(self.config["beers"]) beer = random.choice(self.config["beers"])
opening_text = self.config["opening_text"].format( opening_text = self.config["opening_text"].format(
beer=beer, beer=beer, target=target
target=target
) )
self.bot.say(event.target, opening_text) self.bot.say(event.target, opening_text)
return True return True

View file

@ -9,7 +9,10 @@ from edmond.utils import proc
class CapturePlugin(Plugin): class CapturePlugin(Plugin):
REQUIRED_CONFIGS = [ REQUIRED_CONFIGS = [
"rate", "things", "capture_sentence", "captured_sentence" "rate",
"things",
"capture_sentence",
"captured_sentence",
] ]
def __init__(self, bot): def __init__(self, bot):
@ -43,8 +46,7 @@ class CapturePlugin(Plugin):
def capture(self, winner, target): def capture(self, winner, target):
congratz = self.config["captured_sentence"].format( congratz = self.config["captured_sentence"].format(
winner=winner, winner=winner, thing=self.current_thing
thing=self.current_thing
) )
self.bot.say(target, congratz) self.bot.say(target, congratz)

View file

@ -29,7 +29,7 @@ class CaptureGivePlugin(Plugin):
# "give" command. # "give" command.
if self.command.ident == self.config["commands"][0]: if self.command.ident == self.config["commands"][0]:
content = self.command.raw[len(self.command.matched):].strip() content = self.command.raw[len(self.command.matched) :].strip()
matched = self.content_re.match(content) matched = self.content_re.match(content)
if not matched: if not matched:
return False return False
@ -41,9 +41,7 @@ class CaptureGivePlugin(Plugin):
# Check the sender has the thing they attempt to give. # Check the sender has the thing they attempt to give.
collections = self.get_storage_value( collections = self.get_storage_value(
"collections", "collections", default={}, ns="capture"
default={},
ns="capture"
) )
source = event.source.nick source = event.source.nick
source_collection = collections.get(source, []) source_collection = collections.get(source, [])
@ -51,7 +49,7 @@ class CaptureGivePlugin(Plugin):
reply = self.config["no_such_thing_reply"].format(thing=thing) reply = self.config["no_such_thing_reply"].format(thing=thing)
self.bot.say(event.target, reply) self.bot.say(event.target, reply)
return True return True
source_collection.remove(thing) source_collection.remove(thing)
collections[source] = source_collection collections[source] = source_collection

View file

@ -19,16 +19,14 @@ class CaptureListPlugin(Plugin):
collec_target = self.command.content or event.source.nick collec_target = self.command.content or event.source.nick
collections = self.get_storage_value( collections = self.get_storage_value(
"collections", "collections", default={}, ns="capture"
default={},
ns="capture"
) )
collection = collections.get(collec_target, []) collection = collections.get(collec_target, [])
if collection: if collection:
reply = self.config["reply"].format( reply = self.config["reply"].format(
target=collec_target, target=collec_target,
num=len(collection), num=len(collection),
things="".join(collection) things="".join(collection),
) )
else: else:
reply = self.config["empty_reply"].format(target=collec_target) reply = self.config["empty_reply"].format(target=collec_target)

View file

@ -9,8 +9,12 @@ class CaretakerPlugin(Plugin):
"""Say hello and farewall on people joining/parting.""" """Say hello and farewall on people joining/parting."""
REQUIRED_CONFIGS = [ REQUIRED_CONFIGS = [
"warm_welcome", "cold_welcome", "nice_farewell", "bad_farewell", "warm_welcome",
"welcome_rate", "farewell_rate" "cold_welcome",
"nice_farewell",
"bad_farewell",
"welcome_rate",
"farewell_rate",
] ]
def __init__(self, bot): def __init__(self, bot):

View file

@ -34,9 +34,8 @@ class JourneeMondialePlugin(Plugin):
today_obs = map( today_obs = map(
lambda line: line.split(maxsplit=1)[1], lambda line: line.split(maxsplit=1)[1],
filter( filter(
lambda line: line.startswith(date_tag), lambda line: line.startswith(date_tag), self.config["dates"]
self.config["dates"] ),
)
) )
reply = ", ".join(today_obs) reply = ", ".join(today_obs)
if not reply: if not reply:

View file

@ -2,6 +2,7 @@ import time
try: try:
import meteofrance_api as mf import meteofrance_api as mf
DEPENDENCIES_FOUND = True DEPENDENCIES_FOUND = True
except ImportError: except ImportError:
DEPENDENCIES_FOUND = False DEPENDENCIES_FOUND = False
@ -12,9 +13,14 @@ from edmond.plugin import Plugin
class MeteoFrancePlugin(Plugin): class MeteoFrancePlugin(Plugin):
REQUIRED_CONFIGS = [ REQUIRED_CONFIGS = [
"commands", "result_message", "nearest_message", "temp_format", "commands",
"rain_chance_format", "all_rain_format", "today_message", "result_message",
"minmax_temp_format" "nearest_message",
"temp_format",
"rain_chance_format",
"all_rain_format",
"today_message",
"minmax_temp_format",
] ]
def __init__(self, bot): def __init__(self, bot):
@ -54,7 +60,8 @@ class MeteoFrancePlugin(Plugin):
return return
result = self.config["result_message"].format( result = self.config["result_message"].format(
nearest_s=nearest_s, today_s=today_s) nearest_s=nearest_s, today_s=today_s
)
self.bot.say(event.target, result) self.bot.say(event.target, result)
def format_nearest_forecast(self, nearest, place): def format_nearest_forecast(self, nearest, place):
@ -65,43 +72,52 @@ class MeteoFrancePlugin(Plugin):
wind = self.format_wind(nearest["wind"]) wind = self.format_wind(nearest["wind"])
rain = self.format_rain_perc(nearest["rain"]) rain = self.format_rain_perc(nearest["rain"])
return self.config["nearest_message"].format( return self.config["nearest_message"].format(
city=city, hour=hour, weather=weather, temp=temp, wind=wind, city=city,
rain=rain hour=hour,
weather=weather,
temp=temp,
wind=wind,
rain=rain,
) )
def format_temperature(self, temperature): def format_temperature(self, temperature):
temp_c = temperature.get("value", "?") temp_c = temperature.get("value", "?")
temp_wc = temperature.get("windchill", "?") temp_wc = temperature.get("windchill", "?")
return self.config["temp_format"].format( return self.config["temp_format"].format(
temp_c=temp_c, temp_wc=temp_wc) temp_c=temp_c, temp_wc=temp_wc
)
def format_rain_perc(self, rain_percs): def format_rain_perc(self, rain_percs):
perc_fmt = self.config["rain_chance_format"] perc_fmt = self.config["rain_chance_format"]
all_percs = ', '.join( all_percs = ", ".join(
perc_fmt.format(p=p, h=h) perc_fmt.format(p=p, h=h) for h, p in rain_percs.items()
for h, p in rain_percs.items()
) )
return self.config["all_rain_format"].format(all_percs=all_percs) return self.config["all_rain_format"].format(all_percs=all_percs)
def format_wind(self, wind): def format_wind(self, wind):
speed = wind.get('speed') speed = wind.get("speed")
direction = wind.get('icon') direction = wind.get("icon")
if direction == "Variable": if direction == "Variable":
direction = self.config["unknown_direction"] direction = self.config["unknown_direction"]
return self.config["wind_format"].format( return self.config["wind_format"].format(
speed=speed, direction=direction) speed=speed, direction=direction
)
def format_today_forecast(self, today_f): def format_today_forecast(self, today_f):
temp = today_f['T'] temp = today_f["T"]
temp_minmax = self.config["minmax_temp_format"].format( temp_minmax = self.config["minmax_temp_format"].format(
t_max=temp["max"], t_min=temp["min"]) t_max=temp["max"], t_min=temp["min"]
rain = self.format_rain_perc(today_f['precipitation']) )
sunset = format_ts_hour(today_f['sun']['set']) rain = self.format_rain_perc(today_f["precipitation"])
sunset = format_ts_hour(today_f["sun"]["set"])
return self.config["today_message"].format( return self.config["today_message"].format(
temp_minmax=temp_minmax, rain=rain, sunset=sunset) temp_minmax=temp_minmax, rain=rain, sunset=sunset
)
def format_ts_hour(timestamp): def format_ts_hour(timestamp):
return time.strftime("%H:%M", time.localtime(timestamp)) return time.strftime("%H:%M", time.localtime(timestamp))
def format_weather(weather): def format_weather(weather):
return weather.get("desc", "?").lower() return weather.get("desc", "?").lower()

View file

@ -21,16 +21,18 @@ class MiscReactionsPlugin(Plugin):
REQUIRED_CONFIGS = ["reactions", "rate"] REQUIRED_CONFIGS = ["reactions", "rate"]
REACTIONS = set([ REACTIONS = set(
"sentence", [
"stop", "sentence",
"king", "stop",
"mmm", "king",
"ooo", "mmm",
"detector", "ooo",
"repeat_letters", "detector",
"nudge", "repeat_letters",
]) "nudge",
]
)
def __init__(self, bot): def __init__(self, bot):
super().__init__(bot) super().__init__(bot)
@ -136,8 +138,12 @@ class MiscReactionsPlugin(Plugin):
detector_neg = self.config.get("detector_neg") detector_neg = self.config.get("detector_neg")
if any( if any(
s is None s is None
for s in (detector_message, detector_process, detector_pos, for s in (
detector_neg) detector_message,
detector_process,
detector_pos,
detector_neg,
)
): ):
return return
self.bot.say(event.target, detector_message.format(subject=words[-1])) self.bot.say(event.target, detector_message.format(subject=words[-1]))
@ -155,10 +161,9 @@ class MiscReactionsPlugin(Plugin):
biggest_word = sorted(words, key=lambda w: len(w))[-1] biggest_word = sorted(words, key=lambda w: len(w))[-1]
num_repeats = 2 num_repeats = 2
repeated = biggest_word[:num_repeats] repeated = biggest_word[:num_repeats]
while ( while (not any(letter in repeated for letter in "aeiouy")) and len(
(not any(letter in repeated for letter in "aeiouy")) repeated
and len(repeated) < len(biggest_word) ) < len(biggest_word):
):
num_repeats += 1 num_repeats += 1
repeated = biggest_word[:num_repeats] repeated = biggest_word[:num_repeats]
word = biggest_word[:2] + biggest_word word = biggest_word[:2] + biggest_word

View file

@ -21,7 +21,11 @@ class MoodPlugin(Plugin):
""" """
REQUIRED_CONFIGS = [ REQUIRED_CONFIGS = [
"commands", "questions", "greetings", "answer", "calmed_message", "commands",
"questions",
"greetings",
"answer",
"calmed_message",
] ]
def __init__(self, bot): def __init__(self, bot):

View file

@ -2,6 +2,7 @@ import random
try: try:
from scaruffi.api import ScaruffiApi from scaruffi.api import ScaruffiApi
DEPENDENCIES_FOUND = True DEPENDENCIES_FOUND = True
except ImportError: except ImportError:
DEPENDENCIES_FOUND = False DEPENDENCIES_FOUND = False
@ -11,7 +12,7 @@ from edmond.plugin import Plugin
class MusicPlugin(Plugin): class MusicPlugin(Plugin):
"""Get some good music for your friends using the scaruffi library. """Get some good music for your friends using the scaruffi library.
The first command returns a random good album. The second command allows you The first command returns a random good album. The second command allows you
to choose the decade: you can say 1960, 60, 60s or 60's, all of these will to choose the decade: you can say 1960, 60, 60s or 60's, all of these will
return an album from the sixties. return an album from the sixties.

View file

@ -6,8 +6,12 @@ from edmond.plugin import Plugin
class NotesPlugin(Plugin): class NotesPlugin(Plugin):
REQUIRED_CONFIGS = [ REQUIRED_CONFIGS = [
"commands", "content_regex", "confirmation", "deliver_format", "limit", "commands",
"too_many_notes" "content_regex",
"confirmation",
"deliver_format",
"limit",
"too_many_notes",
] ]
def __init__(self, bot): def __init__(self, bot):
@ -32,7 +36,7 @@ class NotesPlugin(Plugin):
# "note down" command. # "note down" command.
if self.command.ident == self.config["commands"][0]: if self.command.ident == self.config["commands"][0]:
content = self.command.raw[len(self.command.matched):].strip() content = self.command.raw[len(self.command.matched) :].strip()
matched = self.content_re.match(content) matched = self.content_re.match(content)
if not matched: if not matched:
return False return False
@ -51,7 +55,7 @@ class NotesPlugin(Plugin):
note = { note = {
"sender": event.source.nick, "sender": event.source.nick,
"dest": target, "dest": target,
"message": message "message": message,
} }
self.append_storage_list_value("notes", note) self.append_storage_list_value("notes", note)
self.bot.say(event.target, self.config["confirmation"]) self.bot.say(event.target, self.config["confirmation"])

View file

@ -8,7 +8,11 @@ from edmond.plugin import Plugin
class OpinionPlugin(Plugin): class OpinionPlugin(Plugin):
REQUIRED_CONFIGS = [ REQUIRED_CONFIGS = [
"questions", "thinking", "thinking_time", "positive", "negative" "questions",
"thinking",
"thinking_time",
"positive",
"negative",
] ]
def __init__(self, bot): def __init__(self, bot):

View file

@ -9,8 +9,13 @@ class SleepPlugin(Plugin):
"""Handle sleep state of the bot, snore a little bit.""" """Handle sleep state of the bot, snore a little bit."""
REQUIRED_CONFIGS = [ REQUIRED_CONFIGS = [
"commands", "sleep_time", "wakeup_time", "snore", "sleep_messages", "commands",
"wakeup_messages", "snore_rate" "sleep_time",
"wakeup_time",
"snore",
"sleep_messages",
"wakeup_messages",
"snore_rate",
] ]
def __init__(self, bot): def __init__(self, bot):
@ -65,7 +70,9 @@ class SleepPlugin(Plugin):
return return
self.set_runtime_value("awake", True) self.set_runtime_value("awake", True)
for channel in self.bot.channels: for channel in self.bot.channels:
self.bot.say(channel, random.choice(self.config["wakeup_messages"])) self.bot.say(
channel, random.choice(self.config["wakeup_messages"])
)
def is_sleep_time(self, now): def is_sleep_time(self, now):
"""Return True if the bot should be sleeping by now. """Return True if the bot should be sleeping by now.
@ -83,9 +90,7 @@ class SleepPlugin(Plugin):
else: else:
ref_dt = now ref_dt = now
sleep_dt, wakeup_dt = self._get_sleep_range( sleep_dt, wakeup_dt = self._get_sleep_range(
ref_dt, ref_dt, sleep_time, wakeup_time
sleep_time,
wakeup_time
) )
return sleep_dt <= now < wakeup_dt return sleep_dt <= now < wakeup_dt

View file

@ -30,8 +30,11 @@ IMG_FETCH_HTML = """\
class TaxrefPlugin(Plugin): class TaxrefPlugin(Plugin):
REQUIRED_CONFIGS = [ REQUIRED_CONFIGS = [
"commands", "not_found_reply", "reply", "ambiguous_reply", "commands",
"unnamed_species" "not_found_reply",
"reply",
"ambiguous_reply",
"unnamed_species",
] ]
def __init__(self, bot): def __init__(self, bot):
@ -90,7 +93,8 @@ class TaxrefPlugin(Plugin):
# If there are several species, check if one of them has the # If there are several species, check if one of them has the
# exact same name; else show an ambiguous reply. # exact same name; else show an ambiguous reply.
species_with_same_name = [ species_with_same_name = [
item for item in species_items item
for item in species_items
if item["scientificName"].lower() == name if item["scientificName"].lower() == name
] ]
if len(species_with_same_name) != 1: if len(species_with_same_name) != 1:
@ -109,7 +113,7 @@ class TaxrefPlugin(Plugin):
) )
self.bot.say(target, reply) self.bot.say(target, reply)
if (images_reply := self.get_images_reply(item_to_use)): if images_reply := self.get_images_reply(item_to_use):
self.bot.say(target, images_reply) self.bot.say(target, images_reply)
def get_ambiguous_reply(self, items): def get_ambiguous_reply(self, items):
@ -153,7 +157,7 @@ class TaxrefPlugin(Plugin):
def get_img_url(item): def get_img_url(item):
return item.get("_links", {}).get("file", {}).get("href") return item.get("_links", {}).get("file", {}).get("href")
if (shrlok := self.bot.get_plugin("shrlok")): if shrlok := self.bot.get_plugin("shrlok"):
if len(items) > 10: if len(items) > 10:
items = random.sample(items, 10) items = random.sample(items, 10)
urls = map(get_img_url, items) urls = map(get_img_url, items)
@ -191,15 +195,18 @@ class TaxrefPlugin(Plugin):
else: else:
# More than one result? For simplicity sake, use the shrlok plugin # More than one result? For simplicity sake, use the shrlok plugin
# if available or just show an ambiguous response. # if available or just show an ambiguous response.
if (shrlok := self.bot.get_plugin("shrlok")): if shrlok := self.bot.get_plugin("shrlok"):
text = "\n".join( text = (
( "\n".join(
item['frenchVernacularName'] + (
"" + item["frenchVernacularName"]
TaxrefPlugin.item_to_full_name(item) + ""
+ TaxrefPlugin.item_to_full_name(item)
)
for item in items
) )
for item in items + "\n"
) + "\n" )
reply = shrlok.post_text(text) reply = shrlok.post_text(text)
else: else:
reply = self.get_ambiguous_reply(items) reply = self.get_ambiguous_reply(items)

View file

@ -7,7 +7,6 @@ from ..sleep import SleepPlugin
class TestSleepPlugin(unittest.TestCase): class TestSleepPlugin(unittest.TestCase):
def test_is_sleep_time(self): def test_is_sleep_time(self):
with get_plugin_patcher(SleepPlugin): with get_plugin_patcher(SleepPlugin):
plugin = SleepPlugin() plugin = SleepPlugin()

View file

@ -5,7 +5,6 @@ from ..translate import TranslatePlugin
class TestTranslatePlugin(unittest.TestCase): class TestTranslatePlugin(unittest.TestCase):
def test_parse_words(self): def test_parse_words(self):
with get_plugin_patcher(TranslatePlugin): with get_plugin_patcher(TranslatePlugin):
plugin = TranslatePlugin() plugin = TranslatePlugin()

View file

@ -1,5 +1,6 @@
try: try:
from translate import Translator from translate import Translator
DEPENDENCIES_FOUND = True DEPENDENCIES_FOUND = True
except ImportError: except ImportError:
DEPENDENCIES_FOUND = False DEPENDENCIES_FOUND = False
@ -10,7 +11,10 @@ from edmond.plugin import Plugin
class TranslatePlugin(Plugin): class TranslatePlugin(Plugin):
REQUIRED_CONFIGS = [ REQUIRED_CONFIGS = [
"commands", "default_dest", "param_source", "param_dest", "commands",
"default_dest",
"param_source",
"param_dest",
] ]
def __init__(self, bot): def __init__(self, bot):

View file

@ -1,5 +1,6 @@
try: try:
import wolframalpha import wolframalpha
DEPENDENCIES_FOUND = True DEPENDENCIES_FOUND = True
except ImportError: except ImportError:
DEPENDENCIES_FOUND = False DEPENDENCIES_FOUND = False
@ -79,7 +80,9 @@ class UnknownCommandPlugin(Plugin):
else: else:
reply = answer_text reply = answer_text
if len(reply) > self.MAX_LENGTH - len(self.CUT_MARK): if len(reply) > self.MAX_LENGTH - len(self.CUT_MARK):
reply = reply[:self.MAX_LENGTH - len(self.CUT_MARK)] + self.CUT_MARK reply = (
reply[: self.MAX_LENGTH - len(self.CUT_MARK)] + self.CUT_MARK
)
self.bot.say(target, reply) self.bot.say(target, reply)
@staticmethod @staticmethod

View file

@ -2,6 +2,7 @@ import time
try: try:
import wikipedia import wikipedia
DEPENDENCIES_FOUND = True DEPENDENCIES_FOUND = True
except ImportError: except ImportError:
DEPENDENCIES_FOUND = False DEPENDENCIES_FOUND = False
@ -12,7 +13,10 @@ from edmond.plugin import Plugin
class WikipediaPlugin(Plugin): class WikipediaPlugin(Plugin):
REQUIRED_CONFIGS = [ REQUIRED_CONFIGS = [
"commands", "ambiguous_response", "empty_response", "lang", "commands",
"ambiguous_response",
"empty_response",
"lang",
] ]
NUM_RETRIES = 3 NUM_RETRIES = 3

View file

@ -1,6 +1,7 @@
try: try:
from googleapiclient.discovery import build as gapi_discovery_build from googleapiclient.discovery import build as gapi_discovery_build
from googleapiclient.errors import Error as GoogleApiError from googleapiclient.errors import Error as GoogleApiError
DEPENDENCIES_FOUND = True DEPENDENCIES_FOUND = True
except ImportError: except ImportError:
DEPENDENCIES_FOUND = False DEPENDENCIES_FOUND = False
@ -23,9 +24,7 @@ class YoutubePlugin(Plugin):
def youtube(self): def youtube(self):
if self._youtube is None: if self._youtube is None:
self._youtube = gapi_discovery_build( self._youtube = gapi_discovery_build(
"youtube", "youtube", "v3", developerKey=self.config["api_key"]
"v3",
developerKey=self.config["api_key"]
) )
return self._youtube return self._youtube
@ -43,11 +42,15 @@ class YoutubePlugin(Plugin):
def handle_commands(self, target): def handle_commands(self, target):
if self.command.ident == self.config["commands"][0]: if self.command.ident == self.config["commands"][0]:
try: try:
search_response = self.youtube.search().list( search_response = (
q=self.command.content, self.youtube.search()
part="id,snippet", .list(
maxResults=1, q=self.command.content,
).execute() part="id,snippet",
maxResults=1,
)
.execute()
)
except GoogleApiError: except GoogleApiError:
self.signal_failure(target) self.signal_failure(target)
return return

View file

@ -2,6 +2,7 @@ import re
try: try:
from googleapiclient.errors import Error as GoogleApiError from googleapiclient.errors import Error as GoogleApiError
DEPENDENCIES_FOUND = True DEPENDENCIES_FOUND = True
except ImportError: except ImportError:
DEPENDENCIES_FOUND = False DEPENDENCIES_FOUND = False
@ -49,8 +50,7 @@ class YoutubeParserPlugin(Plugin):
return False return False
try: try:
search_response = ( search_response = (
self.youtube_plugin.youtube self.youtube_plugin.youtube.videos()
.videos()
.list(id=code, part="snippet") .list(id=code, part="snippet")
.execute() .execute()
) )

View file

@ -8,5 +8,6 @@ def http_get(url):
if response.status_code == 200: if response.status_code == 200:
return response.text return response.text
def proc(proba_percentage): def proc(proba_percentage):
return random.random() < (proba_percentage / 100.0) return random.random() < (proba_percentage / 100.0)

2
pyproject.toml Normal file
View file

@ -0,0 +1,2 @@
[tool.black]
line-length = 79