chore: stricter mypy (#2053)
* chore: improve mypy Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * chore(types): type functions in tests Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * chore(types): No partial types in tests Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> --------- Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
This commit is contained in:
@@ -8,7 +8,7 @@ from argparse import ArgumentParser
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def main():
|
||||
def main() -> None:
|
||||
parser = ArgumentParser(
|
||||
prog="python -m test.test_projects", description="Generate a test project to check it out"
|
||||
)
|
||||
|
||||
@@ -22,11 +22,11 @@ class TestProject:
|
||||
files: FilesDict
|
||||
template_context: TemplateContext
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
self.files = {}
|
||||
self.template_context = {}
|
||||
|
||||
def generate(self, path: Path):
|
||||
def generate(self, path: Path) -> None:
|
||||
for filename, content in self.files.items():
|
||||
file_path = path / filename
|
||||
file_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
@@ -37,7 +37,7 @@ class TestProject:
|
||||
|
||||
f.write(content)
|
||||
|
||||
def copy(self):
|
||||
def copy(self) -> TestProject:
|
||||
other = TestProject()
|
||||
other.files = self.files.copy()
|
||||
other.template_context = self.template_context.copy()
|
||||
|
||||
@@ -78,13 +78,13 @@ version = 0.1.0
|
||||
|
||||
def new_c_project(
|
||||
*,
|
||||
spam_c_top_level_add="",
|
||||
spam_c_function_add="",
|
||||
setup_py_add="",
|
||||
setup_py_extension_args_add="",
|
||||
setup_py_setup_args_add="",
|
||||
setup_cfg_add="",
|
||||
):
|
||||
spam_c_top_level_add: str = "",
|
||||
spam_c_function_add: str = "",
|
||||
setup_py_add: str = "",
|
||||
setup_py_extension_args_add: str = "",
|
||||
setup_py_setup_args_add: str = "",
|
||||
setup_cfg_add: str = "",
|
||||
) -> TestProject:
|
||||
project = TestProject()
|
||||
|
||||
project.files.update(
|
||||
|
||||
Reference in New Issue
Block a user