fix type errors
This commit is contained in:
parent
ba657e1f86
commit
f59d52577f
|
@ -64,9 +64,8 @@ def matchings(l):
|
||||||
for i in range(count // 2):
|
for i in range(count // 2):
|
||||||
if len(disjoint_pairs) != 0:
|
if len(disjoint_pairs) != 0:
|
||||||
p = disjoint_pairs.pop()
|
p = disjoint_pairs.pop()
|
||||||
|
[u0, u1] = [u for u in l if u.id in p]
|
||||||
l = [u for u in l if u.id not in p]
|
l = [u for u in l if u.id not in p]
|
||||||
u0 = p[0]
|
|
||||||
u1 = p[1]
|
|
||||||
else:
|
else:
|
||||||
u0 = l.pop()
|
u0 = l.pop()
|
||||||
u1 = l.pop()
|
u1 = l.pop()
|
||||||
|
@ -87,7 +86,7 @@ def matchings(l):
|
||||||
random.shuffle(result)
|
random.shuffle(result)
|
||||||
for i in range(len(result)):
|
for i in range(len(result)):
|
||||||
random.shuffle(result[i])
|
random.shuffle(result[i])
|
||||||
for j in len(result[i]):
|
for j in range(len(result[i])):
|
||||||
if random.randrange(2) == 0:
|
if random.randrange(2) == 0:
|
||||||
result[i][j] = (result[i][j][1], result[i][j][0])
|
result[i][j] = (result[i][j][1], result[i][j][0])
|
||||||
result = [matching for matching in result if all((min(match[0].id,match[1].id), max(match[0].id,match[1].id)) not in block_pairs for match in matching)]
|
result = [matching for matching in result if all((min(match[0].id,match[1].id), max(match[0].id,match[1].id)) not in block_pairs for match in matching)]
|
||||||
|
|
Loading…
Reference in a new issue