Skip to content

Commit

Permalink
fix some typing
Browse files Browse the repository at this point in the history
  • Loading branch information
xoolive committed Nov 18, 2024
1 parent 5c79f64 commit addff03
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ known-first-party = ["numpy", "pandas"]
source = ["src"]

[tool.mypy]
python_version = 3.8
python_version = "3.9"
platform = "posix"

color_output = true
Expand Down
4 changes: 2 additions & 2 deletions src/impunity/visitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ def get_annotation_unit(self, node: ast.expr) -> Optional[str]:

elif isinstance(node, ast.Subscript):
if isinstance(node.slice, ast.Index):
if isinstance(node.slice.value, ast.Tuple):
unit_node = node.slice.value.elts[1]
if isinstance(node.slice.value, ast.Tuple): # type: ignore
unit_node = node.slice.value.elts[1] # type: ignore
elif isinstance(node.slice, ast.Tuple):
unit_node = node.slice.elts[1]
if isinstance(unit_node, ast.Constant):
Expand Down
4 changes: 2 additions & 2 deletions tests/sample_module.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from typing import Any

from typing_extensions import Annotated
from typing_extensions import Annotated, TypeAlias

import numpy as np
import numpy.typing as npt
from impunity import impunity

NDArrayFloat = npt.NDArray[np.float64]
NDArrayFloat: TypeAlias = npt.NDArray[np.float64]
meters = Annotated[NDArrayFloat, "m"]
seconds = Annotated[float, "s"]
meters_per_second = Annotated[NDArrayFloat, "m/s"]
Expand Down

0 comments on commit addff03

Please sign in to comment.