Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Aug 4, 2024
1 parent ecd4766 commit ac42e28
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions xbitinfo/xbitinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,13 +362,15 @@ def _get_bitinformation_kwargs_handler(da, kwargs):
"""Helper function to preprocess kwargs args of :py:func:`xbitinfo.xbitinfo.get_bitinformation`."""
kwargs_var = kwargs.copy()
if "masked_value" not in kwargs_var:
if da.dtype.kind == 'i':
logging.warning('No masked value given for integer type variable. Assuming no mask to apply.')
if da.dtype.kind == "i":
logging.warning(
"No masked value given for integer type variable. Assuming no mask to apply."
)
kwargs_var["masked_value"] = "nothing"
elif da.dtype.kind == 'f':
elif da.dtype.kind == "f":
kwargs_var["masked_value"] = f"convert({str(da.dtype).capitalize()},NaN)"
else:
raise ValueError(f'Dtype kind ({da.dtype.kind}) not supported.')
raise ValueError(f"Dtype kind ({da.dtype.kind}) not supported.")
elif kwargs_var["masked_value"] is None:
kwargs_var["masked_value"] = "nothing"
if "set_zero_insignificant" not in kwargs_var:
Expand Down

0 comments on commit ac42e28

Please sign in to comment.