Skip to content

Commit f269274

Browse files
committed
Mypy issue
1 parent ccc3f96 commit f269274

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

qlib/rl/utils/finite_env.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,10 @@ def fill_invalid(obj: int | float | bool | np.ndarray | dict | list | tuple) ->
5656

5757

5858
def is_invalid(arr: int | float | bool | np.ndarray | dict | list | tuple) -> bool:
59-
if hasattr(arr, "dtype"):
60-
dtype = getattr(arr, "dtype")
61-
if np.issubdtype(dtype, np.floating):
59+
if isinstance(arr, np.ndarray):
60+
if np.issubdtype(arr.dtype, np.floating):
6261
return np.isnan(arr).all()
63-
return (np.iinfo(dtype).max == arr).all()
62+
return (np.iinfo(arr.dtype).max == arr).all()
6463
if isinstance(arr, dict):
6564
return all(is_invalid(o) for o in arr.values())
6665
if isinstance(arr, (list, tuple)):

0 commit comments

Comments
 (0)