Skip to content

Commit

Permalink
chore: fix typing
Browse files Browse the repository at this point in the history
feat: add requirements and requirements-dev seperatelt
fix: add dev dependencies I forgot to add
  • Loading branch information
Ravencentric committed Nov 15, 2023
1 parent b0b9311 commit d4841ab
Show file tree
Hide file tree
Showing 11 changed files with 268 additions and 15 deletions.
12 changes: 11 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
---
repos:
- repo: https://github.com/floatingpurr/sync_with_poetry
rev: 1.1.0
hooks:
- id: sync_with_poetry
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.5
hooks:
Expand All @@ -15,4 +19,10 @@ repos:
- id: poetry-check
- id: poetry-lock
- id: poetry-export
args: ['-f', 'requirements.txt', '--without-hashes', '--with', 'dev', '--output', 'requirements.txt']
args: ['-f', 'requirements.txt', '--without-hashes', '--without', 'dev', '--output', 'requirements.txt']
- id: poetry-export
args: ['-f', 'requirements.txt', '--without-hashes', '--with', 'dev', '--output', 'requirements-dev.txt']
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.7.0
hooks:
- id: mypy
2 changes: 1 addition & 1 deletion juicenet/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from .juicenet import juicenet


def cli():
def cli() -> None:
"""
CLI. Passes the arguments to juicenet()
"""
Expand Down
3 changes: 2 additions & 1 deletion juicenet/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import json
import os
from pathlib import Path
from typing import Any

import yaml

Expand All @@ -26,7 +27,7 @@ def get_config(path: Path) -> Path:
return Path(os.getenv("JUICENET_CONFIG", path / "juicenet.yaml"))


def read_config(path: Path) -> dict:
def read_config(path: Path) -> Any:
"""
Reads the yaml config file
"""
Expand Down
2 changes: 1 addition & 1 deletion juicenet/juicenet.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def juicenet(
move: bool,
only_move: bool,
extensions: list[str],
):
) -> None:
"""
Do stuff here
"""
Expand Down
6 changes: 3 additions & 3 deletions juicenet/nyuu.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def move_nzb(path: Path, subdir: Path, nzb: str, out: Path, scope: str) -> None:
"""
Move NZB to a specified output path in a somewhat sorted manner
"""
subdir = path.name if subdir == Path(".") else subdir
subdir = path.name if subdir == Path(".") else subdir # type: ignore

src = path / nzb # ./foo/01.nzb
dst = out / scope / subdir # ./out/private/foo
Expand Down Expand Up @@ -56,7 +56,7 @@ def upload(
logger.debug(nyuu)
bar.text(f"{CurrentFile.NYUU} {key.name} ({scope})")

subprocess.run(nyuu, cwd=path, stdout=sink, stderr=sink)
subprocess.run(nyuu, cwd=path, stdout=sink, stderr=sink) # type: ignore

# Move each completed upload as they are done
move_nzb(path, key.relative_to(path).parent, nzb, out, scope)
Expand Down Expand Up @@ -93,7 +93,7 @@ def repost_raw(path: Path, dump: Path, bin: Path, conf: Path, debug: bool) -> No
bar.text(f"{CurrentFile.RAW} {article.name}")
logger.debug(nyuu)

subprocess.run(nyuu, cwd=path, stdout=sink, stderr=sink)
subprocess.run(nyuu, cwd=path, stdout=sink, stderr=sink) # type: ignore

raw_final_count = len(get_glob_matches(dump, ["*"]))
if raw_final_count == 0:
Expand Down
Empty file added juicenet/py.typed
Empty file.
2 changes: 1 addition & 1 deletion juicenet/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ def get_version() -> str:
pyproject = Path(__file__).parent.with_name("pyproject.toml").read_text()
version = tomllib.loads(pyproject)["tool"]["poetry"]["version"]

return version
return version # type: ignore
212 changes: 208 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ python = "^3.9"
PyYAML = "^6.0.1"
alive-progress = "^3.1.5"
loguru = "^0.7.2"
rich = "^13.6.0"
rich = "^13.7.0"
rich-argparse = "^1.4.0"
colorama = "^0.4.6"
tomli = { version = "^2.0.1", python = "<3.11" }
Expand All @@ -37,6 +37,8 @@ importlib-metadata = { version = "^6.8.0", python = "<3.10" }

[tool.poetry.group.dev.dependencies]
ruff = "^0.1.4"
mypy = "^1.7.0"
pre-commit = "^3.5.0"

[tool.ruff]
line-length = 120
Expand All @@ -45,6 +47,14 @@ line-length = 120
extend-select = ["I"]
fixable = ["ALL"]

[[tool.mypy.overrides]]
module = [
"colorama",
"yaml",
"alive_progress"
]
ignore_missing_imports = true

[tool.poetry.scripts]
juicenet = "juicenet.__main__:cli"

Expand Down
Loading

0 comments on commit d4841ab

Please sign in to comment.