14e7753441932b61c5eb061dcc5c18a2f2ae4721,gb/hypergraph/sql.py,,nthperm,#Any#Any#,27
Before Change
n -= 1
s = len(li)
res = []
for x in range(s-1, -1, -1):
f = math.factorial(x)
d = n / f
n -= d * f
res.append(li[d])
del(li[d])
return res
def do_with_edge_permutations(edge, f):
After Change
def nthperm(li, n):
// TODO: make this more efficient
indices = [i for i in range(len(li))]
pos = 0
for perm in itertools.permutations(indices):
if pos >= n:
indices = perm
break
pos += 1
return [li[indices[i]] for i in range(len(li))]
def do_with_edge_permutations(edge, f):
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 14
Instances
Project Name: graphbrain/graphbrain
Commit Name: 14e7753441932b61c5eb061dcc5c18a2f2ae4721
Time: 2016-07-29
Author: telmo@telmomenezes.net
File Name: gb/hypergraph/sql.py
Class Name:
Method Name: nthperm
Project Name: pyinstaller/pyinstaller
Commit Name: fa7a65464d94f349af68b78470777ac6b57f081b
Time: 2011-11-23
Author: h.goebel@goebel-consult.de
File Name: PyInstaller/hooks/hook-iu.py
Class Name:
Method Name: hook
Project Name: pyinstaller/pyinstaller
Commit Name: 65546b26dd142eb99f34c968b03987032a25888f
Time: 2011-11-23
Author: h.goebel@goebel-consult.de
File Name: PyInstaller/hooks/hook-os.py
Class Name:
Method Name: hook