From 4c5290a7f355f68123dcde7b8f3142f906d6e466 Mon Sep 17 00:00:00 2001 From: tarepan Date: Mon, 26 Feb 2024 04:36:23 +0000 Subject: [PATCH 1/8] bump: `pytest` --- poetry.lock | 28 ++++++++++++++-------------- pyproject.toml | 4 ++-- requirements-test.txt | 6 +++--- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/poetry.lock b/poetry.lock index daa98c671..954cd1549 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1395,13 +1395,13 @@ test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.4)", "pytest-co [[package]] name = "pluggy" -version = "1.2.0" +version = "1.4.0" description = "plugin and hook calling mechanisms for python" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "pluggy-1.2.0-py3-none-any.whl", hash = "sha256:c2fd55a7d7a3863cba1a013e4e2414658b1d07b6bc57b3919e0c63c9abb99849"}, - {file = "pluggy-1.2.0.tar.gz", hash = "sha256:d12f0c4b579b15f5e054301bb226ee85eeeba08ffec228092f8defbaa3a4c4b3"}, + {file = "pluggy-1.4.0-py3-none-any.whl", hash = "sha256:7db9f7b503d67d1c5b95f59773ebb58a8c1c288129a88665838012cfb07b8981"}, + {file = "pluggy-1.4.0.tar.gz", hash = "sha256:8c85c2876142a764e5b7548e7d9a0e0ddb46f5185161049a79b7e974454223be"}, ] [package.extras] @@ -1740,20 +1740,20 @@ lint = ["black (>=19.10b0,<=22.10)", "flake8 (>=3.7,<5)", "flake8-bugbear", "iso [[package]] name = "pytest" -version = "7.4.3" +version = "8.0.2" description = "pytest: simple powerful testing with Python" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "pytest-7.4.3-py3-none-any.whl", hash = "sha256:0d009c083ea859a71b76adf7c1d502e4bc170b80a8ef002da5806527b9591fac"}, - {file = "pytest-7.4.3.tar.gz", hash = "sha256:d989d136982de4e3b29dabcc838ad581c64e8ed52c11fbe86ddebd9da0818cd5"}, + {file = "pytest-8.0.2-py3-none-any.whl", hash = "sha256:edfaaef32ce5172d5466b5127b42e0d6d35ebbe4453f0e3505d96afd93f6b096"}, + {file = "pytest-8.0.2.tar.gz", hash = "sha256:d4051d623a2e0b7e51960ba963193b09ce6daeb9759a451844a21e4ddedfc1bd"}, ] [package.dependencies] colorama = {version = "*", markers = "sys_platform == \"win32\""} iniconfig = "*" packaging = "*" -pluggy = ">=0.12,<2.0" +pluggy = ">=1.3.0,<2.0" [package.extras] testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] @@ -2176,17 +2176,17 @@ full = ["httpx (>=0.22.0)", "itsdangerous", "jinja2", "python-multipart", "pyyam [[package]] name = "syrupy" -version = "4.6.0" +version = "4.6.1" description = "Pytest Snapshot Test Utility" optional = false python-versions = ">=3.8.1,<4" files = [ - {file = "syrupy-4.6.0-py3-none-any.whl", hash = "sha256:747aae1bcf3cb3249e33b1e6d81097874d23615982d5686ebe637875b0775a1b"}, - {file = "syrupy-4.6.0.tar.gz", hash = "sha256:231b1f5d00f1f85048ba81676c79448076189c4aef4d33f21ae32f3b4c565a54"}, + {file = "syrupy-4.6.1-py3-none-any.whl", hash = "sha256:203e52f9cb9fa749cf683f29bd68f02c16c3bc7e7e5fe8f2fc59bdfe488ce133"}, + {file = "syrupy-4.6.1.tar.gz", hash = "sha256:37a835c9ce7857eeef86d62145885e10b3cb9615bc6abeb4ce404b3f18e1bb36"}, ] [package.dependencies] -pytest = ">=7.0.0,<8.0.0" +pytest = ">=7.0.0,<9.0.0" [[package]] name = "tomlkit" @@ -2432,4 +2432,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p [metadata] lock-version = "2.0" python-versions = "~3.11" -content-hash = "4635ad235914ef05225525233ce0723226417491de9f2551112682c707921365" +content-hash = "b6546429361358b763c319b5fb13637ba39312b6ed23d6028bcd9fde546e497e" diff --git a/pyproject.toml b/pyproject.toml index 9d0db2df3..8e8696d9c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -69,11 +69,11 @@ flake8-bugbear = "^23.1.0" flake8 = "^6.0.0" isort = "^5.12.0" mypy = "^1.8.0" -pytest = "^7.4.3" +pytest = "^8.0.0" coveralls = "^3.2.0" poetry = "^1.3.1" httpx = "^0.25.0" # NOTE: required by fastapi.testclient.TestClient -syrupy = "^4.6.0" +syrupy = "^4.6.1" types-pyyaml = "^6.0" [tool.poetry.group.license.dependencies] diff --git a/requirements-test.txt b/requirements-test.txt index ea3290c26..0cc797fc0 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -51,7 +51,7 @@ pathspec==0.11.2 ; python_version >= "3.11" and python_version < "3.12" pexpect==4.8.0 ; python_version >= "3.11" and python_version < "3.12" pkginfo==1.9.6 ; python_version >= "3.11" and python_version < "3.12" platformdirs==3.10.0 ; python_version >= "3.11" and python_version < "3.12" -pluggy==1.2.0 ; python_version >= "3.11" and python_version < "3.12" +pluggy==1.4.0 ; python_version >= "3.11" and python_version < "3.12" poetry-core==1.7.0 ; python_version >= "3.11" and python_version < "3.12" poetry-plugin-export==1.5.0 ; python_version >= "3.11" and python_version < "3.12" poetry==1.6.1 ; python_version >= "3.11" and python_version < "3.12" @@ -64,7 +64,7 @@ pyopenjtalk @ git+https://github.com/VOICEVOX/pyopenjtalk@b35fc89fe42948a28e33ae pyproject-hooks==1.0.0 ; python_version >= "3.11" and python_version < "3.12" pyrsistent==0.19.3 ; python_version >= "3.11" and python_version < "3.12" pysen==0.10.5 ; python_version >= "3.11" and python_version < "3.12" -pytest==7.4.3 ; python_version >= "3.11" and python_version < "3.12" +pytest==8.0.2 ; python_version >= "3.11" and python_version < "3.12" python-multipart==0.0.5 ; python_version >= "3.11" and python_version < "3.12" pywin32-ctypes==0.2.2 ; python_version >= "3.11" and python_version < "3.12" and sys_platform == "win32" pyworld==0.3.4 ; python_version >= "3.11" and python_version < "3.12" @@ -81,7 +81,7 @@ sniffio==1.3.0 ; python_version >= "3.11" and python_version < "3.12" soundfile==0.12.1 ; python_version >= "3.11" and python_version < "3.12" soxr==0.3.6 ; python_version >= "3.11" and python_version < "3.12" starlette==0.27.0 ; python_version >= "3.11" and python_version < "3.12" -syrupy==4.6.0 ; python_version >= "3.11" and python_version < "3.12" +syrupy==4.6.1 ; python_version >= "3.11" and python_version < "3.12" tomlkit==0.12.1 ; python_version >= "3.11" and python_version < "3.12" tqdm==4.66.1 ; python_version >= "3.11" and python_version < "3.12" trove-classifiers==2023.8.7 ; python_version >= "3.11" and python_version < "3.12" From d1e8824ff064b124d43a3e893bcac8da34dd082b Mon Sep 17 00:00:00 2001 From: tarepan Date: Mon, 26 Feb 2024 04:44:17 +0000 Subject: [PATCH 2/8] bump: flake8 --- poetry.lock | 22 +++++++++++----------- pyproject.toml | 4 ++-- requirements-test.txt | 6 +++--- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/poetry.lock b/poetry.lock index 954cd1549..fc2ef3724 100644 --- a/poetry.lock +++ b/poetry.lock @@ -717,29 +717,29 @@ testing = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "diff-cover (>=7.5)", "p [[package]] name = "flake8" -version = "6.1.0" +version = "7.0.0" description = "the modular source code checker: pep8 pyflakes and co" optional = false python-versions = ">=3.8.1" files = [ - {file = "flake8-6.1.0-py2.py3-none-any.whl", hash = "sha256:ffdfce58ea94c6580c77888a86506937f9a1a227dfcd15f245d694ae20a6b6e5"}, - {file = "flake8-6.1.0.tar.gz", hash = "sha256:d5b3857f07c030bdb5bf41c7f53799571d75c4491748a3adcd47de929e34cd23"}, + {file = "flake8-7.0.0-py2.py3-none-any.whl", hash = "sha256:a6dfbb75e03252917f2473ea9653f7cd799c3064e54d4c8140044c5c065f53c3"}, + {file = "flake8-7.0.0.tar.gz", hash = "sha256:33f96621059e65eec474169085dc92bf26e7b2d47366b70be2f67ab80dc25132"}, ] [package.dependencies] mccabe = ">=0.7.0,<0.8.0" pycodestyle = ">=2.11.0,<2.12.0" -pyflakes = ">=3.1.0,<3.2.0" +pyflakes = ">=3.2.0,<3.3.0" [[package]] name = "flake8-bugbear" -version = "23.7.10" +version = "24.2.6" description = "A plugin for flake8 finding likely bugs and design problems in your program. Contains warnings that don't belong in pyflakes and pycodestyle." optional = false python-versions = ">=3.8.1" files = [ - {file = "flake8-bugbear-23.7.10.tar.gz", hash = "sha256:0ebdc7d8ec1ca8bd49347694562381f099f4de2f8ec6bda7a7dca65555d9e0d4"}, - {file = "flake8_bugbear-23.7.10-py3-none-any.whl", hash = "sha256:d99d005114020fbef47ed5e4aebafd22f167f9a0fbd0d8bf3c9e90612cb25c34"}, + {file = "flake8-bugbear-24.2.6.tar.gz", hash = "sha256:f9cb5f2a9e792dd80ff68e89a14c12eed8620af8b41a49d823b7a33064ac9658"}, + {file = "flake8_bugbear-24.2.6-py3-none-any.whl", hash = "sha256:663ef5de80cd32aacd39d362212983bc4636435a6f83700b4ed35acbd0b7d1b8"}, ] [package.dependencies] @@ -1591,13 +1591,13 @@ email = ["email-validator (>=1.0.3)"] [[package]] name = "pyflakes" -version = "3.1.0" +version = "3.2.0" description = "passive checker of Python programs" optional = false python-versions = ">=3.8" files = [ - {file = "pyflakes-3.1.0-py2.py3-none-any.whl", hash = "sha256:4132f6d49cb4dae6819e5379898f2b8cce3c5f23994194c24b77d5da2e36f774"}, - {file = "pyflakes-3.1.0.tar.gz", hash = "sha256:a0aae034c444db0071aa077972ba4768d40c830d9539fd45bf4cd3f8f6992efc"}, + {file = "pyflakes-3.2.0-py2.py3-none-any.whl", hash = "sha256:84b5be138a2dfbb40689ca07e2152deb896a65c3a3e24c251c5c62489568074a"}, + {file = "pyflakes-3.2.0.tar.gz", hash = "sha256:1c61603ff154621fb2a9172037d84dca3500def8c8b630657d1701f026f8af3f"}, ] [[package]] @@ -2432,4 +2432,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p [metadata] lock-version = "2.0" python-versions = "~3.11" -content-hash = "b6546429361358b763c319b5fb13637ba39312b6ed23d6028bcd9fde546e497e" +content-hash = "fec6204c617cde40253e359046f0d453e2c8d47a9f05da8b95670afda81a050b" diff --git a/pyproject.toml b/pyproject.toml index 8e8696d9c..7bae624e7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -65,8 +65,8 @@ poetry = "^1.3.1" [tool.poetry.group.test.dependencies] pysen = "~0.10.5" black = "^22.12.0" -flake8-bugbear = "^23.1.0" -flake8 = "^6.0.0" +flake8-bugbear = "^24.2.6" +flake8 = "^7.0.0" isort = "^5.12.0" mypy = "^1.8.0" pytest = "^8.0.0" diff --git a/requirements-test.txt b/requirements-test.txt index 0cc797fc0..17ba24fe6 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -22,8 +22,8 @@ docopt==0.6.2 ; python_version >= "3.11" and python_version < "3.12" dulwich==0.21.5 ; python_version >= "3.11" and python_version < "3.12" fastapi==0.103.2 ; python_version >= "3.11" and python_version < "3.12" filelock==3.12.2 ; python_version >= "3.11" and python_version < "3.12" -flake8-bugbear==23.7.10 ; python_version >= "3.11" and python_version < "3.12" -flake8==6.1.0 ; python_version >= "3.11" and python_version < "3.12" +flake8-bugbear==24.2.6 ; python_version >= "3.11" and python_version < "3.12" +flake8==7.0.0 ; python_version >= "3.11" and python_version < "3.12" gitdb==4.0.10 ; python_version >= "3.11" and python_version < "3.12" gitpython==3.1.32 ; python_version >= "3.11" and python_version < "3.12" h11==0.14.0 ; python_version >= "3.11" and python_version < "3.12" @@ -59,7 +59,7 @@ ptyprocess==0.7.0 ; python_version >= "3.11" and python_version < "3.12" pycodestyle==2.11.0 ; python_version >= "3.11" and python_version < "3.12" pycparser==2.21 ; python_version >= "3.11" and python_version < "3.12" pydantic==1.10.12 ; python_version >= "3.11" and python_version < "3.12" -pyflakes==3.1.0 ; python_version >= "3.11" and python_version < "3.12" +pyflakes==3.2.0 ; python_version >= "3.11" and python_version < "3.12" pyopenjtalk @ git+https://github.com/VOICEVOX/pyopenjtalk@b35fc89fe42948a28e33aed886ea145a51113f88 ; python_version >= "3.11" and python_version < "3.12" pyproject-hooks==1.0.0 ; python_version >= "3.11" and python_version < "3.12" pyrsistent==0.19.3 ; python_version >= "3.11" and python_version < "3.12" From efd5d8e34a663a7a560e8d33bc816ec911f55c30 Mon Sep 17 00:00:00 2001 From: tarepan Date: Mon, 26 Feb 2024 04:46:57 +0000 Subject: [PATCH 3/8] bump: `black` --- poetry.lock | 43 +++++++++++++++++++++++++++---------------- pyproject.toml | 2 +- requirements-test.txt | 2 +- 3 files changed, 29 insertions(+), 18 deletions(-) diff --git a/poetry.lock b/poetry.lock index fc2ef3724..3b58b697e 100644 --- a/poetry.lock +++ b/poetry.lock @@ -65,34 +65,45 @@ tests-no-zope = ["cloudpickle", "hypothesis", "mypy (>=1.1.1)", "pympler", "pyte [[package]] name = "black" -version = "22.12.0" +version = "24.2.0" description = "The uncompromising code formatter." optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "black-22.12.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9eedd20838bd5d75b80c9f5487dbcb06836a43833a37846cf1d8c1cc01cef59d"}, - {file = "black-22.12.0-cp310-cp310-win_amd64.whl", hash = "sha256:159a46a4947f73387b4d83e87ea006dbb2337eab6c879620a3ba52699b1f4351"}, - {file = "black-22.12.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d30b212bffeb1e252b31dd269dfae69dd17e06d92b87ad26e23890f3efea366f"}, - {file = "black-22.12.0-cp311-cp311-win_amd64.whl", hash = "sha256:7412e75863aa5c5411886804678b7d083c7c28421210180d67dfd8cf1221e1f4"}, - {file = "black-22.12.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c116eed0efb9ff870ded8b62fe9f28dd61ef6e9ddd28d83d7d264a38417dcee2"}, - {file = "black-22.12.0-cp37-cp37m-win_amd64.whl", hash = "sha256:1f58cbe16dfe8c12b7434e50ff889fa479072096d79f0a7f25e4ab8e94cd8350"}, - {file = "black-22.12.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:77d86c9f3db9b1bf6761244bc0b3572a546f5fe37917a044e02f3166d5aafa7d"}, - {file = "black-22.12.0-cp38-cp38-win_amd64.whl", hash = "sha256:82d9fe8fee3401e02e79767016b4907820a7dc28d70d137eb397b92ef3cc5bfc"}, - {file = "black-22.12.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:101c69b23df9b44247bd88e1d7e90154336ac4992502d4197bdac35dd7ee3320"}, - {file = "black-22.12.0-cp39-cp39-win_amd64.whl", hash = "sha256:559c7a1ba9a006226f09e4916060982fd27334ae1998e7a38b3f33a37f7a2148"}, - {file = "black-22.12.0-py3-none-any.whl", hash = "sha256:436cc9167dd28040ad90d3b404aec22cedf24a6e4d7de221bec2730ec0c97bcf"}, - {file = "black-22.12.0.tar.gz", hash = "sha256:229351e5a18ca30f447bf724d007f890f97e13af070bb6ad4c0a441cd7596a2f"}, + {file = "black-24.2.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:6981eae48b3b33399c8757036c7f5d48a535b962a7c2310d19361edeef64ce29"}, + {file = "black-24.2.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:d533d5e3259720fdbc1b37444491b024003e012c5173f7d06825a77508085430"}, + {file = "black-24.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:61a0391772490ddfb8a693c067df1ef5227257e72b0e4108482b8d41b5aee13f"}, + {file = "black-24.2.0-cp310-cp310-win_amd64.whl", hash = "sha256:992e451b04667116680cb88f63449267c13e1ad134f30087dec8527242e9862a"}, + {file = "black-24.2.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:163baf4ef40e6897a2a9b83890e59141cc8c2a98f2dda5080dc15c00ee1e62cd"}, + {file = "black-24.2.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:e37c99f89929af50ffaf912454b3e3b47fd64109659026b678c091a4cd450fb2"}, + {file = "black-24.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4f9de21bafcba9683853f6c96c2d515e364aee631b178eaa5145fc1c61a3cc92"}, + {file = "black-24.2.0-cp311-cp311-win_amd64.whl", hash = "sha256:9db528bccb9e8e20c08e716b3b09c6bdd64da0dd129b11e160bf082d4642ac23"}, + {file = "black-24.2.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:d84f29eb3ee44859052073b7636533ec995bd0f64e2fb43aeceefc70090e752b"}, + {file = "black-24.2.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:1e08fb9a15c914b81dd734ddd7fb10513016e5ce7e6704bdd5e1251ceee51ac9"}, + {file = "black-24.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:810d445ae6069ce64030c78ff6127cd9cd178a9ac3361435708b907d8a04c693"}, + {file = "black-24.2.0-cp312-cp312-win_amd64.whl", hash = "sha256:ba15742a13de85e9b8f3239c8f807723991fbfae24bad92d34a2b12e81904982"}, + {file = "black-24.2.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:7e53a8c630f71db01b28cd9602a1ada68c937cbf2c333e6ed041390d6968faf4"}, + {file = "black-24.2.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:93601c2deb321b4bad8f95df408e3fb3943d85012dddb6121336b8e24a0d1218"}, + {file = "black-24.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a0057f800de6acc4407fe75bb147b0c2b5cbb7c3ed110d3e5999cd01184d53b0"}, + {file = "black-24.2.0-cp38-cp38-win_amd64.whl", hash = "sha256:faf2ee02e6612577ba0181f4347bcbcf591eb122f7841ae5ba233d12c39dcb4d"}, + {file = "black-24.2.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:057c3dc602eaa6fdc451069bd027a1b2635028b575a6c3acfd63193ced20d9c8"}, + {file = "black-24.2.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:08654d0797e65f2423f850fc8e16a0ce50925f9337fb4a4a176a7aa4026e63f8"}, + {file = "black-24.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ca610d29415ee1a30a3f30fab7a8f4144e9d34c89a235d81292a1edb2b55f540"}, + {file = "black-24.2.0-cp39-cp39-win_amd64.whl", hash = "sha256:4dd76e9468d5536abd40ffbc7a247f83b2324f0c050556d9c371c2b9a9a95e31"}, + {file = "black-24.2.0-py3-none-any.whl", hash = "sha256:e8a6ae970537e67830776488bca52000eaa37fa63b9988e8c487458d9cd5ace6"}, + {file = "black-24.2.0.tar.gz", hash = "sha256:bce4f25c27c3435e4dace4815bcb2008b87e167e3bf4ee47ccdc5ce906eb4894"}, ] [package.dependencies] click = ">=8.0.0" mypy-extensions = ">=0.4.3" +packaging = ">=22.0" pathspec = ">=0.9.0" platformdirs = ">=2" [package.extras] colorama = ["colorama (>=0.4.3)"] -d = ["aiohttp (>=3.7.4)"] +d = ["aiohttp (>=3.7.4)", "aiohttp (>=3.7.4,!=3.9.0)"] jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] uvloop = ["uvloop (>=0.15.2)"] @@ -2432,4 +2443,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p [metadata] lock-version = "2.0" python-versions = "~3.11" -content-hash = "fec6204c617cde40253e359046f0d453e2c8d47a9f05da8b95670afda81a050b" +content-hash = "edbfdd9c60da77567a202c593d9fc01934451f2fc8c54a3546cf7bac171a57a0" diff --git a/pyproject.toml b/pyproject.toml index 7bae624e7..040737625 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -64,7 +64,7 @@ poetry = "^1.3.1" [tool.poetry.group.test.dependencies] pysen = "~0.10.5" -black = "^22.12.0" +black = "^24.2.0" flake8-bugbear = "^24.2.6" flake8 = "^7.0.0" isort = "^5.12.0" diff --git a/requirements-test.txt b/requirements-test.txt index 17ba24fe6..a1ec16f3a 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,7 +1,7 @@ anyio==3.7.1 ; python_version >= "3.11" and python_version < "3.12" asgiref==3.7.2 ; python_version >= "3.11" and python_version < "3.12" attrs==23.1.0 ; python_version >= "3.11" and python_version < "3.12" -black==22.12.0 ; python_version >= "3.11" and python_version < "3.12" +black==24.2.0 ; python_version >= "3.11" and python_version < "3.12" build==0.10.0 ; python_version >= "3.11" and python_version < "3.12" cachecontrol[filecache]==0.13.1 ; python_version >= "3.11" and python_version < "3.12" certifi==2023.7.22 ; python_version >= "3.11" and python_version < "3.12" From 020deaacce8ffc816ae8d6088af6f3241c988ed9 Mon Sep 17 00:00:00 2001 From: tarepan Date: Mon, 26 Feb 2024 04:48:52 +0000 Subject: [PATCH 4/8] bump: `isort` --- poetry.lock | 11 ++++------- pyproject.toml | 2 +- requirements-test.txt | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/poetry.lock b/poetry.lock index 3b58b697e..ca280f1e8 100644 --- a/poetry.lock +++ b/poetry.lock @@ -911,20 +911,17 @@ files = [ [[package]] name = "isort" -version = "5.12.0" +version = "5.13.2" description = "A Python utility / library to sort Python imports." optional = false python-versions = ">=3.8.0" files = [ - {file = "isort-5.12.0-py3-none-any.whl", hash = "sha256:f84c2818376e66cf843d497486ea8fed8700b340f308f076c6fb1229dff318b6"}, - {file = "isort-5.12.0.tar.gz", hash = "sha256:8bef7dde241278824a6d83f44a544709b065191b95b6e50894bdc722fcba0504"}, + {file = "isort-5.13.2-py3-none-any.whl", hash = "sha256:8ca5e72a8d85860d5a3fa69b8745237f2939afe12dbf656afbcb47fe72d947a6"}, + {file = "isort-5.13.2.tar.gz", hash = "sha256:48fdfcb9face5d58a4f6dde2e72a1fb8dcaf8ab26f95ab49fab84c2ddefb0109"}, ] [package.extras] -colors = ["colorama (>=0.4.3)"] -pipfile-deprecated-finder = ["pip-shims (>=0.5.2)", "pipreqs", "requirementslib"] -plugins = ["setuptools"] -requirements-deprecated-finder = ["pip-api", "pipreqs"] +colors = ["colorama (>=0.4.6)"] [[package]] name = "jaraco-classes" diff --git a/pyproject.toml b/pyproject.toml index 040737625..08ea3fd5d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -67,7 +67,7 @@ pysen = "~0.10.5" black = "^24.2.0" flake8-bugbear = "^24.2.6" flake8 = "^7.0.0" -isort = "^5.12.0" +isort = "^5.13.0" mypy = "^1.8.0" pytest = "^8.0.0" coveralls = "^3.2.0" diff --git a/requirements-test.txt b/requirements-test.txt index a1ec16f3a..1901179bf 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -33,7 +33,7 @@ idna==3.4 ; python_version >= "3.11" and python_version < "3.12" importlib-metadata==6.8.0 ; python_version >= "3.11" and python_version < "3.12" iniconfig==2.0.0 ; python_version >= "3.11" and python_version < "3.12" installer==0.7.0 ; python_version >= "3.11" and python_version < "3.12" -isort==5.12.0 ; python_version >= "3.11" and python_version < "3.12" +isort==5.13.2 ; python_version >= "3.11" and python_version < "3.12" jaraco-classes==3.3.0 ; python_version >= "3.11" and python_version < "3.12" jeepney==0.8.0 ; python_version >= "3.11" and python_version < "3.12" and sys_platform == "linux" jinja2==3.1.2 ; python_version >= "3.11" and python_version < "3.12" From 132e50c821992cfa9cd3d3b08b29f85d894b5d24 Mon Sep 17 00:00:00 2001 From: tarepan Date: Mon, 26 Feb 2024 04:53:02 +0000 Subject: [PATCH 5/8] bump: `pip-licenses` --- poetry.lock | 8 ++++---- pyproject.toml | 2 +- requirements-license.txt | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/poetry.lock b/poetry.lock index ca280f1e8..729cdbea8 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1357,13 +1357,13 @@ ptyprocess = ">=0.5" [[package]] name = "pip-licenses" -version = "4.3.2" +version = "4.3.4" description = "Dump the software license list of Python packages installed with pip." optional = false python-versions = "~=3.8" files = [ - {file = "pip-licenses-4.3.2.tar.gz", hash = "sha256:27ce33be185a009f3128ea59fe4c1490f4f4da5eb53ed951b87ef3c621b583f9"}, - {file = "pip_licenses-4.3.2-py3-none-any.whl", hash = "sha256:3fede933c47e1f4bc5e91d7cfd1d9b9d4e37a3c03b2875352b12bbad41294cd6"}, + {file = "pip-licenses-4.3.4.tar.gz", hash = "sha256:9c6c9c3252b976d08735bdffb0eb4c5eaa50dfd46f5e075532c0248ffe94fed1"}, + {file = "pip_licenses-4.3.4-py3-none-any.whl", hash = "sha256:85706ec30781076eb611fed3934f27a1f18437d3211f747567cd3c4e943fce1b"}, ] [package.dependencies] @@ -2440,4 +2440,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p [metadata] lock-version = "2.0" python-versions = "~3.11" -content-hash = "edbfdd9c60da77567a202c593d9fc01934451f2fc8c54a3546cf7bac171a57a0" +content-hash = "69e00cbb0d47334a30dcddf8b483e298cc3397fa89df2f627841b7cbf43bc191" diff --git a/pyproject.toml b/pyproject.toml index 08ea3fd5d..6f99b24aa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -77,7 +77,7 @@ syrupy = "^4.6.1" types-pyyaml = "^6.0" [tool.poetry.group.license.dependencies] -pip-licenses = "^4.2.0" +pip-licenses = "^4.3.4" [build-system] requires = ["poetry-core"] diff --git a/requirements-license.txt b/requirements-license.txt index 6da0790fc..6fd77a337 100644 --- a/requirements-license.txt +++ b/requirements-license.txt @@ -10,7 +10,7 @@ idna==3.4 ; python_version >= "3.11" and python_version < "3.12" jinja2==3.1.2 ; python_version >= "3.11" and python_version < "3.12" markupsafe==2.1.3 ; python_version >= "3.11" and python_version < "3.12" numpy==1.26.2 ; python_version >= "3.11" and python_version < "3.12" -pip-licenses==4.3.2 ; python_version >= "3.11" and python_version < "3.12" +pip-licenses==4.3.4 ; python_version >= "3.11" and python_version < "3.12" platformdirs==3.10.0 ; python_version >= "3.11" and python_version < "3.12" prettytable==3.8.0 ; python_version >= "3.11" and python_version < "3.12" pycparser==2.21 ; python_version >= "3.11" and python_version < "3.12" From 5cab512e10d524a8b25e3a931041e8bebad6d0ee Mon Sep 17 00:00:00 2001 From: tarepan Date: Mon, 26 Feb 2024 05:33:36 +0000 Subject: [PATCH 6/8] fix: lint --- build_util/check_release_build.py | 1 + run.py | 100 +++++++++++++----- test/e2e/test_engine_manifest.py | 4 +- test/e2e/test_openapi.py | 8 +- test/e2e/test_preset.py | 4 +- test/e2e/test_setting.py | 4 +- test/e2e/test_speakers.py | 16 ++- test/e2e/test_user_dict_word.py | 1 - test/preset/test_preset.py | 36 +++++-- test/test_library_manager.py | 26 +++-- test/tts_pipeline/test_kana_converter.py | 6 +- voicevox_engine/cancellable_engine.py | 4 +- voicevox_engine/core/core_wrapper.py | 4 +- .../engine_manifest/EngineManifest.py | 8 +- voicevox_engine/library_manager.py | 24 +++-- voicevox_engine/metas/Metas.py | 11 +- voicevox_engine/model.py | 24 +++-- voicevox_engine/tts_pipeline/text_analyzer.py | 8 +- voicevox_engine/tts_pipeline/tts_engine.py | 4 +- voicevox_engine/user_dict/user_dict.py | 8 +- 20 files changed, 222 insertions(+), 79 deletions(-) diff --git a/build_util/check_release_build.py b/build_util/check_release_build.py index a04c53d39..ea3724a59 100644 --- a/build_util/check_release_build.py +++ b/build_util/check_release_build.py @@ -1,6 +1,7 @@ """ ビルド結果をテストする """ + import argparse import json import time diff --git a/run.py b/run.py index 34671965a..ab4a0d09f 100644 --- a/run.py +++ b/run.py @@ -213,7 +213,10 @@ async def block_origin_middleware( # 許可されていないAPIを無効化する def check_disabled_mutable_api(): if disable_mutable_api: - raise HTTPException(status_code=403, detail="エンジンの静的なデータを変更するAPIは無効化されています") + raise HTTPException( + status_code=403, + detail="エンジンの静的なデータを変更するAPIは無効化されています", + ) engine_manifest_data = EngineManifestLoader( engine_root() / "engine_manifest.json", engine_root() @@ -319,7 +322,9 @@ def audio_query_from_preset( selected_preset = preset break else: - raise HTTPException(status_code=422, detail="該当するプリセットIDが見つかりません") + raise HTTPException( + status_code=422, detail="該当するプリセットIDが見つかりません" + ) accent_phrases = engine.create_accent_phrases(text, selected_preset.style_id) return AudioQuery( @@ -517,7 +522,8 @@ def multi_synthesis( for i in range(len(queries)): if queries[i].outputSamplingRate != sampling_rate: raise HTTPException( - status_code=422, detail="サンプリングレートが異なるクエリがあります" + status_code=422, + detail="サンプリングレートが異なるクエリがあります", ) with TemporaryFile() as wav_file: @@ -566,7 +572,8 @@ def morphable_targets( ] except StyleIdNotFoundError as e: raise HTTPException( - status_code=404, detail=f"該当するスタイル(style_id={e.style_id})が見つかりません" + status_code=404, + detail=f"該当するスタイル(style_id={e.style_id})が見つかりません", ) @app.post( @@ -609,7 +616,8 @@ def _synthesis_morphing( ) except StyleIdNotFoundError as e: raise HTTPException( - status_code=404, detail=f"該当するスタイル(style_id={e.style_id})が見つかりません" + status_code=404, + detail=f"該当するスタイル(style_id={e.style_id})が見つかりません", ) # 生成したパラメータはキャッシュされる @@ -950,7 +958,9 @@ def _speaker_info( import traceback traceback.print_exc() - raise HTTPException(status_code=500, detail="追加情報が見つかりませんでした") + raise HTTPException( + status_code=500, detail="追加情報が見つかりませんでした" + ) ret_data = SpeakerInfo( policy=policy, @@ -997,7 +1007,9 @@ def downloadable_libraries() -> list[DownloadableLibraryInfo]: ret_data: list[DownloadableLibrary] """ if not engine_manifest_data.supported_features.manage_library: - raise HTTPException(status_code=404, detail="この機能は実装されていません") + raise HTTPException( + status_code=404, detail="この機能は実装されていません" + ) return library_manager.downloadable_libraries() @app.get( @@ -1014,7 +1026,9 @@ def installed_libraries() -> dict[str, InstalledLibraryInfo]: ret_data: dict[str, InstalledLibrary] """ if not engine_manifest_data.supported_features.manage_library: - raise HTTPException(status_code=404, detail="この機能は実装されていません") + raise HTTPException( + status_code=404, detail="この機能は実装されていません" + ) return library_manager.installed_libraries() @app.post( @@ -1037,7 +1051,9 @@ async def install_library( 音声ライブラリのID """ if not engine_manifest_data.supported_features.manage_library: - raise HTTPException(status_code=404, detail="この機能は実装されていません") + raise HTTPException( + status_code=404, detail="この機能は実装されていません" + ) archive = BytesIO(await request.body()) loop = asyncio.get_event_loop() await loop.run_in_executor( @@ -1061,7 +1077,9 @@ def uninstall_library(library_uuid: str) -> Response: 音声ライブラリのID """ if not engine_manifest_data.supported_features.manage_library: - raise HTTPException(status_code=404, detail="この機能は実装されていません") + raise HTTPException( + status_code=404, detail="この機能は実装されていません" + ) library_manager.uninstall_library(library_uuid) return Response(status_code=204) @@ -1069,7 +1087,8 @@ def uninstall_library(library_uuid: str) -> Response: def initialize_speaker( style_id: StyleId = Query(alias="speaker"), # noqa: B008 skip_reinit: bool = Query( # noqa: B008 - default=False, description="既に初期化済みのスタイルの再初期化をスキップするかどうか" + default=False, + description="既に初期化済みのスタイルの再初期化をスキップするかどうか", ), core_version: str | None = None, ) -> Response: @@ -1092,7 +1111,9 @@ def is_initialized_speaker( core = get_core(core_version) return core.is_initialized_style_id_synthesis(style_id) - @app.get("/user_dict", response_model=dict[str, UserDictWord], tags=["ユーザー辞書"]) + @app.get( + "/user_dict", response_model=dict[str, UserDictWord], tags=["ユーザー辞書"] + ) def get_user_dict_words() -> dict[str, UserDictWord]: """ ユーザー辞書に登録されている単語の一覧を返します。 @@ -1107,7 +1128,9 @@ def get_user_dict_words() -> dict[str, UserDictWord]: return read_dict() except Exception: traceback.print_exc() - raise HTTPException(status_code=422, detail="辞書の読み込みに失敗しました。") + raise HTTPException( + status_code=422, detail="辞書の読み込みに失敗しました。" + ) @app.post( "/user_dict_word", @@ -1150,10 +1173,14 @@ def add_user_dict_word( ) return Response(content=word_uuid) except ValidationError as e: - raise HTTPException(status_code=422, detail="パラメータに誤りがあります。\n" + str(e)) + raise HTTPException( + status_code=422, detail="パラメータに誤りがあります。\n" + str(e) + ) except Exception: traceback.print_exc() - raise HTTPException(status_code=422, detail="ユーザー辞書への追加に失敗しました。") + raise HTTPException( + status_code=422, detail="ユーザー辞書への追加に失敗しました。" + ) @app.put( "/user_dict_word/{word_uuid}", @@ -1202,10 +1229,14 @@ def rewrite_user_dict_word( except HTTPException: raise except ValidationError as e: - raise HTTPException(status_code=422, detail="パラメータに誤りがあります。\n" + str(e)) + raise HTTPException( + status_code=422, detail="パラメータに誤りがあります。\n" + str(e) + ) except Exception: traceback.print_exc() - raise HTTPException(status_code=422, detail="ユーザー辞書の更新に失敗しました。") + raise HTTPException( + status_code=422, detail="ユーザー辞書の更新に失敗しました。" + ) @app.delete( "/user_dict_word/{word_uuid}", @@ -1229,7 +1260,9 @@ def delete_user_dict_word(word_uuid: str) -> Response: raise except Exception: traceback.print_exc() - raise HTTPException(status_code=422, detail="ユーザー辞書の更新に失敗しました。") + raise HTTPException( + status_code=422, detail="ユーザー辞書の更新に失敗しました。" + ) @app.post( "/import_user_dict", @@ -1256,7 +1289,9 @@ def import_user_dict_words( return Response(status_code=204) except Exception: traceback.print_exc() - raise HTTPException(status_code=422, detail="ユーザー辞書のインポートに失敗しました。") + raise HTTPException( + status_code=422, detail="ユーザー辞書のインポートに失敗しました。" + ) @app.get("/supported_devices", response_model=SupportedDevicesInfo, tags=["その他"]) def supported_devices( @@ -1395,12 +1430,22 @@ def main() -> None: parser = argparse.ArgumentParser(description="VOICEVOX のエンジンです。") parser.add_argument( - "--host", type=str, default="127.0.0.1", help="接続を受け付けるホストアドレスです。" + "--host", + type=str, + default="127.0.0.1", + help="接続を受け付けるホストアドレスです。", + ) + parser.add_argument( + "--port", type=int, default=50021, help="接続を受け付けるポート番号です。" ) - parser.add_argument("--port", type=int, default=50021, help="接続を受け付けるポート番号です。") - parser.add_argument("--use_gpu", action="store_true", help="GPUを使って音声合成するようになります。") parser.add_argument( - "--voicevox_dir", type=Path, default=None, help="VOICEVOXのディレクトリパスです。" + "--use_gpu", action="store_true", help="GPUを使って音声合成するようになります。" + ) + parser.add_argument( + "--voicevox_dir", + type=Path, + default=None, + help="VOICEVOXのディレクトリパスです。", ) parser.add_argument( "--voicelib_dir", @@ -1433,7 +1478,9 @@ def main() -> None: help="cancellable_synthesis機能の初期化時に生成するプロセス数です。", ) parser.add_argument( - "--load_all_models", action="store_true", help="起動時に全ての音声合成モデルを読み込みます。" + "--load_all_models", + action="store_true", + help="起動時に全ての音声合成モデルを読み込みます。", ) # 引数へcpu_num_threadsの指定がなければ、環境変数をロールします。 @@ -1481,7 +1528,10 @@ def main() -> None: ) parser.add_argument( - "--setting_file", type=Path, default=USER_SETTING_PATH, help="設定ファイルを指定できます。" + "--setting_file", + type=Path, + default=USER_SETTING_PATH, + help="設定ファイルを指定できます。", ) parser.add_argument( diff --git a/test/e2e/test_engine_manifest.py b/test/e2e/test_engine_manifest.py index 664fa93dc..1c6147aab 100644 --- a/test/e2e/test_engine_manifest.py +++ b/test/e2e/test_engine_manifest.py @@ -8,7 +8,9 @@ from syrupy.assertion import SnapshotAssertion -def test_エンジンマニフェストを取得できる(client: TestClient, snapshot_json: SnapshotAssertion) -> None: +def test_エンジンマニフェストを取得できる( + client: TestClient, snapshot_json: SnapshotAssertion +) -> None: response = client.get("/engine_manifest") assert response.status_code == 200 assert snapshot_json == hash_long_string(response.json()) diff --git a/test/e2e/test_openapi.py b/test/e2e/test_openapi.py index d26a2b7c5..1cdb3b9b9 100644 --- a/test/e2e/test_openapi.py +++ b/test/e2e/test_openapi.py @@ -4,7 +4,11 @@ from syrupy.assertion import SnapshotAssertion -def test_OpenAPIの形が変わっていないことを確認(app: FastAPI, snapshot_json: SnapshotAssertion) -> None: +def test_OpenAPIの形が変わっていないことを確認( + app: FastAPI, snapshot_json: SnapshotAssertion +) -> None: # 変更があった場合はREADMEの「スナップショットの更新」の手順で更新可能 - openapi: Any = app.openapi() # snapshot_jsonがmypyに対応していないのでワークアラウンド + openapi: Any = ( + app.openapi() + ) # snapshot_jsonがmypyに対応していないのでワークアラウンド assert snapshot_json == openapi diff --git a/test/e2e/test_preset.py b/test/e2e/test_preset.py index d1020d07b..5dc816ec6 100644 --- a/test/e2e/test_preset.py +++ b/test/e2e/test_preset.py @@ -6,7 +6,9 @@ from syrupy.assertion import SnapshotAssertion -def test_プリセット一覧を取得できる(client: TestClient, snapshot_json: SnapshotAssertion) -> None: +def test_プリセット一覧を取得できる( + client: TestClient, snapshot_json: SnapshotAssertion +) -> None: response = client.get("/presets") assert response.status_code == 200 assert snapshot_json == response.json() diff --git a/test/e2e/test_setting.py b/test/e2e/test_setting.py index 4400df904..b1d2507fc 100644 --- a/test/e2e/test_setting.py +++ b/test/e2e/test_setting.py @@ -6,7 +6,9 @@ from syrupy.assertion import SnapshotAssertion -def test_setting画面が取得できる(client: TestClient, snapshot: SnapshotAssertion) -> None: +def test_setting画面が取得できる( + client: TestClient, snapshot: SnapshotAssertion +) -> None: response = client.get("/setting") assert response.status_code == 200 assert snapshot == response.content.decode("utf-8") diff --git a/test/e2e/test_speakers.py b/test/e2e/test_speakers.py index 598d41bbf..5e9bccb49 100644 --- a/test/e2e/test_speakers.py +++ b/test/e2e/test_speakers.py @@ -12,13 +12,17 @@ from voicevox_engine.metas.Metas import Speaker -def test_話者一覧が取得できる(client: TestClient, snapshot_json: SnapshotAssertion) -> None: +def test_話者一覧が取得できる( + client: TestClient, snapshot_json: SnapshotAssertion +) -> None: response = client.get("/speakers") assert response.status_code == 200 assert snapshot_json == response.json() -def test_話者の情報を取得できる(client: TestClient, snapshot_json: SnapshotAssertion) -> None: +def test_話者の情報を取得できる( + client: TestClient, snapshot_json: SnapshotAssertion +) -> None: speakers = parse_obj_as(list[Speaker], client.get("/speakers").json()) for speaker in speakers: response = client.get( @@ -29,13 +33,17 @@ def test_話者の情報を取得できる(client: TestClient, snapshot_json: Sn ) == hash_long_string(response.json()) -def test_歌手一覧が取得できる(client: TestClient, snapshot_json: SnapshotAssertion) -> None: +def test_歌手一覧が取得できる( + client: TestClient, snapshot_json: SnapshotAssertion +) -> None: response = client.get("/singers") assert response.status_code == 200 assert snapshot_json == response.json() -def test_歌手の情報を取得できる(client: TestClient, snapshot_json: SnapshotAssertion) -> None: +def test_歌手の情報を取得できる( + client: TestClient, snapshot_json: SnapshotAssertion +) -> None: singers = parse_obj_as(list[Speaker], client.get("/singers").json()) for singer in singers: response = client.get( diff --git a/test/e2e/test_user_dict_word.py b/test/e2e/test_user_dict_word.py index 87c4cd1f1..192bfb579 100644 --- a/test/e2e/test_user_dict_word.py +++ b/test/e2e/test_user_dict_word.py @@ -2,7 +2,6 @@ ユーザー辞書の言葉のAPIのテスト """ - from fastapi.testclient import TestClient diff --git a/test/preset/test_preset.py b/test/preset/test_preset.py index ffa0d698c..1cd871a93 100644 --- a/test/preset/test_preset.py +++ b/test/preset/test_preset.py @@ -36,7 +36,9 @@ def test_validation_same(self): def test_validation_2(self): preset_manager = PresetManager(preset_path=presets_test_2_yaml_path) - with self.assertRaises(PresetError, msg="プリセットの設定ファイルにミスがあります"): + with self.assertRaises( + PresetError, msg="プリセットの設定ファイルにミスがあります" + ): preset_manager.load_presets() def test_preset_id(self): @@ -46,12 +48,16 @@ def test_preset_id(self): def test_empty_file(self): preset_manager = PresetManager(preset_path=presets_test_4_yaml_path) - with self.assertRaises(PresetError, msg="プリセットの設定ファイルが空の内容です"): + with self.assertRaises( + PresetError, msg="プリセットの設定ファイルが空の内容です" + ): preset_manager.load_presets() def test_not_exist_file(self): preset_manager = PresetManager(preset_path=Path("test/presets-dummy.yaml")) - with self.assertRaises(PresetError, msg="プリセットの設定ファイルが見つかりません"): + with self.assertRaises( + PresetError, msg="プリセットの設定ファイルが見つかりません" + ): preset_manager.load_presets() def test_add_preset(self): @@ -82,7 +88,9 @@ def test_add_preset(self): def test_add_preset_load_failure(self): preset_manager = PresetManager(preset_path=presets_test_2_yaml_path) - with self.assertRaises(PresetError, msg="プリセットの設定ファイルにミスがあります"): + with self.assertRaises( + PresetError, msg="プリセットの設定ファイルにミスがあります" + ): preset_manager.add_preset( Preset( **{ @@ -173,7 +181,9 @@ def test_add_preset_write_failure(self): preset_manager.load_presets() preset_manager.load_presets = lambda: [] # type:ignore[method-assign] preset_manager.preset_path = "" # type: ignore[assignment] - with self.assertRaises(PresetError, msg="プリセットの設定ファイルに書き込み失敗しました"): + with self.assertRaises( + PresetError, msg="プリセットの設定ファイルに書き込み失敗しました" + ): preset_manager.add_preset(preset) self.assertEqual(len(preset_manager.presets), 2) remove(temp_path) @@ -206,7 +216,9 @@ def test_update_preset(self): def test_update_preset_load_failure(self): preset_manager = PresetManager(preset_path=presets_test_2_yaml_path) - with self.assertRaises(PresetError, msg="プリセットの設定ファイルにミスがあります"): + with self.assertRaises( + PresetError, msg="プリセットの設定ファイルにミスがあります" + ): preset_manager.update_preset( Preset( **{ @@ -268,7 +280,9 @@ def test_update_preset_write_failure(self): preset_manager.load_presets() preset_manager.load_presets = lambda: [] # type:ignore[method-assign] preset_manager.preset_path = "" # type: ignore[assignment] - with self.assertRaises(PresetError, msg="プリセットの設定ファイルに書き込み失敗しました"): + with self.assertRaises( + PresetError, msg="プリセットの設定ファイルに書き込み失敗しました" + ): preset_manager.update_preset(preset) self.assertEqual(len(preset_manager.presets), 2) self.assertEqual(preset_manager.presets[0].name, "test") @@ -285,7 +299,9 @@ def test_delete_preset(self): def test_delete_preset_load_failure(self): preset_manager = PresetManager(preset_path=presets_test_2_yaml_path) - with self.assertRaises(PresetError, msg="プリセットの設定ファイルにミスがあります"): + with self.assertRaises( + PresetError, msg="プリセットの設定ファイルにミスがあります" + ): preset_manager.delete_preset(10) def test_delete_preset_not_found(self): @@ -304,7 +320,9 @@ def test_delete_preset_write_failure(self): preset_manager.load_presets() preset_manager.load_presets = lambda: [] # type:ignore[method-assign] preset_manager.preset_path = "" # type: ignore[assignment] - with self.assertRaises(PresetError, msg="プリセットの設定ファイルに書き込み失敗しました"): + with self.assertRaises( + PresetError, msg="プリセットの設定ファイルに書き込み失敗しました" + ): preset_manager.delete_preset(1) self.assertEqual(len(preset_manager.presets), 2) remove(temp_path) diff --git a/test/test_library_manager.py b/test/test_library_manager.py index 51fe8bc50..521311694 100644 --- a/test/test_library_manager.py +++ b/test/test_library_manager.py @@ -45,9 +45,10 @@ def tearDown(self): self.library_filename.unlink() def create_vvlib_without_manifest(self, filename: str) -> None: - with ZipFile(filename, "w") as zf_out, ZipFile( - self.library_filename, "r" - ) as zf_in: + with ( + ZipFile(filename, "w") as zf_out, + ZipFile(self.library_filename, "r") as zf_in, + ): for file in zf_in.infolist(): buffer = zf_in.read(file.filename) if file.filename != vvlib_manifest_name: @@ -77,12 +78,18 @@ def test_install_library(self): invalid_uuid = "52398bd5-3cc3-406c-a159-dfec5ace4bab" with self.assertRaises(HTTPException) as e: self.library_manger.install_library(invalid_uuid, self.library_file) - self.assertEqual(e.exception.detail, f"指定された音声ライブラリ {invalid_uuid} が見つかりません。") + self.assertEqual( + e.exception.detail, + f"指定された音声ライブラリ {invalid_uuid} が見つかりません。", + ) # 不正なZIPファイルのテスト with self.assertRaises(HTTPException) as e: self.library_manger.install_library(self.library_uuid, BytesIO()) - self.assertEqual(e.exception.detail, f"音声ライブラリ {self.library_uuid} は不正なファイルです。") + self.assertEqual( + e.exception.detail, + f"音声ライブラリ {self.library_uuid} は不正なファイルです。", + ) # vvlib_manifestの存在確認のテスト invalid_vvlib_name = "test/invalid.vvlib" @@ -129,7 +136,8 @@ def test_install_library(self): with open(invalid_vvlib_name, "br") as f, self.assertRaises(HTTPException) as e: self.library_manger.install_library(self.library_uuid, f) self.assertEqual( - e.exception.detail, f"指定された音声ライブラリ {self.library_uuid} のversionが不正です。" + e.exception.detail, + f"指定された音声ライブラリ {self.library_uuid} のversionが不正です。", ) # vvlib_manifestの不正なmanifest_versionのテスト @@ -156,7 +164,8 @@ def test_install_library(self): with open(invalid_vvlib_name, "br") as f, self.assertRaises(HTTPException) as e: self.library_manger.install_library(self.library_uuid, f) self.assertEqual( - e.exception.detail, f"指定された音声ライブラリ {self.library_uuid} は未対応です。" + e.exception.detail, + f"指定された音声ライブラリ {self.library_uuid} は未対応です。", ) # vvlib_manifestのインストール先エンジンの検証のテスト @@ -189,7 +198,8 @@ def test_uninstall_library(self): with self.assertRaises(HTTPException) as e: self.library_manger.uninstall_library(self.library_uuid) self.assertEqual( - e.exception.detail, f"指定された音声ライブラリ {self.library_uuid} はインストールされていません。" + e.exception.detail, + f"指定された音声ライブラリ {self.library_uuid} はインストールされていません。", ) self.library_manger.install_library(self.library_uuid, self.library_file) diff --git a/test/tts_pipeline/test_kana_converter.py b/test/tts_pipeline/test_kana_converter.py index 94309d7c7..f5e20ff39 100644 --- a/test/tts_pipeline/test_kana_converter.py +++ b/test/tts_pipeline/test_kana_converter.py @@ -49,7 +49,11 @@ def test_unvoice(self): self.assertEqual(parse_kana("_ス'")[0].moras[0].vowel, "U") def test_roundtrip(self): - for text in ["コンニチワ'", "ワタシワ'/シャチョオデ'_ス", "トテモ'、エラ'インデス"]: + for text in [ + "コンニチワ'", + "ワタシワ'/シャチョオデ'_ス", + "トテモ'、エラ'インデス", + ]: self.assertEqual(create_kana(parse_kana(text)), text) for text in ["ヲ'", "ェ'"]: diff --git a/voicevox_engine/cancellable_engine.py b/voicevox_engine/cancellable_engine.py index 84be0140e..fe640743a 100644 --- a/voicevox_engine/cancellable_engine.py +++ b/voicevox_engine/cancellable_engine.py @@ -171,7 +171,9 @@ def _synthesis_impl( sub_proc_con1.send((query, style_id, core_version)) f_name = sub_proc_con1.recv() except EOFError: - raise HTTPException(status_code=422, detail="既にサブプロセスは終了されています") + raise HTTPException( + status_code=422, detail="既にサブプロセスは終了されています" + ) except Exception: self.finalize_con(request, proc, sub_proc_con1) raise diff --git a/voicevox_engine/core/core_wrapper.py b/voicevox_engine/core/core_wrapper.py index 5426c9750..a0b83e634 100644 --- a/voicevox_engine/core/core_wrapper.py +++ b/voicevox_engine/core/core_wrapper.py @@ -379,7 +379,9 @@ def load_core(core_dir: Path, use_gpu: bool) -> CDLL: err = err_ raise RuntimeError(f"コアの読み込みに失敗しました:{err}") else: - raise RuntimeError(f"このコンピュータのアーキテクチャ {platform.machine()} で利用可能なコアがありません") + raise RuntimeError( + f"このコンピュータのアーキテクチャ {platform.machine()} で利用可能なコアがありません" + ) def _type_initialize(core_cdll: CDLL) -> None: diff --git a/voicevox_engine/engine_manifest/EngineManifest.py b/voicevox_engine/engine_manifest/EngineManifest.py index 02fd87981..63094eb8b 100644 --- a/voicevox_engine/engine_manifest/EngineManifest.py +++ b/voicevox_engine/engine_manifest/EngineManifest.py @@ -41,9 +41,13 @@ class SupportedFeatures(BaseModel): adjust_intonation_scale: bool = Field(title="全体の抑揚の調整") adjust_volume_scale: bool = Field(title="全体の音量の調整") interrogative_upspeak: bool = Field(title="疑問文の自動調整") - synthesis_morphing: bool = Field(title="2種類のスタイルでモーフィングした音声を合成") + synthesis_morphing: bool = Field( + title="2種類のスタイルでモーフィングした音声を合成" + ) sing: Optional[bool] = Field(title="歌唱音声合成") - manage_library: Optional[bool] = Field(title="音声ライブラリのインストール・アンインストール") + manage_library: Optional[bool] = Field( + title="音声ライブラリのインストール・アンインストール" + ) class EngineManifest(BaseModel): diff --git a/voicevox_engine/library_manager.py b/voicevox_engine/library_manager.py index 3ae43d887..709ae1448 100644 --- a/voicevox_engine/library_manager.py +++ b/voicevox_engine/library_manager.py @@ -128,7 +128,8 @@ def install_library(self, library_id: str, file: BinaryIO) -> Path: break else: raise HTTPException( - status_code=404, detail=f"指定された音声ライブラリ {library_id} が見つかりません。" + status_code=404, + detail=f"指定された音声ライブラリ {library_id} が見つかりません。", ) # ライブラリディレクトリの生成 @@ -142,13 +143,15 @@ def install_library(self, library_id: str, file: BinaryIO) -> Path: # zipファイル形式のバリデーション if not zipfile.is_zipfile(file): raise HTTPException( - status_code=422, detail=f"音声ライブラリ {library_id} は不正なファイルです。" + status_code=422, + detail=f"音声ライブラリ {library_id} は不正なファイルです。", ) with zipfile.ZipFile(file) as zf: if zf.testzip() is not None: raise HTTPException( - status_code=422, detail=f"音声ライブラリ {library_id} は不正なファイルです。" + status_code=422, + detail=f"音声ライブラリ {library_id} は不正なファイルです。", ) # マニフェストファイルの存在とファイル形式をバリデーション @@ -180,7 +183,8 @@ def install_library(self, library_id: str, file: BinaryIO) -> Path: # ライブラリバージョンのバリデーション if not Version.is_valid(vvlib_manifest["version"]): raise HTTPException( - status_code=422, detail=f"指定された音声ライブラリ {library_id} のversionが不正です。" + status_code=422, + detail=f"指定された音声ライブラリ {library_id} のversionが不正です。", ) # マニフェストバージョンのバリデーション @@ -195,7 +199,8 @@ def install_library(self, library_id: str, file: BinaryIO) -> Path: ) if vvlib_manifest_version > self.supported_vvlib_version: raise HTTPException( - status_code=422, detail=f"指定された音声ライブラリ {library_id} は未対応です。" + status_code=422, + detail=f"指定された音声ライブラリ {library_id} は未対応です。", ) # ライブラリ-エンジン対応のバリデーション @@ -222,13 +227,15 @@ def uninstall_library(self, library_id: str) -> None: installed_libraries = self.installed_libraries() if library_id not in installed_libraries.keys(): raise HTTPException( - status_code=404, detail=f"指定された音声ライブラリ {library_id} はインストールされていません。" + status_code=404, + detail=f"指定された音声ライブラリ {library_id} はインストールされていません。", ) # アンインストール許可フラグのバリデーション if not installed_libraries[library_id].uninstallable: raise HTTPException( - status_code=403, detail=f"指定された音声ライブラリ {library_id} はアンインストールできません。" + status_code=403, + detail=f"指定された音声ライブラリ {library_id} はアンインストールできません。", ) # ディレクトリ削除によるアンインストール @@ -236,5 +243,6 @@ def uninstall_library(self, library_id: str) -> None: shutil.rmtree(self.library_root_dir / library_id) except Exception: raise HTTPException( - status_code=500, detail=f"指定された音声ライブラリ {library_id} の削除に失敗しました。" + status_code=500, + detail=f"指定された音声ライブラリ {library_id} の削除に失敗しました。", ) diff --git a/voicevox_engine/metas/Metas.py b/voicevox_engine/metas/Metas.py index eda288eb8..5e63fc464 100644 --- a/voicevox_engine/metas/Metas.py +++ b/voicevox_engine/metas/Metas.py @@ -44,7 +44,8 @@ class SpeakerSupportedFeatures(BaseModel): """ permitted_synthesis_morphing: SpeakerSupportPermittedSynthesisMorphing = Field( - title="モーフィング機能への対応", default=SpeakerSupportPermittedSynthesisMorphing(None) + title="モーフィング機能への対応", + default=SpeakerSupportPermittedSynthesisMorphing(None), ) @@ -84,8 +85,12 @@ class StyleInfo(BaseModel): id: StyleId = Field(title="スタイルID") icon: str = Field(title="当該スタイルのアイコンをbase64エンコードしたもの") - portrait: Optional[str] = Field(title="当該スタイルのportrait.pngをbase64エンコードしたもの") - voice_samples: List[str] = Field(title="voice_sampleのwavファイルをbase64エンコードしたもの") + portrait: Optional[str] = Field( + title="当該スタイルのportrait.pngをbase64エンコードしたもの" + ) + voice_samples: List[str] = Field( + title="voice_sampleのwavファイルをbase64エンコードしたもの" + ) class SpeakerInfo(BaseModel): diff --git a/voicevox_engine/model.py b/voicevox_engine/model.py index f9e50b62c..b0013b1b0 100644 --- a/voicevox_engine/model.py +++ b/voicevox_engine/model.py @@ -17,7 +17,9 @@ class Mora(BaseModel): consonant_length: Optional[float] = Field(title="子音の音長") vowel: str = Field(title="母音の音素") vowel_length: float = Field(title="母音の音長") - pitch: float = Field(title="音高") # デフォルト値をつけるとts側のOpenAPIで生成されたコードの型がOptionalになる + pitch: float = Field( + title="音高" + ) # デフォルト値をつけるとts側のOpenAPIで生成されたコードの型がOptionalになる def __hash__(self): items = [ @@ -62,7 +64,9 @@ class AudioQuery(BaseModel): postPhonemeLength: float = Field(title="音声の後の無音時間") outputSamplingRate: int = Field(title="音声データの出力サンプリングレート") outputStereo: bool = Field(title="音声データをステレオ出力するか否か") - kana: Optional[str] = Field(title="[読み取り専用]AquesTalk 風記法によるテキスト。音声合成用のクエリとしては無視される") + kana: Optional[str] = Field( + title="[読み取り専用]AquesTalk 風記法によるテキスト。音声合成用のクエリとしては無視される" + ) def __hash__(self): items = [ @@ -258,7 +262,9 @@ def check_is_katakana(cls, pronunciation): raise ValueError("無効な発音です。(捨て仮名の連続)") if pronunciation[i] == "ヮ": if i != 0 and pronunciation[i - 1] not in ["ク", "グ"]: - raise ValueError("無効な発音です。(「くゎ」「ぐゎ」以外の「ゎ」の使用)") + raise ValueError( + "無効な発音です。(「くゎ」「ぐゎ」以外の「ゎ」の使用)" + ) return pronunciation @validator("mora_count", pre=True, always=True) @@ -268,7 +274,9 @@ def check_mora_count_and_accent_type(cls, mora_count, values): return mora_count if mora_count is None: - rule_others = "[イ][ェ]|[ヴ][ャュョ]|[トド][ゥ]|[テデ][ィャュョ]|[デ][ェ]|[クグ][ヮ]" + rule_others = ( + "[イ][ェ]|[ヴ][ャュョ]|[トド][ゥ]|[テデ][ィャュョ]|[デ][ェ]|[クグ][ヮ]" + ) rule_line_i = "[キシチニヒミリギジビピ][ェャュョ]" rule_line_u = "[ツフヴ][ァ]|[ウスツフヴズ][ィ]|[ウツフヴ][ェォ]" rule_one_mora = "[ァ-ヴー]" @@ -336,8 +344,12 @@ class SupportedFeaturesInfo(BaseModel): support_adjusting_pitch_scale: bool = Field(title="音高が調整可能かどうか") support_adjusting_intonation_scale: bool = Field(title="抑揚が調整可能かどうか") support_adjusting_volume_scale: bool = Field(title="音量が調整可能かどうか") - support_adjusting_silence_scale: bool = Field(title="前後の無音時間が調節可能かどうか") - support_interrogative_upspeak: bool = Field(title="疑似疑問文に対応しているかどうか") + support_adjusting_silence_scale: bool = Field( + title="前後の無音時間が調節可能かどうか" + ) + support_interrogative_upspeak: bool = Field( + title="疑似疑問文に対応しているかどうか" + ) support_switching_device: bool = Field(title="CPU/GPUの切り替えが可能かどうか") diff --git a/voicevox_engine/tts_pipeline/text_analyzer.py b/voicevox_engine/tts_pipeline/text_analyzer.py index cbb9736e8..70ea83b12 100644 --- a/voicevox_engine/tts_pipeline/text_analyzer.py +++ b/voicevox_engine/tts_pipeline/text_analyzer.py @@ -210,7 +210,9 @@ def from_labels(cls, labels: list[Label]) -> Self: # NOTE:「アクセント句ごとのラベル系列」はラベル系列をcontextで区切り生成される。 accent_phrases: list[AccentPhraseLabel] = [] # アクセント句系列 - accent_labels: list[Label] = [] # アクセント句ごとのラベル系列を一時保存するコンテナ + accent_labels: list[Label] = ( + [] + ) # アクセント句ごとのラベル系列を一時保存するコンテナ for label, next_label in zip(labels, labels[1:] + [None]): # 区切りまでラベル系列を一時保存する @@ -258,7 +260,9 @@ def from_labels(cls, labels: list[Label]) -> Self: pauses: list[Label] = [] # ポーズラベルのリスト breath_groups: list[BreathGroupLabel] = [] # BreathGroupLabel のリスト - group_labels: list[Label] = [] # BreathGroupLabelごとのラベル系列を一時保存するコンテナ + group_labels: list[Label] = ( + [] + ) # BreathGroupLabelごとのラベル系列を一時保存するコンテナ for label in labels: # ポーズが出現するまでラベル系列を一時保存する diff --git a/voicevox_engine/tts_pipeline/tts_engine.py b/voicevox_engine/tts_pipeline/tts_engine.py index f80fcca13..47b88bf90 100644 --- a/voicevox_engine/tts_pipeline/tts_engine.py +++ b/voicevox_engine/tts_pipeline/tts_engine.py @@ -135,7 +135,9 @@ def count_frame_per_unit( consonant_frames = ( _to_frame(mora.consonant_length) if mora.consonant_length is not None else 0 ) - mora_frames = vowel_frames + consonant_frames # 音素ごとにフレーム長を算出し、和をモーラのフレーム長とする + mora_frames = ( + vowel_frames + consonant_frames + ) # 音素ごとにフレーム長を算出し、和をモーラのフレーム長とする if mora.consonant: frame_per_phoneme += [consonant_frames] diff --git a/voicevox_engine/user_dict/user_dict.py b/voicevox_engine/user_dict/user_dict.py index 35260341f..cf31de6ef 100644 --- a/voicevox_engine/user_dict/user_dict.py +++ b/voicevox_engine/user_dict/user_dict.py @@ -330,7 +330,9 @@ def rewrite_word( # 既存単語の上書きによる辞書データの更新 user_dict = read_dict(user_dict_path=user_dict_path) if word_uuid not in user_dict: - raise HTTPException(status_code=422, detail="UUIDに該当するワードが見つかりませんでした") + raise HTTPException( + status_code=422, detail="UUIDに該当するワードが見つかりませんでした" + ) user_dict[word_uuid] = word # 更新された辞書データの保存と適用 @@ -357,7 +359,9 @@ def delete_word( # 既存単語の削除による辞書データの更新 user_dict = read_dict(user_dict_path=user_dict_path) if word_uuid not in user_dict: - raise HTTPException(status_code=422, detail="IDに該当するワードが見つかりませんでした") + raise HTTPException( + status_code=422, detail="IDに該当するワードが見つかりませんでした" + ) del user_dict[word_uuid] # 更新された辞書データの保存と適用 From 678df1824d351d50b662c5f0a82838b7232335e8 Mon Sep 17 00:00:00 2001 From: tarepan Date: Mon, 26 Feb 2024 05:36:40 +0000 Subject: [PATCH 7/8] fix: lint --- voicevox_engine/tts_pipeline/mora_mapping.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/voicevox_engine/tts_pipeline/mora_mapping.py b/voicevox_engine/tts_pipeline/mora_mapping.py index 6a36775f2..d0f17c08f 100644 --- a/voicevox_engine/tts_pipeline/mora_mapping.py +++ b/voicevox_engine/tts_pipeline/mora_mapping.py @@ -387,6 +387,6 @@ } # 「ヒ」→「hi」 mora_kana_to_mora_phonemes: dict[_MoraKana, tuple[Consonant | None, BaseVowel]] = { - kana: (consonant, vowel) + kana: (consonant, vowel) # noqa B035 for [kana, consonant, vowel] in _mora_list_minimum + _mora_list_additional } From c5bf6dce59c3f40130b91cf915e7fe4845d59b60 Mon Sep 17 00:00:00 2001 From: tarepan Date: Mon, 26 Feb 2024 19:28:47 +0900 Subject: [PATCH 8/8] Update voicevox_engine/tts_pipeline/mora_mapping.py Co-authored-by: Hiroshiba --- voicevox_engine/tts_pipeline/mora_mapping.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/voicevox_engine/tts_pipeline/mora_mapping.py b/voicevox_engine/tts_pipeline/mora_mapping.py index d0f17c08f..bd7df524b 100644 --- a/voicevox_engine/tts_pipeline/mora_mapping.py +++ b/voicevox_engine/tts_pipeline/mora_mapping.py @@ -387,6 +387,6 @@ } # 「ヒ」→「hi」 mora_kana_to_mora_phonemes: dict[_MoraKana, tuple[Consonant | None, BaseVowel]] = { - kana: (consonant, vowel) # noqa B035 + kana: (consonant, vowel) # noqa B035 キー(kana)が一意であれば無視できる for [kana, consonant, vowel] in _mora_list_minimum + _mora_list_additional }