示例#1
0
 def naive_loop(arg,func=None):
   func = func or FuncMap._default_func
   arg = as_any_array(arg)
   out = []
   for value in arg:
     out.append(func(value))
   return as_any_array(out)
示例#2
0
 def naive_loop(arg,func=None):
   func = func or FuncMap._default_func
   arg = as_any_array(arg)
   out = []
   for value in arg:
     out.append(func(value))
   return as_any_array(out)
示例#3
0
 def dict1(arg,out=None):
   arg = as_any_array(arg)
   out = {}
   for val in arg:
       out[val] = out.get(val,0) + 1
   return sorted(out.items())
示例#4
0
 def iter_groupby(arg):
   arg = as_any_array(arg)
   return sorted([(k,len(list(g))) for k,g in groupby(sorted(arg))])
示例#5
0
 def naive_comp(arg,mapping={},default=0):
   arg = as_any_array(arg)
   out = [mapping.get(value,default) for value in arg]
   return as_any_array(out)
示例#6
0
 def naive_loop(arg,mapping={},default=0):
   arg = as_any_array(arg)
   out = []
   for value in arg:
     out.append(mapping.get(value,default))
   return as_any_array(out)
示例#7
0
 def naive_comp(arg,func=None):
   func = func or FuncMap._default_func
   arg = as_any_array(arg)
   out = [func(value) for value in arg]
   return as_any_array(out)
示例#8
0
 def dict1(arg, out=None):
     arg = as_any_array(arg)
     out = {}
     for val in arg:
         out[val] = out.get(val, 0) + 1
     return sorted(out.items())
示例#9
0
 def iter_groupby(arg):
     arg = as_any_array(arg)
     return sorted([(k, len(list(g))) for k, g in groupby(sorted(arg))])
示例#10
0
 def naive_comp(arg,mapping={},default=0):
   arg = as_any_array(arg)
   out = [mapping.get(value,default) for value in arg]
   return as_any_array(out)
示例#11
0
 def naive_loop(arg,mapping={},default=0):
   arg = as_any_array(arg)
   out = []
   for value in arg:
     out.append(mapping.get(value,default))
   return as_any_array(out)
示例#12
0
 def naive_comp(arg,func=None):
   func = func or FuncMap._default_func
   arg = as_any_array(arg)
   out = [func(value) for value in arg]
   return as_any_array(out)