Skip to content

Commit

Permalink
Fix typing.
Browse files Browse the repository at this point in the history
  • Loading branch information
riga committed Oct 16, 2024
1 parent 86a71e6 commit 2e64698
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions scinum/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2332,7 +2332,7 @@ def infer_uncertainty_precision(

prec = method
if _is_numpy:
prec = np.ones(sig.shape, int) * prec # type: ignore[union-attr, assignment]
prec = np.ones(sig.shape, int) * prec # type: ignore[union-attr, assignment, type-var, operator] # noqa

elif method in ["pdg", "pdg+1", "publication", "pub"]:
# default precision
Expand All @@ -2358,7 +2358,7 @@ def infer_uncertainty_precision(
f"{sig}\nand\n{mag}",
)

prec = np.ones(sig.shape, int) * prec # type: ignore[union-attr, assignment]
prec = np.ones(sig.shape, int) * prec # type: ignore[union-attr, assignment, type-var, operator] # noqa

# make all decisions based on the three leading digits
first_three = np.round(sig * 100).astype(int) # type: ignore[assignment]
Expand Down Expand Up @@ -2462,15 +2462,15 @@ def round_uncertainty(
if precision is not None:
if _is_numpy:
if not is_numpy(precision):
precision = np.ones(digits.shape, int) * precision # type: ignore[union-attr]
if np.any(precision <= 0):
precision = np.ones(digits.shape, int) * precision # type: ignore[union-attr, type-var, operator] # noqa
if np.any(precision <= 0): # type: ignore[operator]
raise ValueError(f"precision must be positive: {precision}")
elif precision <= 0:
raise ValueError(f"precision must be positive: {precision}")

digits_float = np.array(digits, float) if _is_numpy else float(digits)
digits = match_precision(digits_float * 10.0**(precision - prec), "1", **kwargs) # type: ignore[operator] # noqa
mag -= precision - prec
mag -= precision - prec # type: ignore[operator]

return ( # type: ignore[return-value]
digits,
Expand Down
Empty file modified tests/all.sh
100755 → 100644
Empty file.
Empty file modified tests/coverage.sh
100755 → 100644
Empty file.
Empty file modified tests/linting.sh
100755 → 100644
Empty file.
Empty file modified tests/typecheck.sh
100755 → 100644
Empty file.
Empty file modified tests/unittest.sh
100755 → 100644
Empty file.

0 comments on commit 2e64698

Please sign in to comment.