Skip to content

Commit 98570f6

Browse files
committed
Remove superfluous comments
1 parent 10b9ec8 commit 98570f6

1 file changed

Lines changed: 0 additions & 8 deletions

File tree

src/array_api_extra/_lib/_funcs.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,12 +1005,10 @@ def quantile(
10051005
if xp is None:
10061006
xp = array_namespace(x, q)
10071007

1008-
# Convert q to array if it's a scalar
10091008
q_is_scalar = isinstance(q, int | float)
10101009
if q_is_scalar:
10111010
q = xp.asarray(q, dtype=xp.float64, device=_compat.device(x))
10121011

1013-
# Validate inputs
10141012
if not xp.isdtype(x.dtype, ("integral", "real floating")):
10151013
raise ValueError("`x` must have real dtype.") # noqa: EM101
10161014
if not xp.isdtype(q.dtype, "real floating"):
@@ -1036,7 +1034,6 @@ def quantile(
10361034
else:
10371035
axis = int(axis)
10381036

1039-
# Validate method
10401037
methods = {
10411038
"inverted_cdf",
10421039
"averaged_inverted_cdf",
@@ -1052,28 +1049,23 @@ def quantile(
10521049
if method not in methods:
10531050
raise ValueError(f"`method` must be one of {methods}") # noqa: EM102
10541051

1055-
# Handle keepdims parameter
10561052
if keepdims not in {None, True, False}:
10571053
raise ValueError("If specified, `keepdims` must be True or False.") # noqa: EM101
10581054

1059-
# Handle empty arrays
10601055
if x.shape[axis] == 0:
10611056
shape = list(x.shape)
10621057
shape[axis] = 1
10631058
x = xp.full(shape, xp.nan, dtype=dtype, device=_compat.device(x))
10641059

1065-
# Sort the data
10661060
y = xp.sort(x, axis=axis)
10671061

10681062
# Move axis to the end for easier processing
10691063
y = xp.moveaxis(y, axis, -1)
10701064
if not (q_is_scalar or q.ndim == 0):
10711065
q = xp.moveaxis(q, axis, -1)
10721066

1073-
# Get the number of elements along the axis
10741067
n = xp.asarray(y.shape[-1], dtype=dtype, device=_compat.device(y))
10751068

1076-
# Apply quantile calculation based on method
10771069
if method in {
10781070
"inverted_cdf",
10791071
"averaged_inverted_cdf",

0 commit comments

Comments
 (0)