in hypothesis_gufunc/gufunc.py [0:0]
def _gufunc_arg_shapes(parsed_sig, min_side, max_side):
"""Strategy to generate array shapes for arguments to a function consistent
with its signature.
Parameters
----------
parsed_sig : list-like of tuples of str
gufunc signature that has already been parsed, e.g., using
`parse_gufunc_signature`.
min_side : defaultdict of str to int
Minimum size of any of the dimensions in `parsed_sig`.
max_side : defaultdict of str to int
Maximum size of any of the dimensions in `parsed_sig`.
Returns
-------
shapes : list of tuples of int
list of tuples where each tuple is the shape of an argument.
"""
assert min_side.default_factory() <= max_side.default_factory()
min_max_ok = all(min_side[kk] <= max_side[kk] for kk in set(min_side.keys()) | set(max_side.keys()))
assert min_max_ok
# Get all dimension names in signature, including numeric constants
all_dimensions = set([k for arg in parsed_sig for k in arg])
# Assume we have already checked for weird unicode characters that mess up
# isdigit in validation of signature.
dim_map_st = {
k: (just(int(k)) if k.isdigit() else integers(min_value=min_side[k], max_value=max_side[k]))
for k in all_dimensions
}
# Build strategy that draws ints for dimensions and subs them in
return builds(_signature_map, map_dict=fixed_dictionaries(dim_map_st), parsed_sig=just(parsed_sig))