Skip to content

Commit

Permalink
Fix latest mypy errors and pin mypy version (#492)
Browse files Browse the repository at this point in the history
Summary:

New mypy errors due to mypy update. We update to latest mypy version and now pin so we don't get more surprises.

Note that the ignore in dim_grid is necessary as that is a perfectly valid use of slice (with imaginary numbers for the step value) but  mypy seems to not understand that usage in numpy.

Differential Revision: D67537899
  • Loading branch information
JasonKChow authored and facebook-github-bot committed Dec 20, 2024
1 parent e30754c commit afd4673
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions aepsych/transforms/ops/fixed.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ def get_config_options(
if "values" not in options:
value = config[name].get("value")

if value is None:
raise ValueError(f"Value option not found in {name} section.")

try:
options["values"] = [float(value)]
except ValueError:
Expand Down
2 changes: 1 addition & 1 deletion aepsych/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def dim_grid(
if i in slice_dims.keys():
mesh_vals.append(slice(slice_dims[i] - 1e-10, slice_dims[i] + 1e-10, 1))
else:
mesh_vals.append(slice(lower[i].item(), upper[i].item(), gridsize * 1j))
mesh_vals.append(slice(lower[i].item(), upper[i].item(), gridsize * 1j)) # type: ignore

return torch.Tensor(np.mgrid[mesh_vals].reshape(dim, -1).T)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"flake8",
"black",
"sqlalchemy-stubs", # for mypy stubs
"mypy",
"mypy==1.14.0",
"parameterized",
"scikit-learn", # used in unit tests
]
Expand Down

0 comments on commit afd4673

Please sign in to comment.