diff --git a/.vscode/settings.json.sample b/.vscode/settings.json.sample index 6de192e6..f4976c2d 100644 --- a/.vscode/settings.json.sample +++ b/.vscode/settings.json.sample @@ -53,8 +53,7 @@ ], "files.associations": { "settings.json.sample": "jsonc", - ".coveragerc": "ini", - "*.spec": "python" + ".coveragerc": "ini" }, "catppuccin-icons.associations.folders": { // or whatever icon extension you use "stubs": "folder_types" @@ -62,7 +61,6 @@ "catppuccin-icons.associations.files": { // or whatever icon extension you use "requirements-dev.txt": "python-config", "settings.json.sample": "json", - ".coveragerc": "ini", - "vocab-tuister-server.spec": "python-config" + ".coveragerc": "ini" } } \ No newline at end of file diff --git a/poe_tasks.toml b/poe_tasks.toml index 94c101cf..28696135 100644 --- a/poe_tasks.toml +++ b/poe_tasks.toml @@ -3,7 +3,7 @@ shell = "./scripts/coverage.sh" help = "Run coverage on the project." [tool.poe.tasks.build] -cmd = "./scripts/build.sh" +cmd = "poetry build" help = "Build the project." [tool.poe.tasks.test] diff --git a/poetry.lock b/poetry.lock index de2c625c..42052107 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.0 and should not be changed by hand. [[package]] name = "aiohappyeyeballs" @@ -133,17 +133,6 @@ files = [ {file = "alabaster-1.0.0.tar.gz", hash = "sha256:c00dca57bca26fa62a6d7d0a9fcce65f3e026e9bfe33e9c538fd3fbb2144fd9e"}, ] -[[package]] -name = "altgraph" -version = "0.17.4" -description = "Python graph (network) package" -optional = false -python-versions = "*" -files = [ - {file = "altgraph-0.17.4-py2.py3-none-any.whl", hash = "sha256:642743b4750de17e655e6711601b077bc6598dbfa3ba5fa2b2a35ce12b508dff"}, - {file = "altgraph-0.17.4.tar.gz", hash = "sha256:1b5afbb98f6c4dcadb2e2ae6ab9fa994bbb8c1d75f4fa96d340f9437ae454406"}, -] - [[package]] name = "ansicolors" version = "1.1.8" @@ -1248,20 +1237,6 @@ docs = ["sphinx (>=1.6.0)", "sphinx-bootstrap-theme"] flake8 = ["flake8"] tests = ["psutil", "pytest (!=3.3.0)", "pytest-cov"] -[[package]] -name = "macholib" -version = "1.16.3" -description = "Mach-O header analysis and editing" -optional = false -python-versions = "*" -files = [ - {file = "macholib-1.16.3-py2.py3-none-any.whl", hash = "sha256:0e315d7583d38b8c77e815b1ecbdbf504a8258d8b3e17b61165c6feb60d18f2c"}, - {file = "macholib-1.16.3.tar.gz", hash = "sha256:07ae9e15e8e4cd9a788013d81f5908b3609aa76f9b1421bae9c4d7606ec86a30"}, -] - -[package.dependencies] -altgraph = ">=0.17" - [[package]] name = "markdown-it-py" version = "3.0.0" @@ -1652,13 +1627,13 @@ files = [ [[package]] name = "optype" -version = "0.7.2" +version = "0.7.1" description = "Building blocks for precise & flexible type hints" optional = false python-versions = ">=3.10" files = [ - {file = "optype-0.7.2-py3-none-any.whl", hash = "sha256:08f20668ac30618506e0d1a56601a581e3ab632e2ede810eaf79242e29ecb1d4"}, - {file = "optype-0.7.2.tar.gz", hash = "sha256:bb24ad58fdbf0d59ae55cfa42d8e1e750f04d3a36d274921455ac90857d178b6"}, + {file = "optype-0.7.1-py3-none-any.whl", hash = "sha256:ba36d5d72322adfdf3dccf3d4cb2dbbac4a85785e12f96637d912ec0ffdddb56"}, + {file = "optype-0.7.1.tar.gz", hash = "sha256:001d255ebe7391782730c8154f96c2b5f4a32bd4024c29408e92f33272b34256"}, ] [package.dependencies] @@ -1799,17 +1774,6 @@ files = [ {file = "pbr-6.1.0.tar.gz", hash = "sha256:788183e382e3d1d7707db08978239965e8b9e4e5ed42669bf4758186734d5f24"}, ] -[[package]] -name = "pefile" -version = "2023.2.7" -description = "Python PE parsing module" -optional = false -python-versions = ">=3.6.0" -files = [ - {file = "pefile-2023.2.7-py3-none-any.whl", hash = "sha256:da185cd2af68c08a6cd4481f7325ed600a88f6a813bad9dea07ab3ef73d8d8d6"}, - {file = "pefile-2023.2.7.tar.gz", hash = "sha256:82e6114004b3d6911c77c3953e3838654b04511b8b66e8583db70c65998017dc"}, -] - [[package]] name = "platformdirs" version = "4.3.6" @@ -1991,55 +1955,6 @@ files = [ [package.extras] windows-terminal = ["colorama (>=0.4.6)"] -[[package]] -name = "pyinstaller" -version = "6.11.1" -description = "PyInstaller bundles a Python application and all its dependencies into a single package." -optional = false -python-versions = "<3.14,>=3.8" -files = [ - {file = "pyinstaller-6.11.1-py3-none-macosx_10_13_universal2.whl", hash = "sha256:44e36172de326af6d4e7663b12f71dbd34e2e3e02233e181e457394423daaf03"}, - {file = "pyinstaller-6.11.1-py3-none-manylinux2014_aarch64.whl", hash = "sha256:6d12c45a29add78039066a53fb05967afaa09a672426072b13816fe7676abfc4"}, - {file = "pyinstaller-6.11.1-py3-none-manylinux2014_i686.whl", hash = "sha256:ddc0fddd75f07f7e423da1f0822e389a42af011f9589e0269b87e0d89aa48c1f"}, - {file = "pyinstaller-6.11.1-py3-none-manylinux2014_ppc64le.whl", hash = "sha256:0d6475559c4939f0735122989611d7f739ed3bf02f666ce31022928f7a7e4fda"}, - {file = "pyinstaller-6.11.1-py3-none-manylinux2014_s390x.whl", hash = "sha256:e21c7806e34f40181e7606926a14579f848bfb1dc52cbca7eea66eccccbfe977"}, - {file = "pyinstaller-6.11.1-py3-none-manylinux2014_x86_64.whl", hash = "sha256:32c742a24fe65d0702958fadf4040f76de85859c26bec0008766e5dbabc5b68f"}, - {file = "pyinstaller-6.11.1-py3-none-musllinux_1_1_aarch64.whl", hash = "sha256:208c0ef6dab0837a0a273ea32d1a3619a208e3d1fe3fec3785eea71a77fd00ce"}, - {file = "pyinstaller-6.11.1-py3-none-musllinux_1_1_x86_64.whl", hash = "sha256:ad84abf465bcda363c1d54eafa76745d77b6a8a713778348377dc98d12a452f7"}, - {file = "pyinstaller-6.11.1-py3-none-win32.whl", hash = "sha256:2e8365276c5131c9bef98e358fbc305e4022db8bedc9df479629d6414021956a"}, - {file = "pyinstaller-6.11.1-py3-none-win_amd64.whl", hash = "sha256:7ac83c0dc0e04357dab98c487e74ad2adb30e7eb186b58157a8faf46f1fa796f"}, - {file = "pyinstaller-6.11.1-py3-none-win_arm64.whl", hash = "sha256:35e6b8077d240600bb309ed68bb0b1453fd2b7ab740b66d000db7abae6244423"}, - {file = "pyinstaller-6.11.1.tar.gz", hash = "sha256:491dfb4d9d5d1d9650d9507daec1ff6829527a254d8e396badd60a0affcb72ef"}, -] - -[package.dependencies] -altgraph = "*" -macholib = {version = ">=1.8", markers = "sys_platform == \"darwin\""} -packaging = ">=22.0" -pefile = {version = ">=2022.5.30,<2024.8.26 || >2024.8.26", markers = "sys_platform == \"win32\""} -pyinstaller-hooks-contrib = ">=2024.9" -pywin32-ctypes = {version = ">=0.2.1", markers = "sys_platform == \"win32\""} -setuptools = ">=42.0.0" - -[package.extras] -completion = ["argcomplete"] -hook-testing = ["execnet (>=1.5.0)", "psutil", "pytest (>=2.7.3)"] - -[[package]] -name = "pyinstaller-hooks-contrib" -version = "2024.10" -description = "Community maintained hooks for PyInstaller" -optional = false -python-versions = ">=3.8" -files = [ - {file = "pyinstaller_hooks_contrib-2024.10-py3-none-any.whl", hash = "sha256:ad47db0e153683b4151e10d231cb91f2d93c85079e78d76d9e0f57ac6c8a5e10"}, - {file = "pyinstaller_hooks_contrib-2024.10.tar.gz", hash = "sha256:8a46655e5c5b0186b5e527399118a9b342f10513eb1425c483fa4f6d02e8800c"}, -] - -[package.dependencies] -packaging = ">=22.0" -setuptools = ">=42.0.0" - [[package]] name = "pytest" version = "8.3.3" @@ -2148,17 +2063,6 @@ psutil = ["psutil (>=3.0)"] setproctitle = ["setproctitle"] testing = ["filelock"] -[[package]] -name = "pywin32-ctypes" -version = "0.2.3" -description = "A (partial) reimplementation of pywin32 using ctypes/cffi" -optional = false -python-versions = ">=3.6" -files = [ - {file = "pywin32-ctypes-0.2.3.tar.gz", hash = "sha256:d162dc04946d704503b2edc4d55f3dba5c1d539ead017afa00142c38b9885755"}, - {file = "pywin32_ctypes-0.2.3-py3-none-any.whl", hash = "sha256:8a1513379d709975552d202d942d9837758905c8d01eb82b8bcc30918929e7b8"}, -] - [[package]] name = "pyyaml" version = "6.0.2" @@ -2465,26 +2369,6 @@ files = [ {file = "ruff-0.8.0.tar.gz", hash = "sha256:a7ccfe6331bf8c8dad715753e157457faf7351c2b69f62f32c165c2dbcbacd44"}, ] -[[package]] -name = "setuptools" -version = "75.6.0" -description = "Easily download, build, install, upgrade, and uninstall Python packages" -optional = false -python-versions = ">=3.9" -files = [ - {file = "setuptools-75.6.0-py3-none-any.whl", hash = "sha256:ce74b49e8f7110f9bf04883b730f4765b774ef3ef28f722cce7c273d253aaf7d"}, - {file = "setuptools-75.6.0.tar.gz", hash = "sha256:8199222558df7c86216af4f84c30e9b34a61d8ba19366cc914424cdbd28252f6"}, -] - -[package.extras] -check = ["pytest-checkdocs (>=2.4)", "pytest-ruff (>=0.2.1)", "ruff (>=0.7.0)"] -core = ["importlib_metadata (>=6)", "jaraco.collections", "jaraco.functools (>=4)", "jaraco.text (>=3.7)", "more_itertools", "more_itertools (>=8.8)", "packaging", "packaging (>=24.2)", "platformdirs (>=4.2.2)", "tomli (>=2.0.1)", "wheel (>=0.43.0)"] -cover = ["pytest-cov"] -doc = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "pyproject-hooks (!=1.1)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (>=1,<2)", "sphinx-reredirects", "sphinxcontrib-towncrier", "towncrier (<24.7)"] -enabler = ["pytest-enabler (>=2.2)"] -test = ["build[virtualenv] (>=1.0.3)", "filelock (>=3.4.0)", "ini2toml[lite] (>=0.14)", "jaraco.develop (>=7.21)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "jaraco.test (>=5.5)", "packaging (>=24.2)", "pip (>=19.1)", "pyproject-hooks (!=1.1)", "pytest (>=6,!=8.1.*)", "pytest-home (>=0.5)", "pytest-perf", "pytest-subprocess", "pytest-timeout", "pytest-xdist (>=3)", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel (>=0.44.0)"] -type = ["importlib_metadata (>=7.0.2)", "jaraco.develop (>=7.21)", "mypy (>=1.12,<1.14)", "pytest-mypy"] - [[package]] name = "six" version = "1.16.0" @@ -3077,4 +2961,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = ">=3.12,<3.14" -content-hash = "9e10ccb70e17beca31ca4210ffa94328e222099a87648298d889749a74e56dd2" +content-hash = "8ede99609b6e829b11adb4b25a0d990d28ecf0361ee5df3526cebd0fb227a928" diff --git a/pyproject.toml b/pyproject.toml index 134da6ea..f304056f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,9 +3,9 @@ build-backend = "poetry_dynamic_versioning.backend" requires = [ "poetry-core>=1.0.0", "poetry-dynamic-versioning>=1.0.0,<2.0.0" ] [tool.poetry] -name = "vocab-tuister" -version = "0.0.0" # placeholder -description = "An application that tests Latin vocabulary and grammar. (TUI experiment)" +name = "vocab-tester" +version = "0.0.0" # placeholder +description = "An application that tests Latin vocabulary and grammar." authors = [ "rduo1009 " ] readme = "README.md" packages = [ { include = "src" } ] @@ -23,7 +23,6 @@ waitress = "3.0.2" cyclopts = "3.0.1" ansicolors = "1.1.8" dunamai = "1.23.0" -pyinstaller = "6.11.1" [tool.poetry.group.dev.dependencies] icecream = "2.1.3" @@ -48,7 +47,7 @@ pydoclint = "0.5.9" [tool.poetry.group.types.dependencies] types-regex = "2024.11.6.20241108" types-waitress = "3.0.1.20241117" -optype = "0.7.2" +optype = "0.7.1" [tool.poetry-dynamic-versioning] enable = true diff --git a/requirements-dev.txt b/requirements-dev.txt index 03eb1487..a20c8c1e 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -2,7 +2,6 @@ aiohappyeyeballs==2.4.3 ; python_version >= "3.12" and python_version < "3.14" aiohttp==3.11.7 ; python_version >= "3.12" and python_version < "3.14" aiosignal==1.3.1 ; python_version >= "3.12" and python_version < "3.14" alabaster==1.0.0 ; python_version >= "3.12" and python_version < "3.14" -altgraph==0.17.4 ; python_version >= "3.12" and python_version < "3.14" ansicolors==1.1.8 ; python_version >= "3.12" and python_version < "3.14" anybadge==1.14.0 ; python_version >= "3.12" and python_version < "3.14" asttokens==2.4.1 ; python_version >= "3.12" and python_version < "3.14" @@ -49,7 +48,6 @@ joblib==1.4.2 ; python_version >= "3.12" and python_version < "3.14" lemminflect==0.2.3 ; python_version >= "3.12" and python_version < "3.14" libcst==1.5.1 ; python_version >= "3.12" and python_version < "3.14" lz4==4.3.3 ; python_version >= "3.12" and python_version < "3.14" -macholib==1.16.3 ; python_version >= "3.12" and python_version < "3.14" and sys_platform == "darwin" markdown-it-py==3.0.0 ; python_version >= "3.12" and python_version < "3.14" markupsafe==3.0.2 ; python_version >= "3.12" and python_version < "3.14" mdurl==0.1.2 ; python_version >= "3.12" and python_version < "3.14" @@ -65,22 +63,18 @@ packaging==24.2 ; python_version >= "3.12" and python_version < "3.14" parso==0.8.4 ; python_version >= "3.12" and python_version < "3.14" pathspec==0.12.1 ; python_version >= "3.12" and python_version < "3.14" pbr==6.1.0 ; python_version >= "3.12" and python_version < "3.14" -pefile==2023.2.7 ; python_version >= "3.12" and python_version < "3.14" and sys_platform == "win32" platformdirs==4.3.6 ; python_version >= "3.12" and python_version < "3.14" pluggy==1.5.0 ; python_version >= "3.12" and python_version < "3.14" propcache==0.2.0 ; python_version >= "3.12" and python_version < "3.14" py==1.11.0 ; python_version >= "3.12" and python_version < "3.14" pydoclint==0.5.9 ; python_version >= "3.12" and python_version < "3.14" pygments==2.18.0 ; python_version >= "3.12" and python_version < "3.14" -pyinstaller-hooks-contrib==2024.10 ; python_version >= "3.12" and python_version < "3.14" -pyinstaller==6.11.1 ; python_version >= "3.12" and python_version < "3.14" pytest-cov==6.0.0 ; python_version >= "3.12" and python_version < "3.14" pytest-sugar==1.0.0 ; python_version >= "3.12" and python_version < "3.14" pytest-testmon==2.1.1 ; python_version >= "3.12" and python_version < "3.14" pytest-watch==4.2.0 ; python_version >= "3.12" and python_version < "3.14" pytest-xdist==3.6.1 ; python_version >= "3.12" and python_version < "3.14" pytest==8.3.3 ; python_version >= "3.12" and python_version < "3.14" -pywin32-ctypes==0.2.3 ; python_version >= "3.12" and python_version < "3.14" and sys_platform == "win32" pyyaml==6.0.2 ; python_version >= "3.12" and python_version < "3.14" qprompt==0.16.3 ; python_version >= "3.12" and python_version < "3.14" regex==2024.11.6 ; python_version >= "3.12" and python_version < "3.14" @@ -91,7 +85,6 @@ rich-rst==1.3.1 ; python_version >= "3.12" and python_version < "3.14" rich==13.9.4 ; python_version >= "3.12" and python_version < "3.14" rstfmt==0.0.14 ; python_version >= "3.12" and python_version < "3.14" ruff==0.8.0 ; python_version >= "3.12" and python_version < "3.14" -setuptools==75.6.0 ; python_version >= "3.12" and python_version < "3.14" six==1.16.0 ; python_version >= "3.12" and python_version < "3.14" smmap==5.0.1 ; python_version >= "3.12" and python_version < "3.14" snowballstemmer==2.2.0 ; python_version >= "3.12" and python_version < "3.14" diff --git a/requirements.txt b/requirements.txt index 465e4240..8c43a5a3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,3 @@ -altgraph==0.17.4 ; python_version >= "3.12" and python_version < "3.14" ansicolors==1.1.8 ; python_version >= "3.12" and python_version < "3.14" attrs==24.2.0 ; python_version >= "3.12" and python_version < "3.14" blinker==1.9.0 ; python_version >= "3.12" and python_version < "3.14" @@ -16,7 +15,6 @@ jinja2==3.1.4 ; python_version >= "3.12" and python_version < "3.14" joblib==1.4.2 ; python_version >= "3.12" and python_version < "3.14" lemminflect==0.2.3 ; python_version >= "3.12" and python_version < "3.14" lz4==4.3.3 ; python_version >= "3.12" and python_version < "3.14" -macholib==1.16.3 ; python_version >= "3.12" and python_version < "3.14" and sys_platform == "darwin" markdown-it-py==3.0.0 ; python_version >= "3.12" and python_version < "3.14" markupsafe==3.0.2 ; python_version >= "3.12" and python_version < "3.14" mdurl==0.1.2 ; python_version >= "3.12" and python_version < "3.14" @@ -24,15 +22,10 @@ more-itertools==10.5.0 ; python_version >= "3.12" and python_version < "3.14" nltk==3.9.1 ; python_version >= "3.12" and python_version < "3.14" numpy==2.1.3 ; python_version >= "3.12" and python_version < "3.14" packaging==24.2 ; python_version >= "3.12" and python_version < "3.14" -pefile==2023.2.7 ; python_version >= "3.12" and python_version < "3.14" and sys_platform == "win32" pygments==2.18.0 ; python_version >= "3.12" and python_version < "3.14" -pyinstaller-hooks-contrib==2024.10 ; python_version >= "3.12" and python_version < "3.14" -pyinstaller==6.11.1 ; python_version >= "3.12" and python_version < "3.14" -pywin32-ctypes==0.2.3 ; python_version >= "3.12" and python_version < "3.14" and sys_platform == "win32" regex==2024.11.6 ; python_version >= "3.12" and python_version < "3.14" rich-rst==1.3.1 ; python_version >= "3.12" and python_version < "3.14" rich==13.9.4 ; python_version >= "3.12" and python_version < "3.14" -setuptools==75.6.0 ; python_version >= "3.12" and python_version < "3.14" tqdm==4.67.0 ; python_version >= "3.12" and python_version < "3.14" typeguard==4.4.1 ; python_version >= "3.12" and python_version < "3.14" typing-extensions==4.12.2 ; python_version >= "3.12" and python_version < "3.14" diff --git a/ruff.toml b/ruff.toml index f20959f0..28fb3970 100644 --- a/ruff.toml +++ b/ruff.toml @@ -1,12 +1,10 @@ line-length = 79 unsafe-fixes = true exclude = ["src/_vendor/**"] -include = ["*.spec"] [lint] preview = true select = ["ALL"] -exclude = ["*.spec"] ignore = [ "UP009", "S101", diff --git a/scripts/build.sh b/scripts/build.sh deleted file mode 100755 index 59c2b0f4..00000000 --- a/scripts/build.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -pyinstaller vocab-tuister-server.spec \ No newline at end of file diff --git a/src/__main__.py b/src/__main__.py index af561320..dd91046a 100644 --- a/src/__main__.py +++ b/src/__main__.py @@ -13,14 +13,15 @@ from cyclopts.types import UInt16 from src import __version__ -from src.server.app import main as server_main -from src.server.app import main_dev as server_main_dev from src.utils.logger import ( CustomHandler, custom_formatwarning, log_uncaught_exceptions, ) +from .server.app import main as server_main +from .server.app import main_dev as server_main_dev + # Initialise logger logger = logging.getLogger() logging.captureWarnings(capture=True) diff --git a/src/core/transfero/adj_to_adv.py b/src/core/transfero/adj_to_adv.py index a70e1c12..36cc1403 100644 --- a/src/core/transfero/adj_to_adv.py +++ b/src/core/transfero/adj_to_adv.py @@ -10,17 +10,14 @@ from __future__ import annotations import json -import logging from pathlib import Path from typing import Final from .exceptions import InvalidWordError -logger: logging.Logger = logging.getLogger(__name__) - -_data_file_path: Path = Path(__file__).parent / "adj_to_adv.json" - -with open(_data_file_path, encoding="utf-8") as file: +with open( + Path(__file__).parent.absolute() / "adj_to_adv.json", encoding="utf-8" +) as file: ADJECTIVE_TO_ADVERB: Final[dict[str, str]] = json.load(file) @@ -50,8 +47,6 @@ def adj_to_adv(adjective: str) -> str: >>> adj_to_adv("sad") 'sadly' """ - logger.debug("adj_to_adv(%s)", adjective) - if adjective in ADJECTIVE_TO_ADVERB: return ADJECTIVE_TO_ADVERB[adjective] diff --git a/src/core/transfero/adjective_inflection.py b/src/core/transfero/adjective_inflection.py index c085bcfd..deb946c4 100644 --- a/src/core/transfero/adjective_inflection.py +++ b/src/core/transfero/adjective_inflection.py @@ -2,7 +2,6 @@ from __future__ import annotations -import logging from typing import TYPE_CHECKING import lemminflect @@ -14,8 +13,6 @@ if TYPE_CHECKING: from .. import accido -logger: logging.Logger = logging.getLogger(__name__) - def find_adjective_inflections( adjective: str, @@ -42,8 +39,6 @@ def find_adjective_inflections( InvalidComponentsError If the ending components are invalid. """ - logger.debug("find_adjective_inflections(%s, %s)", adjective, components) - if components.type != ComponentsType.ADJECTIVE: raise InvalidComponentsError(f"Invalid type: '{components.type}'") if components.subtype is not None: @@ -89,10 +84,6 @@ def find_main_adjective_inflection( InvalidComponentsError If the ending components are invalid. """ - logger.debug( - "find_main_adjective_inflections(%s, %s)", adjective, components - ) - if components.type != ComponentsType.ADJECTIVE: raise InvalidComponentsError(f"Invalid type: '{components.type}'") if components.subtype is not None: diff --git a/src/core/transfero/adverb_inflection.py b/src/core/transfero/adverb_inflection.py index 1570f68a..ecafa47d 100644 --- a/src/core/transfero/adverb_inflection.py +++ b/src/core/transfero/adverb_inflection.py @@ -2,7 +2,6 @@ from __future__ import annotations -import logging from typing import TYPE_CHECKING import lemminflect @@ -13,8 +12,6 @@ if TYPE_CHECKING: from .. import accido -logger: logging.Logger = logging.getLogger(__name__) - def find_adverb_inflections( adverb: str, @@ -41,8 +38,6 @@ def find_adverb_inflections( InvalidComponentsError If the ending components are invalid. """ - logger.debug("find_adverb_inflections(%s, %s)", adverb, components) - if components.type != ComponentsType.ADJECTIVE: raise InvalidComponentsError(f"Invalid type: '{components.type}'") @@ -87,8 +82,6 @@ def find_main_adverb_inflection( InvalidComponentsError If the ending components are invalid. """ - logger.debug("find_main_adverb_inflections(%s, %s)", adverb, components) - if components.type is not ComponentsType.ADJECTIVE: raise InvalidComponentsError(f"Invalid type: '{components.type}'") if components.subtype != "adverb": diff --git a/src/core/transfero/noun_inflection.py b/src/core/transfero/noun_inflection.py index e7a87a74..bec0e8e3 100644 --- a/src/core/transfero/noun_inflection.py +++ b/src/core/transfero/noun_inflection.py @@ -2,45 +2,17 @@ from __future__ import annotations -import logging -import sys -from types import ModuleType -from typing import TYPE_CHECKING, Any, cast +from typing import TYPE_CHECKING import lemminflect +from inflect import engine from ..accido.misc import Case, ComponentsType, Number from .exceptions import InvalidComponentsError, InvalidWordError if TYPE_CHECKING: - from collections.abc import Callable - from .. import accido -logger: logging.Logger = logging.getLogger(__name__) - -# Frozen with PyInstaller -if getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS"): - import sys - - def _typechecked( - target: Callable[..., Any] | None = None, - *args: Any, # noqa: ARG001 - **kwargs: Any, # noqa: ARG001 - ) -> Callable[..., Any]: - if target is None: - return lambda target: target - return target - - class _TypeguardModule: - typechecked = _typechecked - - # Monkeypatch typeguard, as not supported with pyinstaller - sys.modules["typeguard"] = cast(ModuleType, _TypeguardModule) - - -from inflect import engine - # Distinguish from the lemminflect module pluralinflect = engine() # sourcery skip: avoid-global-variables del engine @@ -79,8 +51,6 @@ def find_noun_inflections( InvalidComponentsError If the ending components are invalid. """ - logger.debug("find_noun_inflections(%s, %s)", noun, components) - if components.type != ComponentsType.NOUN: raise InvalidComponentsError(f"Invalid type: '{components.type}'") @@ -123,8 +93,6 @@ def find_main_noun_inflection( InvalidComponentsError If the ending components are invalid. """ - logger.debug("find_main_noun_inflections(%s, %s)", noun, components) - if components.type != ComponentsType.NOUN: raise InvalidComponentsError(f"Invalid type: '{components.type}'") diff --git a/src/core/transfero/pronoun_inflection.py b/src/core/transfero/pronoun_inflection.py index a330f45e..4374ec11 100644 --- a/src/core/transfero/pronoun_inflection.py +++ b/src/core/transfero/pronoun_inflection.py @@ -2,7 +2,6 @@ from __future__ import annotations -import logging from typing import TYPE_CHECKING, Final from ..accido.misc import Case, ComponentsType, Number @@ -11,8 +10,6 @@ if TYPE_CHECKING: from .. import accido -logger: logging.Logger = logging.getLogger(__name__) - def find_pronoun_inflections( pronoun: str, @@ -42,8 +39,6 @@ def find_pronoun_inflections( InvalidComponentsError If the ending components are invalid. """ - logger.debug("find_pronoun_inflections(%s, %s)", pronoun, components) - if components.type not in {ComponentsType.NOUN, ComponentsType.PRONOUN}: raise InvalidComponentsError(f"Invalid type: '{components.type}'") @@ -78,8 +73,6 @@ def find_main_pronoun_inflection( InvalidComponentsError If the ending components are invalid. """ - logger.debug("find_main_pronoun_inflections(%s, %s)", pronoun, components) - if components.type not in {ComponentsType.NOUN, ComponentsType.PRONOUN}: raise InvalidComponentsError(f"Invalid type: '{components.type}'") diff --git a/src/core/transfero/synonyms.py b/src/core/transfero/synonyms.py index fe89ce28..6f445610 100644 --- a/src/core/transfero/synonyms.py +++ b/src/core/transfero/synonyms.py @@ -3,10 +3,8 @@ from __future__ import annotations import logging -import sys import warnings from pathlib import Path -from typing import cast from nltk import download from nltk.corpus import wordnet @@ -15,32 +13,7 @@ logger: logging.Logger = logging.getLogger(__name__) _project_root: Path = Path(__file__).parent.parent.parent.parent -_nltk_data_path: Path - -# Frozen with PyInstaller -if getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS"): - import pkgutil - - _nltk_data_path = ( - _project_root / "src" / "core" / "transfero" / "nltk_data" - ) - - # Read nltk corpora from package data - data: bytes = cast( - bytes, - pkgutil.get_data( - "src.core.transfero", "nltk_data/corpora/wordnet.zip" - ), - ) - assert data is not None - - # Write nltk corpora in provided temporary directory - Path(_nltk_data_path / "corpora" / "wordnet.zip").write_bytes(data) - -# Regular usage -else: - _nltk_data_path = _project_root / "nltk_data" - +_nltk_data_path: Path = _project_root / "nltk_data" _nltk_data_path.mkdir(parents=True, exist_ok=True) path.append(str(_nltk_data_path)) diff --git a/src/core/transfero/verb_inflection.py b/src/core/transfero/verb_inflection.py index 25d269d9..47d93566 100644 --- a/src/core/transfero/verb_inflection.py +++ b/src/core/transfero/verb_inflection.py @@ -2,7 +2,6 @@ from __future__ import annotations -import logging from typing import TYPE_CHECKING import lemminflect @@ -15,8 +14,6 @@ from .. import accido from ..accido.type_aliases import Person -logger: logging.Logger = logging.getLogger(__name__) - def _verify_verb_inflections(components: accido.misc.EndingComponents) -> None: if components.type is not ComponentsType.VERB: @@ -68,8 +65,6 @@ def find_verb_inflections( InvalidWordError If the word is not a valid English verb. """ - logger.debug("find_verb_inflections(%s, %s)", verb, components) - _verify_verb_inflections(components) if components.mood == Mood.PARTICIPLE: @@ -127,8 +122,6 @@ def find_main_verb_inflection( InvalidComponentsError If the ending components are invalid. """ - logger.debug("find_main_verb_inflections(%s, %s)", verb, components) - _verify_verb_inflections(components) if components.mood == Mood.PARTICIPLE: diff --git a/vocab-tuister-server.spec b/vocab-tuister-server.spec deleted file mode 100644 index daa43bbb..00000000 --- a/vocab-tuister-server.spec +++ /dev/null @@ -1,57 +0,0 @@ -# -*- mode: python ; coding: utf-8 -*- - -import lemminflect -import os - -data_files = [ - ("nltk_data", "src/core/transfero/nltk_data"), - ("src/core/transfero/adj_to_adv.json", "src/core/transfero"), - ("src/server/templates", "src/server/templates"), - ("src/server/static", "src/server/static"), -] - -lemminflect_dir = os.path.dirname(lemminflect.__file__) -lemminflect_data_files = [ - (os.path.join(lemminflect_dir, "resources"), "lemminflect/resources"), - (os.path.join(lemminflect_dir, "resources"), "lemminflect/resources"), - (os.path.join(lemminflect_dir, "resources"), "lemminflect/resources"), - (os.path.join(lemminflect_dir, "resources"), "lemminflect/resources"), - (os.path.join(lemminflect_dir, "resources"), "lemminflect/resources"), - (os.path.join(lemminflect_dir, "resources"), "lemminflect/resources"), -] - -a = Analysis( - ["src/__main__.py"], - pathex=[], - binaries=[], - datas=data_files + lemminflect_data_files, - hiddenimports=["numpy.core.multiarray"], - hookspath=[], - hooksconfig={}, - runtime_hooks=[], - excludes=["typeguard"], - noarchive=False, - optimize=0, -) -pyz = PYZ(a.pure) - -exe = EXE( - pyz, - a.scripts, - a.binaries, - a.datas, - [], - name="vocab-tuister-server", - debug=False, - bootloader_ignore_signals=False, - strip=False, - upx=True, - upx_exclude=[], - runtime_tmpdir=None, - console=True, - disable_windowed_traceback=False, - argv_emulation=False, - target_arch=None, - codesign_identity=None, - entitlements_file=None, -)