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:
Henry Schreiner
2024-10-22 10:16:59 -04:00
committed by GitHub
parent b4d1e17765
commit b98602705f
27 changed files with 131 additions and 111 deletions
+1 -1
View File
@@ -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"
)
+3 -3
View File
@@ -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()
+7 -7
View File
@@ -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(