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:
Pull Request resolved: #492

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.

Reviewed By: crasanders

Differential Revision: D67537899

fbshipit-source-id: 312f7bdd54d8f1534e653e219cfde728a88d11ef
  • Loading branch information
JasonKChow committed Dec 20, 2024
1 parent 14a1ae2 commit 77fc106
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 77fc106

Please sign in to comment.