Make mypy behave like a proper pre-commit hook (#25313)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
Harry Mellor
2025-09-22 12:23:45 +00:00
committed by GitHub
co-authored by gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
parent 64c824cd78
commit 3d2c56b7a9
9 changed files with 166 additions and 87 deletions
+3 -4
View File
@@ -22,9 +22,8 @@ class TensorShape:
self.dims = dims
self.dynamic_dims = dynamic_dims if dynamic_dims else set()
def resolve(self, **bindings: dict[str,
int]) -> tuple[Union[int, str], ...]:
resolved = []
def resolve(self, **bindings: int) -> tuple[Union[int, str], ...]:
resolved = list[Union[int, str]]()
for dim in self.dims:
if isinstance(dim, str) and dim in bindings:
resolved.append(bindings[dim])
@@ -159,7 +158,7 @@ class TensorSchema:
def validate(self) -> None:
type_hints = get_type_hints(self.__class__, include_extras=True)
shape_env = {}
shape_env = dict[str, int]()
for field_name, field_type in type_hints.items():
# Check if field is missing