Skip to content

Commit cc63398

Browse files
committed
some fixes for pycodestyle E275
1 parent 3202f65 commit cc63398

File tree

32 files changed

+98
-97
lines changed

32 files changed

+98
-97
lines changed

src/sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,22 @@
2323
- Reimundo Heluani (2019-08-09): Initial implementation.
2424
"""
2525

26-
#******************************************************************************
26+
# *****************************************************************************
2727
# Copyright (C) 2019 Reimundo Heluani <[email protected]>
2828
#
2929
# This program is free software: you can redistribute it and/or modify
3030
# it under the terms of the GNU General Public License as published by
3131
# the Free Software Foundation, either version 2 of the License, or
3232
# (at your option) any later version.
33-
# http://www.gnu.org/licenses/
34-
#*****************************************************************************
33+
# https://www.gnu.org/licenses/
34+
# ****************************************************************************
3535

3636
from .lie_conformal_algebra_with_structure_coefs import \
37-
LieConformalAlgebraWithStructureCoefficients
37+
LieConformalAlgebraWithStructureCoefficients
3838
from sage.matrix.special import identity_matrix
3939
from sage.structure.indexed_generators import standardize_names_index_set
4040

41+
4142
class WeylLieConformalAlgebra(LieConformalAlgebraWithStructureCoefficients):
4243
r"""
4344
The Weyl Lie conformal algebra.
@@ -132,7 +133,7 @@ def __init__(self, R, ngens=None, gram_matrix=None, names=None,
132133
from sage.matrix.matrix_space import MatrixSpace
133134
if ngens:
134135
from sage.rings.integer_ring import ZZ
135-
if not(ngens in ZZ and not ngens % 2):
136+
if not (ngens in ZZ and not ngens % 2):
136137
raise ValueError("ngens needs to be an even positive Integer, "
137138
f"got {ngens}")
138139
if gram_matrix is not None:
@@ -163,8 +164,9 @@ def __init__(self, R, ngens=None, gram_matrix=None, names=None,
163164
names, index_set = standardize_names_index_set(names=names,
164165
index_set=index_set,
165166
ngens=ngens)
166-
weyldict = { (i,j): {0: {('K',0): gram_matrix[index_set.rank(i),
167-
index_set.rank(j)]}} for i in index_set for j in index_set}
167+
weyldict = {(i, j): {0: {('K', 0): gram_matrix[index_set.rank(i),
168+
index_set.rank(j)]}}
169+
for i in index_set for j in index_set}
168170

169171
super().__init__(R, weyldict, names=names,
170172
latex_names=latex_names,
@@ -182,7 +184,7 @@ def _repr_(self):
182184
The Weyl Lie conformal algebra with generators (alpha0, alpha1, K) over Integer Ring
183185
"""
184186
return "The Weyl Lie conformal algebra with generators {} over {}"\
185-
.format(self.gens(),self.base_ring())
187+
.format(self.gens(), self.base_ring())
186188

187189
def gram_matrix(self):
188190
r"""

src/sage/crypto/block_cipher/des.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,8 +472,8 @@ def __repr__(self):
472472
DES block cipher with 16 rounds and the following key schedule:
473473
Original DES key schedule with 16 rounds
474474
"""
475-
return('DES block cipher with %s rounds and the following key '
476-
'schedule:\n%s' % (self._rounds, self.keySchedule.__repr__()))
475+
return ('DES block cipher with %s rounds and the following key '
476+
'schedule:\n%s' % (self._rounds, self.keySchedule.__repr__()))
477477

478478
def encrypt(self, plaintext, key):
479479
r"""

src/sage/crypto/mq/sr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ def __ne__(self, other):
665665
sage: sr1 != sr2
666666
True
667667
"""
668-
return not(self == other)
668+
return not (self == other)
669669

670670
def sub_bytes(self, d):
671671
r"""

src/sage/games/quantumino.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,8 @@ def __init__(self, aside, box=(5, 8, 2)):
424424
Quantumino solver for the box (5, 8, 2)
425425
Aside pentamino number: 9
426426
"""
427-
if not(0 <= aside < 17):
428-
raise ValueError("aside (=%s) must be between 0 and 16" % aside)
427+
if not (0 <= aside < 17):
428+
raise ValueError(f"aside (={aside}) must be between 0 and 16")
429429
self._aside = aside
430430
self._box = box
431431

src/sage/geometry/polyhedron/parent.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,10 +400,10 @@ def some_elements(self):
400400
points = []
401401
R = self.base_ring()
402402
for i in range(self.ambient_dim() + 5):
403-
points.append([R(i*j^2) for j in range(self.ambient_dim())])
403+
points.append([R(i * j**2) for j in range(self.ambient_dim())])
404404
return [
405-
self.element_class(self, [points[0:self.ambient_dim()+1], [], []], None),
406-
self.element_class(self, [points[0:1], points[1:self.ambient_dim()+1], []], None),
405+
self.element_class(self, [points[0:self.ambient_dim() + 1], [], []], None),
406+
self.element_class(self, [points[0:1], points[1:self.ambient_dim() + 1], []], None),
407407
self.element_class(self, [points[0:3], points[4:5], []], None),
408408
self.element_class(self, None, None)]
409409

src/sage/interfaces/qepcad.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2427,7 +2427,7 @@ def __init__(self, parent, lines):
24272427
index = (index,)
24282428
self._index = index
24292429

2430-
self._dimension = sum([r&1 for r in index])
2430+
self._dimension = sum([r & 1 for r in index])
24312431
if 'Level ' in line:
24322432
self._level = int(line.split(':')[1].strip())
24332433
if 'Number of children' in line:

src/sage/logic/boolformula.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,7 @@ def convert_opt(self, tree):
11671167
lval = ('prop', tree[1])
11681168
else:
11691169
lval = tree[1]
1170-
if not isinstance(tree[2], tuple) and not(tree[2] is None):
1170+
if not isinstance(tree[2], tuple) and tree[2] is not None:
11711171
rval = ('prop', tree[2])
11721172
else:
11731173
rval = tree[2]
@@ -1557,5 +1557,6 @@ def length(self):
15571557
# `len(self)`, but this may be deprecated in the future (see :trac:`32148`):
15581558
__len__ = length
15591559

1560+
15601561
# allow is_consequence to be called as a function (not only as a method of BooleanFormula)
15611562
is_consequence = BooleanFormula.is_consequence

src/sage/modular/arithgroup/congroup_gamma0.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ def dimension_new_cusp_forms(self, k=2, p=0):
596596
N = self.level()
597597
k = ZZ(k)
598598

599-
if not(p == 0 or N % p):
599+
if not (p == 0 or N % p):
600600
return (self.dimension_cusp_forms(k) -
601601
2 * self.restrict(N // p).dimension_new_cusp_forms(k))
602602

src/sage/modular/btquotients/btquotient.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,8 @@ def __init__(self, p):
428428
sage: T = BruhatTitsTree(17)
429429
sage: TestSuite(T).run()
430430
"""
431-
if not(ZZ(p).is_prime()):
432-
raise ValueError('Input (%s) must be prime' % p)
431+
if not ZZ(p).is_prime():
432+
raise ValueError(f'input ({p}) must be prime')
433433
self._p = ZZ(p)
434434
self._Mat_22 = MatrixSpace(ZZ, 2, 2)
435435
self._mat_p001 = self._Mat_22([self._p, 0, 0, 1])
@@ -2283,7 +2283,7 @@ def _local_splitting(self, prec):
22832283
self._II = M([0, a, 1, 0])
22842284
z = 0
22852285
self._JJ = 0
2286-
while(self._JJ == 0):
2286+
while self._JJ == 0:
22872287
c = a * z * z + b
22882288
if c.is_square():
22892289
x = c.sqrt()

src/sage/modular/hypergeometric_motive.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -688,11 +688,10 @@ def zigzag(self, x, flip_beta=False):
688688
alpha = self._alpha
689689
beta = self._beta
690690
if flip_beta:
691-
return(sum(1 for a in alpha if a <= x) -
692-
sum(1 for b in beta if 1 - b <= x))
693-
else:
694-
return(sum(1 for a in alpha if a <= x) -
695-
sum(1 for b in beta if b <= x))
691+
return (sum(1 for a in alpha if a <= x) -
692+
sum(1 for b in beta if 1 - b <= x))
693+
return (sum(1 for a in alpha if a <= x) -
694+
sum(1 for b in beta if b <= x))
696695

697696
def weight(self):
698697
"""

0 commit comments

Comments
 (0)