Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
fix some whitespace E275
Browse files Browse the repository at this point in the history
  • Loading branch information
fchapoton committed Aug 14, 2022
1 parent 12be2d9 commit 07f08d5
Show file tree
Hide file tree
Showing 30 changed files with 89 additions and 85 deletions.
2 changes: 1 addition & 1 deletion src/sage/calculus/transforms/dft.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ def dft(self, chi=lambda x: x):
N = len(J)
S = self.list()
F = self.base_ring() # elements must be coercible into QQ(zeta_N)
if not(J[0] in ZZ):
if J[0] not in ZZ:
G = J[0].parent() # if J is not a range it is a group G
if J[0] in ZZ and F.base_ring().fraction_field() == QQ:
# assumes J is range(N)
Expand Down
4 changes: 2 additions & 2 deletions src/sage/combinat/interval_posets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1482,8 +1482,8 @@ def _richcmp_(self, other, op) -> bool:
return (self.size() == other.size() and
self._cover_relations == other._cover_relations)
if op == op_NE:
return not(self.size() == other.size() and
self._cover_relations == other._cover_relations)
return not (self.size() == other.size() and
self._cover_relations == other._cover_relations)
return richcmp((self.size(), self.cubical_coordinates()),
(other.size(), other.cubical_coordinates()), op)

Expand Down
8 changes: 4 additions & 4 deletions src/sage/dynamics/arithmetic_dynamics/affine_ds.py
Original file line number Diff line number Diff line change
Expand Up @@ -661,11 +661,11 @@ def nth_iterate(self, P, n):
"""
n = int(n)
if n == 0:
return(P)
return P
Q = P
for i in range(n):
Q = self(Q)
return(Q)
return Q

def orbit(self, P, n):
r"""
Expand Down Expand Up @@ -728,7 +728,7 @@ def orbit(self, P, n):
for i in range(bounds[0]+1, bounds[1]+1):
Q = self(Q)
orb.append(Q)
return(orb)
return orb

def multiplier(self, P, n, check=True):
r"""
Expand Down Expand Up @@ -1014,7 +1014,7 @@ def orbit_structure(self, P):
Q = self(Q)
index += 1
I = orbit.index(Q)
return([I, index - I - 1])
return [I, index - I - 1]

def cyclegraph(self):
r"""
Expand Down
4 changes: 2 additions & 2 deletions src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ def __neq__(self, other):
sage: f != g
True
"""
return not(self == other)
return not (self == other)

def domain(self):
"""
Expand Down Expand Up @@ -863,7 +863,7 @@ def __call__(self, x, type_3_pole_check=True):
g = DynamicalSystem_Berkovich(f)
return g(self.domain()(QQ(0), QQ(1))).involution_map()
# if the reduction is not constant, the image is the Gauss point
if not(num.is_constant() and dem.is_constant()):
if not (num.is_constant() and dem.is_constant()):
return self.domain()(QQ(0), QQ(1))
if self.domain().is_padic_base():
reduced_value = field(num * dem.inverse_of_unit()).lift_to_precision(field.precision_cap())
Expand Down
17 changes: 10 additions & 7 deletions src/sage/dynamics/arithmetic_dynamics/endPN_automorphism_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,9 @@ def automorphism_group_QQ_fixedpoints(rational_function, return_functions=False,
elements.append(matrix(F, 2, [a,b, 1, d]))

if iso_type:
return(elements, which_group(elements))
return(elements)
return elements, which_group(elements)
return elements


def height_bound(polynomial):
r"""
Expand Down Expand Up @@ -611,7 +612,8 @@ def remove_redundant_automorphisms(automorphisms, order_elts, moduli, integral_a
del automorphisms[i][j]
del order_elts[i][j]

return(automorphisms)
return automorphisms


def automorphism_group_QQ_CRT(rational_function, prime_lower_bound=4, return_functions=True, iso_type=False):
r"""
Expand Down Expand Up @@ -755,7 +757,7 @@ def automorphism_group_QQ_CRT(rational_function, prime_lower_bound=4, return_fun
(gcd(orderaut + [24]) == 24 and \
(len(elements) == 12 or len(elements) == 8)):
if iso_type:
return(elements, which_group(elements))
return elements, which_group(elements)
return elements
else:
N = gcd(orderaut + [12]) # all orders of elements divide N
Expand Down Expand Up @@ -784,7 +786,7 @@ def automorphism_group_QQ_CRT(rational_function, prime_lower_bound=4, return_fun
if (len(elements) == gcd(orderaut + [24])):
#found enough automorphisms
if iso_type:
return(elements, which_group(elements))
return elements, which_group(elements)
return elements
elif numelts <= (len(temp)):
badorders.append(order)
Expand Down Expand Up @@ -819,8 +821,9 @@ def automorphism_group_QQ_CRT(rational_function, prime_lower_bound=4, return_fun
p = primes.next(p)

if iso_type:
return(elements, which_group(elements))
return(elements)
return elements, which_group(elements)
return elements


def automorphism_group_FF(rational_function, absolute=False, iso_type=False, return_functions=False):
r"""
Expand Down
4 changes: 2 additions & 2 deletions src/sage/dynamics/arithmetic_dynamics/endPN_minimal_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1083,8 +1083,8 @@ def coshdelta(z):
gn = g.nth_iterate_map(n)
pts_poly = y*gn[0] - x*gn[1]
d = ZZ(pts_poly.degree())
max_mult = max([ex for p,ex in pts_poly.factor()])
assert(n<=4), "n > 4, failed to find usable poly"
max_mult = max([ex for _, ex in pts_poly.factor()])
assert (n <= 4), "n > 4, failed to find usable poly"

R = get_bound_dynamical(pts_poly, g, m=n, dynatomic=dynatomic, prec=prec, emb=emb)
# search starts in fundamental domain
Expand Down
10 changes: 5 additions & 5 deletions src/sage/dynamics/arithmetic_dynamics/product_projective_ds.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def _call_with_args(self, P, check=True):
A = self.domain()
Q = list(P)
newP = [f(Q) for f in self.defining_polynomials()]
return(A.point(newP, check))
return A.point(newP, check)

def nth_iterate(self, P, n, normalize=False):
r"""
Expand Down Expand Up @@ -154,7 +154,7 @@ def nth_iterate(self, P, n, normalize=False):
if n < 0:
raise TypeError("must be a forward orbit")
if n == 0:
return(self)
return self
else:
Q = self(P)
if normalize:
Expand All @@ -163,7 +163,7 @@ def nth_iterate(self, P, n, normalize=False):
Q = self(Q)
if normalize:
Q.normalize_coordinates()
return(Q)
return Q

def orbit(self, P, N, **kwds):
r"""
Expand Down Expand Up @@ -219,7 +219,7 @@ def orbit(self, P, N, **kwds):
if N[0] < 0 or N[1] < 0:
raise TypeError("orbit bounds must be non-negative")
if N[0] > N[1]:
return([])
return []

Q = copy(P)
check = kwds.pop("check", True)
Expand All @@ -237,7 +237,7 @@ def orbit(self, P, N, **kwds):
if normalize:
Q.normalize_coordinates()
orb.append(Q)
return(orb)
return orb

def nth_iterate_map(self, n):
r"""
Expand Down
4 changes: 2 additions & 2 deletions src/sage/dynamics/arithmetic_dynamics/projective_ds.py
Original file line number Diff line number Diff line change
Expand Up @@ -5726,7 +5726,7 @@ def reduced_form(self, **kwds):
pp_d = pts_poly.degree()
pts_poly_CF = pts_poly_CF.subs({pts_poly_CF.parent().gen(1):1}).univariate_polynomial()
max_mult = max([pp_d - pts_poly_CF.degree()] + [ex for p,ex in pts_poly_CF.roots()])
assert(n<=4), "n > 4, failed to find usable poly"
assert (n<=4), "n > 4, failed to find usable poly"
G,m = pts_poly.reduced_form(prec=prec, emb=emb, smallest_coeffs=False)
sm_f = self.conjugate(m)

Expand Down Expand Up @@ -5913,7 +5913,7 @@ def postcritical_set(self, check=True):
post_critical_list = []
for point in critical_points:
next_point = f(point)
while not(next_point in post_critical_list):
while next_point not in post_critical_list:
post_critical_list.append(next_point)
next_point = f(next_point)
return post_critical_list
Expand Down
8 changes: 4 additions & 4 deletions src/sage/game_theory/normal_form_game.py
Original file line number Diff line number Diff line change
Expand Up @@ -2205,11 +2205,11 @@ def _is_NE(self, a, b, p1_support, p2_support, M1, M2):
False
"""
# Check that supports are obeyed
if not(all(a[i] > 0 for i in p1_support) and
all(b[j] > 0 for j in p2_support) and
all(a[i] == 0 for i in range(len(a))
if not (all(a[i] > 0 for i in p1_support) and
all(b[j] > 0 for j in p2_support) and
all(a[i] == 0 for i in range(len(a))
if i not in p1_support) and
all(b[j] == 0 for j in range(len(b))
all(b[j] == 0 for j in range(len(b))
if j not in p2_support)):
return False

Expand Down
10 changes: 5 additions & 5 deletions src/sage/games/sudoku.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def __init__(self, puzzle, verify_input = True):
self.puzzle = tuple(puzzle)
elif is_Matrix(puzzle):
puzzle_size = puzzle.ncols()
if verify_input and not(puzzle.is_square()):
if verify_input and not puzzle.is_square():
raise ValueError('Sudoku puzzle must be a square matrix')
self.puzzle = tuple([int(x) for x in puzzle.list()])
elif isinstance(puzzle, str):
Expand Down Expand Up @@ -312,7 +312,7 @@ def _matrix_(self, R=None):
ValueError: Sudoku puzzles only convert to matrices over Integer Ring, not Rational Field
"""
from sage.rings.integer_ring import ZZ, IntegerRing_class
if R and not(isinstance(R, IntegerRing_class)):
if R and not isinstance(R, IntegerRing_class):
raise ValueError('Sudoku puzzles only convert to matrices over %s, not %s' % (ZZ, R))
return self.to_matrix()

Expand Down Expand Up @@ -880,11 +880,11 @@ def make_row(row, col, entry):
# These rows will represent the original hints, plus a single entry in every other location,
# consistent with the requirements imposed on a solution to a Sudoku puzzle
for cover in DLXCPP(ones):
if not(count_only):
solution = [0]*nfour
if not count_only:
solution = [0] * nfour
for r in cover:
row, col, entry = rowinfo[r]
solution[row*nsquare+col] = entry+1
solution[row * nsquare + col] = entry + 1
yield solution
else:
yield None
4 changes: 2 additions & 2 deletions src/sage/geometry/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -3184,10 +3184,10 @@ def primitive_collections(self):
pass

def is_not_facet(I):
return all(not(I <= f) for f in facets)
return all(not (I <= f) for f in facets)

def is_in_SR(I):
return all(not(I >= sr) for sr in SR)
return all(not (I >= sr) for sr in SR)

# Generators of SR are index sets I = {i1, ..., ik}
# called "primitive collections" such that
Expand Down
2 changes: 1 addition & 1 deletion src/sage/geometry/hyperbolic_space/hyperbolic_geodesic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1474,7 +1474,7 @@ def intersection(self, other):

UHP = self.model()
# Both geodesic need to be UHP geodesics for this to work
if(other.model() != UHP):
if other.model() != UHP:
other = other.to_model(UHP)
# Get endpoints and ideal endpoints
i_start_1, i_end_1 = sorted(self.ideal_endpoints(), key=str)
Expand Down
4 changes: 2 additions & 2 deletions src/sage/geometry/hyperbolic_space/hyperbolic_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,8 @@ def _richcmp_(self, other, op):
sage: p1 == p2
True
"""
if not(isinstance(other, HyperbolicPoint)
or self.parent() is other.parent()):
if not (isinstance(other, HyperbolicPoint)
or self.parent() is other.parent()):
return op == op_NE
# bool is required to convert symbolic (in)equalities
return bool(richcmp(self._coordinates, other._coordinates, op))
Expand Down
6 changes: 3 additions & 3 deletions src/sage/geometry/polyhedron/base3.py
Original file line number Diff line number Diff line change
Expand Up @@ -1170,7 +1170,7 @@ def simplicity(self):
...
NotImplementedError: this function is implemented for polytopes only
"""
if not(self.is_compact()):
if not self.is_compact():
raise NotImplementedError("this function is implemented for polytopes only")
return self.combinatorial_polyhedron().simplicity()

Expand Down Expand Up @@ -1221,7 +1221,7 @@ def simpliciality(self):
...
NotImplementedError: this function is implemented for polytopes only
"""
if not(self.is_compact()):
if not self.is_compact():
raise NotImplementedError("this function is implemented for polytopes only")
return self.combinatorial_polyhedron().simpliciality()

Expand Down Expand Up @@ -1260,7 +1260,7 @@ def is_simplicial(self):
...
NotImplementedError: this function is implemented for polytopes only
"""
if not(self.is_compact()):
if not self.is_compact():
raise NotImplementedError("this function is implemented for polytopes only")
return self.combinatorial_polyhedron().is_simplicial()

Expand Down
2 changes: 1 addition & 1 deletion src/sage/geometry/pseudolines.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,4 +510,4 @@ def __ne__(self, other):
sage: p1 != p2
False
"""
return not(self == other)
return not (self == other)
22 changes: 11 additions & 11 deletions src/sage/groups/abelian_gps/abelian_group_morphism.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,38 +81,38 @@ class AbelianGroupMorphism(Morphism):
#Traceback (most recent call last):
# File "<ipython console>", line 1, in ?
# File ".abeliangp_hom.sage.py", line 737, in __init__
# raise TypeError, "Sorry, the orders of the corresponding elements in %s, %s must be equal."%(genss,imgss)
#TypeError: Sorry, the orders of the corresponding elements in [a*b, a*c], [x, y] must be equal.
# raise TypeError("the orders of the corresponding elements in %s, %s must be equal" % (genss,imgss))
#TypeError: the orders of the corresponding elements in [a*b, a*c], [x, y] must be equal
#
# sage: phi = AbelianGroupMorphism_im_gens(G,H,[a*b,(a*c)^2],[x*y,y])
#------------------------------------------------------------
#Traceback (most recent call last):
# File "<ipython console>", line 1, in ?
# File ".abeliangp_hom.sage.py", line 730, in __init__
# raise TypeError, "Sorry, the list %s must generate G."%genss
#TypeError: Sorry, the list [a*b, c^2] must generate G.
# raise TypeError("the list %s must generate G" % genss)
#TypeError: the list [a*b, c^2] must generate G

def __init__(self, G, H, genss, imgss):
from sage.categories.homset import Hom
Morphism.__init__(self, Hom(G, H))
if len(genss) != len(imgss):
raise TypeError("Sorry, the lengths of %s, %s must be equal." % (genss, imgss))
raise TypeError("the lengths of %s, %s must be equal" % (genss, imgss))
self._domain = G
self._codomain = H
if not(G.is_abelian()):
raise TypeError("Sorry, the groups must be abelian groups.")
if not(H.is_abelian()):
raise TypeError("Sorry, the groups must be abelian groups.")
if not G.is_abelian():
raise TypeError("the groups must be abelian groups")
if not H.is_abelian():
raise TypeError("the groups must be abelian groups")
G_domain = G.subgroup(genss)
if G_domain.order() != G.order():
raise TypeError("Sorry, the list %s must generate G." % genss)
raise TypeError("the list %s must generate G" % genss)
# self.domain_invs = G.gens_orders()
# self.codomaininvs = H.gens_orders()
self.domaingens = genss
self.codomaingens = imgss
for i in range(len(self.domaingens)):
if (self.domaingens[i]).order() != (self.codomaingens[i]).order():
raise TypeError("Sorry, the orders of the corresponding elements in %s, %s must be equal." % (genss, imgss))
raise TypeError("the orders of the corresponding elements in %s, %s must be equal" % (genss, imgss))

def _libgap_(self):
"""
Expand Down
4 changes: 2 additions & 2 deletions src/sage/groups/abelian_gps/dual_abelian_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,8 @@ def list(self):
sage: Gd.list()
(1, B, B^2, A, A*B, A*B^2)
"""
if not(self.is_finite()):
raise NotImplementedError("Group must be finite")
if not self.is_finite():
raise NotImplementedError("the group must be finite")
invs = self.gens_orders()
return tuple(self(t) for t in mrange(invs))

Expand Down
2 changes: 1 addition & 1 deletion src/sage/groups/cubic_braid.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ def burau_matrix(self, root_bur = None, domain = None, characteristic = None, va
def find_root(domain):
min_pol = min_pol_root_bur.change_ring(domain)
root_list = min_pol.roots()
if not(root_list):
if not root_list:
domain = min_pol.splitting_field(min_pol_root_bur.variable_name())
min_pol = min_pol_root_bur.change_ring(domain)
root_list = min_pol.roots()
Expand Down
5 changes: 3 additions & 2 deletions src/sage/groups/free_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,14 @@ def _lexi_gen(zeroes=False):
count = Integer(0)
while True:
mwrap, ind = count.quo_rem(26)
if mwrap == 0 and not(zeroes):
if mwrap == 0 and not zeroes:
name = ''
else:
name = str(mwrap)
name = chr(ord('a') + ind) + name
yield name
count = count + 1
count += 1


class FreeGroupElement(ElementLibGAP):
"""
Expand Down
Loading

0 comments on commit 07f08d5

Please sign in to comment.