def smart_range(*args):
if len(args)==<NUM_LIT:1>:<EOL><INDENT>string_input = True<EOL>string = args[<NUM_LIT:0>].replace('<STR_LIT:U+0020>','<STR_LIT>')<EOL>original_args=string.split('<STR_LIT:U+002C>')<EOL>args = []<EOL>for arg in original_args:<EOL><INDENT>try:<EOL><INDENT>args.append(ast.literal_eval(arg))<EOL><DEDENT>except (ValueError,SyntaxError):<EOL><INDENT>try:<EOL><INDENT>args.append(eval(arg,{'<STR_LIT>':{}}))<EOL><DEDENT>except (NameError,SyntaxError):<EOL><INDENT>args.append(arg)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>string_input = False<EOL><DEDENT>arg_start = args[<NUM_LIT:0>]<EOL>if len(args)><NUM_LIT:2>:<EOL><INDENT>arg_step = args[<NUM_LIT:1>]<EOL>if len(args)><NUM_LIT:3>:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT><DEDENT>else:<EOL><INDENT>arg_step = None<EOL><DEDENT>arg_end = args[-<NUM_LIT:1>]<EOL>if String.valid(arg_start) and len(arg_start)==<NUM_LIT:1>:<EOL><INDENT>range_type = '<STR_LIT>'<EOL><DEDENT>elif all(Integer.valid(arg) for arg in args):<EOL><INDENT>range_type = '<STR_LIT>'<EOL><DEDENT>else: <EOL><INDENT>if string_input and original_args[<NUM_LIT:0>][<NUM_LIT:0>] in ['<STR_LIT:(>','<STR_LIT:[>']:<EOL><INDENT>range_type = '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>range_type = '<STR_LIT:float>'<EOL><DEDENT><DEDENT>if range_type == '<STR_LIT>':<EOL><INDENT>start = ord(arg_start)<EOL>step = (ord(arg_step)- start) if arg_step else <NUM_LIT:1><EOL>end = ord(arg_end)<EOL>out = [chr(i) for i in range(start,end+step,step)]<EOL>if np.sign(step)*(ord(out[-<NUM_LIT:1>])-end)><NUM_LIT:0>:<EOL><INDENT>del out[-<NUM_LIT:1>]<EOL><DEDENT>return out<EOL><DEDENT>elif range_type == '<STR_LIT>':<EOL><INDENT>if string_input:<EOL><INDENT>if len(args)==<NUM_LIT:2> and all('<STR_LIT>' in oa for oa in original_args):<EOL><INDENT>bases,exponents = zip(*[oa.split('<STR_LIT>') for oa in original_args])<EOL>if len(set(bases))==<NUM_LIT:1>:<EOL><INDENT>return [int(bases[<NUM_LIT:0>])**exponent for exponent in smart_range('<STR_LIT:U+002C>'.join(exponents))]<EOL><DEDENT><DEDENT><DEDENT>start = arg_start<EOL>step = (arg_step - arg_start) if arg_step is not None else <NUM_LIT:1><EOL>end = arg_end<EOL>out = list(range(start,end+step,step))<EOL>if np.sign(step)*(out[-<NUM_LIT:1>]-end)><NUM_LIT:0>:<EOL><INDENT>del out[-<NUM_LIT:1>]<EOL><DEDENT>return out<EOL><DEDENT>elif range_type == '<STR_LIT:float>':<EOL><INDENT>if len(args)==<NUM_LIT:2> and all('<STR_LIT>' in oa for oa in original_args):<EOL><INDENT>bases,exponents = zip(*[oa.split('<STR_LIT>') for oa in original_args])<EOL>if len(set(bases))==<NUM_LIT:1>:<EOL><INDENT>return [float(bases[<NUM_LIT:0>])**exponent for exponent in smart_range('<STR_LIT:U+002C>'.join(exponents)) ]<EOL><DEDENT><DEDENT>if len(args) == <NUM_LIT:2>:<EOL><INDENT>raise ValueError()<EOL><DEDENT>start = arg_start<EOL>step = arg_step - arg_start<EOL>end = arg_end<EOL>out = list(np.arange(start,end+<NUM_LIT>*step,step))<EOL>return out<EOL><DEDENT>elif range_type == '<STR_LIT>':<EOL><INDENT>lopen,start = (original_args[<NUM_LIT:0>][<NUM_LIT:0>]=='<STR_LIT:(>'),float(original_args[<NUM_LIT:0>][<NUM_LIT:1>:])<EOL>end,N = original_args[<NUM_LIT:1>].split('<STR_LIT:/>')<EOL>end,ropen = float(end[:-<NUM_LIT:1>]),(end[-<NUM_LIT:1>]=='<STR_LIT:)>')<EOL>N = ast.literal_eval(N)+lopen +ropen<EOL>points = np.linspace(start,end,num=N)<EOL>return points[lopen:len(points)-ropen]<EOL><DEDENT>
smart_range(1,3,9)==[1,3,5,7,9]