Skip to content

Commit 6f97db0

Browse files
author
Matthias Koeppe
committed
src/sage/geometry/polyhedron/generating_function.py: pycodestyle fixes
1 parent 26e5a55 commit 6f97db0

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

src/sage/geometry/polyhedron/generating_function.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737

3838
Hrepresentation_str_options = {'prefix': 'b', 'style': 'positive'}
3939

40+
4041
def generating_function_of_integral_points(polyhedron, split=False,
4142
result_as_tuple=None,
4243
name=None, names=None,
@@ -517,18 +518,22 @@ def generating_function_of_integral_points(polyhedron, split=False,
517518

518519
parts = None
519520
if split is True:
521+
520522
def polyhedron_from_permutation(pi):
523+
521524
def ieq(a, b):
522525
return ((0 if a < b else -1,) +
523-
tuple(1 if i==b else (-1 if i==a else 0)
524-
for i in range(1, d+1)))
526+
tuple(1 if i == b else (-1 if i == a else 0)
527+
for i in range(1, d + 1)))
528+
525529
def ieq_repr_rhs(a, b):
526530
return (' <= ' if a < b else ' < ') + 'b{}'.format(b-1)
531+
527532
def ieqs_repr_lhs(pi):
528533
return 'b{}'.format(pi[0]-1)
529534

530535
ieqs, repr_rhss = zip(*[(ieq(a, b), ieq_repr_rhs(a, b))
531-
for a, b in zip(pi[:-1], pi[1:])])
536+
for a, b in zip(pi[:-1], pi[1:])])
532537
return Polyhedron(ieqs=ieqs), ieqs_repr_lhs(pi) + ''.join(repr_rhss)
533538

534539
split = (polyhedron_from_permutation(pi) for pi in Permutations(d))
@@ -644,13 +649,12 @@ def __generating_function_of_integral_points__(
644649
from sage.rings.polynomial.laurent_polynomial_ring import LaurentPolynomialRing
645650
from sage.structure.factorization import Factorization
646651

647-
B = LaurentPolynomialRing(
648-
ZZ,
649-
tuple(name + str(k) for k in indices),
650-
len(indices))
652+
B = LaurentPolynomialRing(ZZ,
653+
tuple(name + str(k) for k in indices),
654+
len(indices))
651655

652656
logger.info('preprocessing %s inequalities and %s equations...',
653-
len(inequalities), len(equations))
657+
len(inequalities), len(equations))
654658

655659
T_mod = _TransformMod(inequalities, equations, B, mod)
656660
inequalities = T_mod.inequalities
@@ -1175,9 +1179,9 @@ def _transform_(self):
11751179
inequalities_extra.append(tuple(coeffs))
11761180
T = matrix(ZZ, dim, dim, D)
11771181

1178-
self.inequalities = list(tuple(T*vector(ieq))
1179-
for ieq in inequalities_filtered) + \
1180-
inequalities_extra
1182+
self.inequalities = (list(tuple(T*vector(ieq))
1183+
for ieq in inequalities_filtered)
1184+
+ inequalities_extra)
11811185

11821186
rules_pre = ((y, B({tuple(row[1:]): 1}))
11831187
for y, row in zip((1,) + B.gens(), T.rows()))
@@ -1478,7 +1482,7 @@ def generate_mods(equations):
14781482
OUTPUT:
14791483
14801484
A tuple where each entry represents one possible configuration.
1481-
Each entry is a dictionary mapping ``i`` to ``(m, r)`` with the following
1485+
Each entry is a dictionary mapping ``i`` to ``(m, r)`` with the following
14821486
meaning: The ``i``-th coordinate of each element of the polyhedron
14831487
has to be congruent to ``r`` modulo ``m``.
14841488

0 commit comments

Comments
 (0)