Skip to content

Commit

Permalink
Use proxies for Array API's valid_tuple_axes
Browse files Browse the repository at this point in the history
  • Loading branch information
honno committed Aug 30, 2021
1 parent 92cfdd2 commit fb0be82
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions hypothesis-python/src/hypothesis/extra/array_api.py
Expand Up @@ -15,7 +15,6 @@

import math
from collections import defaultdict
from copy import deepcopy
from functools import update_wrapper, wraps
from numbers import Real
from types import SimpleNamespace
Expand Down Expand Up @@ -50,6 +49,7 @@
valid_tuple_axes as _valid_tuple_axes,
)
from hypothesis.internal.conjecture import utils as cu
from hypothesis.internal.reflection import proxies
from hypothesis.internal.validation import (
check_type,
check_valid_bound,
Expand Down Expand Up @@ -684,14 +684,17 @@ def floating_dtypes(
return st.sampled_from(dtypes)


# TODO: prevent NumPy from mutating the doc
valid_tuple_axes = deepcopy(_valid_tuple_axes)
@proxies(_valid_tuple_axes)
def valid_tuple_axes(*args, **kwargs):
return _valid_tuple_axes(*args, **kwargs)


valid_tuple_axes.__doc__ = f"""
Return a strategy for permissible tuple-values for the ``axis``
argument in Array API sequential methods e.g. ``sum``, given the specified
dimensionality.
{valid_tuple_axes.__doc__}
{_valid_tuple_axes.__doc__}
"""


Expand All @@ -715,7 +718,6 @@ def mutually_broadcastable_shapes(
)


# TODO: prevent NumPy from mutating the doc
mutually_broadcastable_shapes.__doc__ = _mutually_broadcastable_shapes.__doc__


Expand Down

0 comments on commit fb0be82

Please sign in to comment.