in hypothesis_gufunc/gufunc.py [0:0]
def _int_or_dict(x, default_val):
"""Pre-process cases where argument `x` can be `int`, `dict`, or
`defaultdict`. In all cases, build a `defaultdict` and return it.
"""
# case 1: x already defaultdict, leave it be, pass thru
if isinstance(x, defaultdict):
return x
check_type(int, default_val, "default value")
try:
# case 2: x is or can be converted to dict
D = defaultdict(lambda: default_val, x)
except Exception:
# case 3: x is int => make a const dict
check_type(int, x, "constant value")
D = defaultdict(lambda: x)
# case 4: if can't be converted to dict or int, then exception raised
return D