Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def var_create(*args):
vl = VarList()
all_vars = []
for arg in args:
if callable(arg) and not isinstance(arg, Var):
all_vars.append(arg(vl))
else:
all_vars.append(arg)
return all_vars
def _select(__data, *args, **kwargs):
# see https://stackoverflow.com/questions/25914329/rearrange-columns-in-sqlalchemy-select-object
if kwargs:
raise NotImplementedError(
"Using kwargs in select not currently supported. "
"Use _.newname == _.oldname instead"
)
last_op = __data.last_op
columns = {c.key: c for c in last_op.inner_columns}
# same as for DataFrame
colnames = Series(list(columns))
vl = VarList()
evaluated = (arg(vl) if callable(arg) else arg for arg in args)
od = var_select(colnames, *evaluated)
col_list = []
for k,v in od.items():
col = columns[k]
col_list.append(col if v is None else col.label(v))
return __data.append_op(last_op.with_only_columns(col_list))