Skip to content

Commit 3aaa2af

Browse files
MAINT: Apply ruff rule RUF013
RUF013 PEP 484 prohibits implicit `Optional`
1 parent 56c88fe commit 3aaa2af

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

numpy/core/_utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import warnings
2+
from typing import Optional
23

34

4-
def _raise_warning(attr: str, submodule: str = None) -> None:
5+
def _raise_warning(attr: str, submodule: Optional[str] = None) -> None:
56
new_module = "numpy._core"
67
old_module = "numpy.core"
78
if submodule is not None:

numpy/lib/_function_base_impl.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
# needed in this module for compatibility
3232
from numpy.lib._histograms_impl import histogram, histogramdd # noqa: F401
33+
from typing import Optional
3334

3435

3536
array_function_dispatch = functools.partial(
@@ -4665,7 +4666,7 @@ def _quantile_ureduce_func(
46654666
a: np.array,
46664667
q: np.array,
46674668
weights: np.array,
4668-
axis: int = None,
4669+
axis: Optional[int] = None,
46694670
out=None,
46704671
overwrite_input: bool = False,
46714672
method="linear",

numpy/lib/_nanfunctions_impl.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
from numpy.lib import _function_base_impl as fnb
2828
from numpy.lib._function_base_impl import _weights_are_valid
2929
from numpy._core import overrides
30+
from typing import Optional
3031

3132

3233
array_function_dispatch = functools.partial(
@@ -1662,7 +1663,7 @@ def _nanquantile_ureduce_func(
16621663
a: np.array,
16631664
q: np.array,
16641665
weights: np.array,
1665-
axis: int = None,
1666+
axis: Optional[int] = None,
16661667
out=None,
16671668
overwrite_input: bool = False,
16681669
method="linear",

0 commit comments

Comments
 (0)