Skip to content

Commit

Permalink
Enfore keyword-only arguments in private histogram functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
kyleaoman committed Dec 17, 2024
1 parent 5fb983b commit 04dadfd
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions unyt/_array_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def _sanitize_range(_range, units):
return new_range.squeeze()


def _histogram(a, bins=10, range=None, density=None, weights=None, normed=None):
def _histogram(a, *, bins=10, range=None, density=None, weights=None, normed=None):
range = _sanitize_range(range, units=[getattr(a, "units", None)])
if NUMPY_VERSION >= Version("1.24"):
counts, bins = np.histogram._implementation(
Expand Down Expand Up @@ -202,7 +202,7 @@ def histogram(a, bins=10, range=None, normed=None, weights=None, density=None):
)


def _histogram2d(x, y, bins=10, range=None, density=None, weights=None, normed=None):
def _histogram2d(x, y, *, bins=10, range=None, density=None, weights=None, normed=None):
range = _sanitize_range(
range, units=[getattr(x, "units", None), getattr(y, "units", None)]
)
Expand Down Expand Up @@ -261,7 +261,9 @@ def histogram2d(x, y, bins=10, range=None, normed=None, weights=None, density=No
)


def _histogramdd(sample, bins=10, range=None, density=None, weights=None, normed=None):
def _histogramdd(
sample, *, bins=10, range=None, density=None, weights=None, normed=None
):
range = _sanitize_range(range, units=[getattr(_, "units", None) for _ in sample])
if NUMPY_VERSION >= Version("1.24"):
counts, bins = np.histogramdd._implementation(
Expand Down Expand Up @@ -692,9 +694,8 @@ def nanquantile(a, *args, **kwargs):

@implements(np.linalg.det)
def linalg_det(a, *args, **kwargs):
return (
np.linalg.det._implementation(np.asarray(a), *args, **kwargs)
* a.units ** (a.shape[0])
return np.linalg.det._implementation(np.asarray(a), *args, **kwargs) * a.units ** (
a.shape[0]
)


Expand Down

0 comments on commit 04dadfd

Please sign in to comment.