Skip to content

Commit d95005e

Browse files
author
Release Manager
committed
Trac #32756: fix E713 and E714 in combinat
abot negative comparison using "is not" URL: https://trac.sagemath.org/32756 Reported by: chapoton Ticket author(s): Frédéric Chapoton Reviewer(s): Matthias Koeppe
2 parents 60c6b19 + 4ae6832 commit d95005e

22 files changed

+46
-41
lines changed

src/sage/combinat/affine_permutation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1707,15 +1707,15 @@ def apply_simple_reflection_right(self, i):
17071707
EXAMPLES::
17081708
17091709
sage: G = AffinePermutationGroup(['G',2,1])
1710-
sage: p=G([2, 10, -5, 12, -3, 5])
1710+
sage: p = G([2, 10, -5, 12, -3, 5])
17111711
sage: p.apply_simple_reflection_right(0)
17121712
Type G affine permutation with window [-9, -1, -5, 12, 8, 16]
17131713
sage: p.apply_simple_reflection_right(1)
17141714
Type G affine permutation with window [10, 2, 12, -5, 5, -3]
17151715
sage: p.apply_simple_reflection_right(2)
17161716
Type G affine permutation with window [2, -5, 10, -3, 12, 5]
17171717
"""
1718-
if not i in self.parent().index_set():
1718+
if i not in self.parent().index_set():
17191719
raise ValueError('index not in index set')
17201720
j = i
17211721
l = self[:]

src/sage/combinat/baxter_permutations.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def __contains__(self, x):
117117
sage: sorted([p for p in Permutations(6) if p in BaxterPermutations(6)]) == sorted(BaxterPermutations(6).list())
118118
True
119119
"""
120-
if not x in Permutations(self._n):
120+
if x not in Permutations(self._n):
121121
return False
122122
for i in range(1, len(x) - 1):
123123
a = x[i]
@@ -299,7 +299,7 @@ def __contains__(self, x):
299299
sage: 42 in BaxterPermutations()
300300
False
301301
"""
302-
if not x in Permutations():
302+
if x not in Permutations():
303303
return False
304304
return x in BaxterPermutations(len(x))
305305

src/sage/combinat/cluster_algebra_quiver/mutation_type.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def _triangles(dg):
120120
for e in E:
121121
v1, v2 = e
122122
for v in V:
123-
if not v in e:
123+
if v not in e:
124124
if (v, v1) in E:
125125
if (v2, v) in E:
126126
flat_trian = sorted([v,v1,v2])
@@ -1165,7 +1165,7 @@ def _connected_mutation_type_AAtildeD(dg, ret_conn_vert=False):
11651165
connecting_vertices.append( v )
11661166
# if a vertex is of valence two and contained in an oriented 3-cycle, it is a connecting vertex
11671167
elif w[0] == 1 and w[1] == 1:
1168-
if v in o_trian_verts and not v in long_cycle_verts:
1168+
if v in o_trian_verts and v not in long_cycle_verts:
11691169
connecting_vertices.append( v )
11701170

11711171
# post-parsing 1: if we are in the affine type A case, the two parameters for the non-oriented long cycle are computed

src/sage/combinat/composition_tableau.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ def __classcall_private__(cls, *args, **kwargs):
409409
if shape is not None:
410410
# use in (and not isinstance) below so that lists can be used as
411411
# shorthand
412-
if not shape in Compositions():
412+
if shape not in Compositions():
413413
raise ValueError("shape must be a composition")
414414
if any(i == 0 for i in shape):
415415
raise ValueError("shape must have non-zero parts")
@@ -475,8 +475,8 @@ def _element_constructor_(self, t):
475475
...
476476
ValueError: [[1], [1, 2]] is not an element of Composition Tableaux of size 3 and maximum entry 3.
477477
"""
478-
if not t in self:
479-
raise ValueError("%s is not an element of %s."%(t, self))
478+
if t not in self:
479+
raise ValueError("%s is not an element of %s." % (t, self))
480480

481481
return self.element_class(self, t)
482482

src/sage/combinat/crystals/generalized_young_walls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ def in_highest_weight_crystal(self,La):
711711
sage: x.in_highest_weight_crystal(La)
712712
False
713713
"""
714-
if not La in self.parent().weight_lattice_realization():
714+
if La not in self.parent().weight_lattice_realization():
715715
raise TypeError("Must be an element in the weight lattice realization")
716716
ac = self.parent().weight_lattice_realization().simple_coroots()
717717
n = self.cartan_type().classical().rank()

src/sage/combinat/designs/bibd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@ def PBD_4_5_8_9_12(v, check=True):
958958
sage: for v in (0,1,4,5,8,9,12,13,16,17,20,21,24,25):
959959
....: _ = PBD_4_5_8_9_12(v)
960960
"""
961-
if not v%4 in [0,1]:
961+
if v % 4 not in [0, 1]:
962962
raise ValueError
963963
if v <= 1:
964964
PBD = []

src/sage/combinat/designs/block_design.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ def projective_plane_to_OA(pplane, pt=None, check=True):
676676
assert all(len(B) == n+1 for B in pplane), "pplane is not a projective plane"
677677

678678
pplane = _relabel_bibd(pplane,n**2+n+1,p=n**2+n)
679-
OA = [[x%n for x in sorted(X)] for X in pplane if not n**2+n in X]
679+
OA = [[x % n for x in sorted(X)] for X in pplane if n**2+n not in X]
680680

681681
assert len(OA) == n**2, "pplane is not a projective plane"
682682

@@ -686,6 +686,7 @@ def projective_plane_to_OA(pplane, pt=None, check=True):
686686

687687
return OA
688688

689+
689690
def projective_plane(n, check=True, existence=False):
690691
r"""
691692
Return a projective plane of order ``n`` as a 2-design.

src/sage/combinat/designs/orthogonal_arrays_build_recursive.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ def construction_q_x(k,q,x,check=True,explain_construction=False):
545545
relabel = {i:j for j,i in enumerate(points_to_keep)}
546546

547547
# PBD is a (n,[q,q-x-1,q-x+1,x+2])-PBD
548-
PBD = [[relabel[xx] for xx in B if not xx in points_to_delete] for B in TD]
548+
PBD = [[relabel[xx] for xx in B if xx not in points_to_delete] for B in TD]
549549

550550
# Taking the unique block of size x+2
551551
assert list(map(len,PBD)).count(x+2)==1

src/sage/combinat/designs/steiner_quadruple_systems.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -545,14 +545,15 @@ def _missing_pair(n,l):
545545
sage: _missing_pair(6, [(0,1), (4,5)])
546546
(2, 3)
547547
"""
548-
l = [x for X in l for x in X]
548+
l = set(x for X in l for x in X)
549549
for x in range(n):
550-
if not x in l:
550+
if x not in l:
551551
break
552552

553-
assert not x in l
554-
assert not x+1 in l
555-
return (x,x+1)
553+
assert x not in l
554+
assert x + 1 not in l
555+
return (x, x + 1)
556+
556557

557558
def barP(eps, m):
558559
r"""

src/sage/combinat/diagram_algebras.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2771,7 +2771,7 @@ def s(self, i):
27712771
sage: P2h.s(1)
27722772
P{{-3, 3}, {-2, 1}, {-1, 2}}
27732773
"""
2774-
if not i in ZZ or i <= 0 or i >= self._k:
2774+
if i not in ZZ or i <= 0 or i >= self._k:
27752775
raise ValueError("i must be an integer between 1 and {}".format(self._k-1))
27762776
B = self.basis()
27772777
SP = B.keys()

0 commit comments

Comments
 (0)