chore: enable strict mode on mypy, add isort check

This commit is contained in:
11b 2022-12-17 21:31:41 -03:00
parent ad3c378d58
commit cb1d3dd68e
4 changed files with 5 additions and 3 deletions

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
/*.egg-info/
**/__pycache__/
/.mypy_cache/
/.pdm.toml
/.venv/

View File

@ -28,8 +28,9 @@ py-modules = ["waifu"]
[tool.pdm.scripts]
lint = {shell = "pylint --jobs 0 ./waifu/**/*.py"}
importcheck = "isort --check --diff waifu"
stylecheck = "yapf --parallel --diff --recursive waifu"
typecheck = "mypy waifu"
typecheck = "mypy --strict waifu"
[tool.yapf]
based_on_style = "google"

View File

@ -6,7 +6,7 @@ T = t.TypeVar("T")
class BaseDataset(t.Generic[T]):
'''Base dataset class.'''
def __iter__(self):
def __iter__(self) -> t.Generator[T, None, None]:
'''Implements the basic iterator interface.'''
return self.generator()

View File

@ -4,7 +4,7 @@ import typing as t
class BaseModule:
'''Base module class.'''
def __iter__(self):
def __iter__(self) -> t.Generator[str, None, None]:
'''Implements the basic iterator interface.'''
return self.generator()