Skip to content

Commit

Permalink
TYP: Fix new static typing failures
Browse files Browse the repository at this point in the history
  • Loading branch information
has2k1 committed Dec 10, 2024
1 parent f574e1d commit 67c7651
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.0
rev: v0.8.2
hooks:
- id: ruff
args: [--select=I001, --fix]
Expand Down
5 changes: 5 additions & 0 deletions doc/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
=========

v0.13.1
-------
*not-yet-released*


v0.13.0
-------
*2024-10-24*
Expand Down
2 changes: 1 addition & 1 deletion mizani/bounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ def censor(
if bool_idx.any():
if res.dtype == int:
res = res.astype(float)
res[bool_idx] = null
res[bool_idx] = null # pyright: ignore[reportCallIssue,reportArgumentType]
return res


Expand Down
4 changes: 2 additions & 2 deletions mizani/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ def transform(self, x: FloatArrayLike) -> NDArrayFloat:
p, offset = self.p, self.offset

if np.abs(self.p) < 1e-7:
return np.sign(x) * np.log(np.abs(x) + offset)
return np.sign(x) * np.log(np.abs(x) + offset) # pyright: ignore[reportReturnType]
else:
return np.sign(x) * ((np.abs(x) + offset) ** p - 1) / p

Expand Down Expand Up @@ -916,7 +916,7 @@ class symlog_trans(trans):
breaks_func: BreaksFunction = breaks_symlog()

def transform(self, x: FloatArrayLike) -> NDArrayFloat:
return np.sign(x) * np.log1p(np.abs(x))
return np.sign(x) * np.log1p(np.abs(x)) # pyright: ignore[reportReturnType]

def inverse(self, x: FloatArrayLike) -> NDArrayFloat:
return np.sign(x) * (np.exp(np.abs(x)) - 1) # type: ignore
Expand Down
2 changes: 1 addition & 1 deletion mizani/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

# Arrays (strictly numpy)
NDArrayAny: TypeAlias = NDArray[Any]
NDArrayFloat: TypeAlias = NDArray[np.float64]
NDArrayFloat: TypeAlias = NDArray[np.floating]
NDArrayDatetime: TypeAlias = NDArray[np.datetime64]

# Panda Series
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ dev = [
]

typing = [
"pyright==1.1.386",
"pyright==1.1.390",
"pandas-stubs",
]

Expand Down

0 comments on commit 67c7651

Please sign in to comment.