M nlp/nlp/__main__.py => nlp/nlp/__main__.py +10 -8
@@ 9,17 9,19 @@ def main(argv: Optional[Sequence[str]] = None) -> None:
args = cli.parse_args(argv)
- if args.command == cli.Command.DOWNLOAD.value:
- cli.download(args.url)
+ match args.command:
- elif args.command == cli.Command.PREPROCESS.value:
- cli.preprocess(args.id, args.labels)
+ case cli.Command.DOWNLOAD.value:
+ cli.download(args.url)
- elif args.command == cli.Command.TRAIN.value:
- cli.train(args.id)
+ case cli.Command.PREPROCESS.value:
+ cli.preprocess(args.id, args.labels)
- else:
- raise ValueError("Invalid command passed.")
+ case cli.Command.TRAIN.value:
+ cli.train(args.id)
+
+ case _:
+ raise ValueError("Invalid command passed.")
if __name__ == "__main__":
M nlp/nlp/io.py => nlp/nlp/io.py +1 -2
@@ 1,6 1,5 @@
import json
from pathlib import Path
-from typing import Union
from spacy.cli import fill_config
from spacy.cli.init_config import save_config
@@ 8,7 7,7 @@ from spacy.tokens import DocBin
from nlp import paths
-RawPost = dict[str, Union[int, str]]
+RawPost = dict[str, int | str]
def write_raw_posts(posts: list[RawPost]) -> Path:
M nlp/pyproject.toml => nlp/pyproject.toml +5 -4
@@ 5,22 5,23 @@ description = ""
authors = ["Logan Connolly <logan.connolly@protonmail.com>"]
[tool.poetry.dependencies]
-python = "^3.9"
+python = "^3.10"
spacy = "^3.2.1"
requests = "^2.26.0"
[tool.poetry.dev-dependencies]
-pytest = "^6.2.5"
+pytest = "^7.1.2"
coverage = {extras = ["toml"], version = "^6.2"}
-mypy = "^0.930"
+mypy = "^0.971"
types-requests = "^2.26.2"
+black = "^22.6.0"
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
[tool.black]
-target-version = ['py38']
+target-version = ['py310']
include = '\.pyi?$'
[tool.isort]