Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def handle_uniform(args):
if len(args) != 2 or not all_isinstance(args, Num):
raise format_err(ValueError, "invalid arguments to uniform", args)
def handle_randrange(args):
if not all_isinstance(args, int):
raise format_err(ValueError, "arguments to randrange must be integers, not", args)
if len(args) == 1:
start, stop, step = 0, args[0], 1
elif len(args) == 2:
start, stop, step = args[0], args[1], 1
elif len(args) == 3:
start, stop, step = args
else:
raise format_err(ValueError, "randrange expects between 1 and 3 arguments, not", args)
if start > stop:
raise format_err(ValueError, "randrange start must be less than stop")
return [start, stop, step]
def handle_triangular(args):
if len(args) != 3 or not all_isinstance(args, Num):
raise format_err(ValueError, "invalid arguments to triangular", args)
def handle_weibullvariate(args):
if len(args) != 2 or not all_isinstance(args, Num):
raise format_err(ValueError, "invalid arguments to weibullvariate", args)
def handle_choice(args):
if len(args) != 1 or not isinstance(args[0], Iterable):
raise format_err(ValueError, "invalid arguments to choice", args)
return (list(args[0]),)
def handle_gammavariate(args):
if len(args) != 2 or not all_isinstance(args, Num):
raise format_err(ValueError, "invalid arguments to gammavariate", args)
def handle_randrange(args):
if not all_isinstance(args, int):
raise format_err(ValueError, "arguments to randrange must be integers, not", args)
if len(args) == 1:
start, stop, step = 0, args[0], 1
elif len(args) == 2:
start, stop, step = args[0], args[1], 1
elif len(args) == 3:
start, stop, step = args
else:
raise format_err(ValueError, "randrange expects between 1 and 3 arguments, not", args)
if start > stop:
raise format_err(ValueError, "randrange start must be less than stop")
return [start, stop, step]
def handle_randrange(args):
if not all_isinstance(args, int):
raise format_err(ValueError, "arguments to randrange must be integers, not", args)
if len(args) == 1:
start, stop, step = 0, args[0], 1
elif len(args) == 2:
start, stop, step = args[0], args[1], 1
elif len(args) == 3:
start, stop, step = args
else:
raise format_err(ValueError, "randrange expects between 1 and 3 arguments, not", args)
if start > stop:
raise format_err(ValueError, "randrange start must be less than stop")
return [start, stop, step]
def handle_betavariate(args):
if len(args) != 2 or not all_isinstance(args, Num):
raise format_err(ValueError, "invalid arguments to betavariate", args)
def handle_paretovariate(args):
if len(args) != 1 or not all_isinstance(args, Num):
raise format_err(ValueError, "invalid arguments to paretovariate", args)