def _prepare_operation(self, distribution, size=(1,), **kwargs):
if isinstance(distribution, (str, ss.rv_discrete, ss.rv_continuous)):
distribution = ScipyDistribution(distribution, size)
elif isinstance(distribution, type) and issubclass(distribution, Distribution):
try:
distribution = distribution(size)
except:
After Change
if not hasattr(distribution, "rvs"):
raise ValueError("Distribution {} must implement rvs method".format(distribution))
if not isinstance(size, tuple):
size = (size,)
self.distribution = distribution
return partial(rvs_operation, distribution=distribution, size=size)
def __str__(self):