Skip to content

Commit

Permalink
Merge 7d79d7c into e3a9b65
Browse files Browse the repository at this point in the history
  • Loading branch information
skirpichev committed Jul 16, 2015
2 parents e3a9b65 + 7d79d7c commit 6fa3496
Show file tree
Hide file tree
Showing 191 changed files with 924 additions and 1,110 deletions.
99 changes: 0 additions & 99 deletions bin/strip_whitespace

This file was deleted.

2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# E113 - unexpected indentation
# W292 - no newline at end of file
# W391 - blank line at end of file
select = E101,W191,W291,W293,E111,E112,E113,W292,W391
select = E101,W191,W291,W293,E111,E112,E113,W292,W391,E211,E272,E701,E262,E714,E125,E703,E271,E713,E711,E731,E702,E303,E261
[pytest]
minversion = 2.7.0
doctest_optionflags = ELLIPSIS NORMALIZE_WHITESPACE IGNORE_EXCEPTION_DETAIL
Expand Down
2 changes: 1 addition & 1 deletion sympy/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@

_latin = list(string.ascii_letters)
# OSINEQ should not be imported as they clash; gamma, pi and zeta clash, too
_greek = list(greeks) # make a copy, so we can mutate it
_greek = list(greeks) # make a copy, so we can mutate it
# Note: We import lamda since lambda is a reserved keyword in Python
_greek.remove("lambda")
_greek.append("lamda")
Expand Down
2 changes: 1 addition & 1 deletion sympy/assumptions/ask.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def _extract_facts(expr, symbol):
args = [x for x in args if x is not None]
if args:
return expr.func(*args)
if args and all(x != None for x in args):
if args and all(x is not None for x in args):
return expr.func(*args)


Expand Down
5 changes: 2 additions & 3 deletions sympy/assumptions/handlers/sets.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def Pow(expr, assumptions):
return False

Rational, Float = \
[staticmethod(CommonHandler.AlwaysTrue)]*2 # Float is finite-precision
[staticmethod(CommonHandler.AlwaysTrue)]*2 # Float is finite-precision

ImaginaryUnit, Infinity, NegativeInfinity, Pi, Exp1, GoldenRatio = \
[staticmethod(CommonHandler.AlwaysFalse)]*6
Expand Down Expand Up @@ -386,7 +386,7 @@ def Add(expr, assumptions):
Mul, Pow = [Add]*2

Number, sin, cos, log, exp, re, im, NumberSymbol, Abs, ImaginaryUnit = \
[staticmethod(CommonHandler.AlwaysTrue)]*10 # they are all complex functions or expressions
[staticmethod(CommonHandler.AlwaysTrue)]*10 # they are all complex functions or expressions

Infinity, NegativeInfinity = [staticmethod(CommonHandler.AlwaysFalse)]*2

Expand Down Expand Up @@ -507,7 +507,6 @@ def Pow(expr, assumptions):
return ask(Q.negative(expr.base), assumptions)
return half


@staticmethod
def log(expr, assumptions):
if ask(Q.extended_real(expr.args[0]), assumptions):
Expand Down
2 changes: 1 addition & 1 deletion sympy/assumptions/tests/test_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ def test_remove_safe():
global_assumptions.remove(Q.integer(x))
assert not ask(Q.integer(x))
assert ask(Q.integer(x))
global_assumptions.clear() # for the benefit of other tests
global_assumptions.clear() # for the benefit of other tests
20 changes: 11 additions & 9 deletions sympy/combinatorics/perm_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class PermutationGroup(Basic):
>>> P = Polyhedron(list('ABC'), pgroup=G)
>>> P.corners
(A, B, C)
>>> P.rotate(0) # apply permutation 0
>>> P.rotate(0) # apply permutation 0
>>> P.corners
(A, C, B)
>>> P.reset()
Expand Down Expand Up @@ -517,7 +517,7 @@ def baseswap(self, base, strong_gens, pos, randomized=False,
while len(_orbit(degree, T, base[pos])) != size:
gamma = next(iter(Gamma))
x = transversals[pos][gamma]
temp = x._array_form.index(base[pos + 1]) # (~x)(base[pos + 1])
temp = x._array_form.index(base[pos + 1]) # (~x)(base[pos + 1])
if temp not in basic_orbits[pos + 1]:
Gamma = Gamma - _orbit(degree, T, gamma)
else:
Expand Down Expand Up @@ -765,7 +765,8 @@ def centralizer(self, other):
rep = orbit_reps[j]
transversals[j] = dict(
other.orbit_transversal(rep, pairs=True))
trivial_test = lambda x: True
def trivial_test(x):
return True
tests = [None]*base_len
for l in range(base_len):
if base[l] in orbit_reps:
Expand Down Expand Up @@ -1114,7 +1115,7 @@ def derived_subgroup(self):
for k in rng:
c[p2[p1[k]]] = p1[p2[k]]
ct = tuple(c)
if not ct in set_commutators:
if ct not in set_commutators:
set_commutators.add(ct)
cms = [_af_new(p) for p in set_commutators]
G2 = self.normal_closure(cms)
Expand Down Expand Up @@ -1345,7 +1346,7 @@ def contains(self, g, strict=True):
>>> a = Permutation(1, 2)
>>> b = Permutation(2, 3, 1)
>>> G = PermutationGroup(a, b, degree=5)
>>> G.contains(G[0]) # trivial check
>>> G.contains(G[0]) # trivial check
True
>>> elem = Permutation([[2, 3]], size=5)
>>> G.contains(elem)
Expand Down Expand Up @@ -2103,7 +2104,7 @@ def orbit_rep(self, alpha, beta, schreier_vector=None):
a = []
while k != -1:
a.append(gens[k])
beta = gens[k].index(beta) # beta = (~gens[k])(beta)
beta = gens[k].index(beta) # beta = (~gens[k])(beta)
k = schreier_vector[beta]
if a:
return _af_new(_af_rmuln(*a))
Expand Down Expand Up @@ -2197,7 +2198,7 @@ def order(self):
degree
"""
if self._order != None:
if self._order is not None:
return self._order
if self._is_sym:
n = self._degree
Expand Down Expand Up @@ -2614,7 +2615,7 @@ def schreier_sims_random(self, base=None, gens=None, consec_succ=10,
>>> from sympy.combinatorics.named_groups import SymmetricGroup
>>> S = SymmetricGroup(5)
>>> base, strong_gens = S.schreier_sims_random(consec_succ=5)
>>> _verify_bsgs(S, base, strong_gens) #doctest: +SKIP
>>> _verify_bsgs(S, base, strong_gens) # doctest: +SKIP
True
Notes
Expand Down Expand Up @@ -2923,7 +2924,8 @@ def update_nu(l):
if init_subgroup is None:
init_subgroup = PermutationGroup([identity])
if tests is None:
trivial_test = lambda x: True
def trivial_test(x):
return True
tests = []
for i in range(base_len):
tests.append(trivial_test)
Expand Down
3 changes: 1 addition & 2 deletions sympy/combinatorics/permutations.py
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,6 @@ def __new__(cls, *args, **kwargs):
raise ValueError("Permutation argument must be a list of ints, "
"a list of lists, Permutation or Cycle.")


# safe to assume args are valid; this also makes a copy
# of the args
args = list(args[0])
Expand Down Expand Up @@ -1698,7 +1697,7 @@ def rank(self):
next_lex, unrank_lex, cardinality, length, order, size
"""
if not self._rank is None:
if self._rank is not None:
return self._rank
rank = 0
rho = self.array_form[:]
Expand Down
2 changes: 1 addition & 1 deletion sympy/combinatorics/subsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def next_lexicographic(self):
else:
indices.remove(i)
i = i - 1
while not i in indices and i >= 0:
while i not in indices and i >= 0:
i = i - 1
if i >= 0:
indices.remove(i)
Expand Down
2 changes: 1 addition & 1 deletion sympy/combinatorics/tensor_can.py
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ def canonicalize(g, dummies, msym, *v):
"""
from sympy.combinatorics.testutil import canonicalize_naive
if not isinstance(msym, list):
if not msym in [0, 1, None]:
if msym not in [0, 1, None]:
raise ValueError('msym must be 0, 1 or None')
num_types = 1
else:
Expand Down
12 changes: 8 additions & 4 deletions sympy/combinatorics/tests/test_perm_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,10 +517,14 @@ def test_schreier_sims_incremental():


def _subgroup_search(i, j, k):
prop_true = lambda x: True
prop_fix_points = lambda x: [x(point) for point in points] == points
prop_comm_g = lambda x: rmul(x, g) == rmul(g, x)
prop_even = lambda x: x.is_even
def prop_true(x):
return True
def prop_fix_points(x):
return [x(point) for point in points] == points
def prop_comm_g(x):
return rmul(x, g) == rmul(g, x)
def prop_even(x):
return x.is_even
for i in range(i, j, k):
S = SymmetricGroup(i)
A = AlternatingGroup(i)
Expand Down
2 changes: 0 additions & 2 deletions sympy/combinatorics/tests/test_tensor_can.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,6 @@ def test_canonicalize1():
can = canonicalize(g, list(range(2,6)), 0, (base3, gens3, 2, 0))
assert can == [0,2,4,1,3,5,6,7]


# A^{d3 d0 d2}*A^a0_{d1 d2}*A^d1_d3^a1*A^{a2 a3}_d0
# ord = [a0,a1,a2,a3,d0,-d0,d1,-d1,d2,-d2,d3,-d3]
# 0 1 2 3 4 5 6 7 8 9 10 11
Expand Down Expand Up @@ -500,7 +499,6 @@ def test_riemann_products():
can = canonicalize(g, dummies, 0, (base, gens, 2, 0))
assert can == [0, 3, 4, 1, 2, 5, 7, 6]


# A^n_{i, j} symmetric in i,j
# A^m0_a0^d2 * A^n0_d2^d1 * A^n1_d1^d0 * A_{m0 d0}^a1
# ordering: first the free indices; then first n, then d
Expand Down
3 changes: 2 additions & 1 deletion sympy/combinatorics/testutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ def _naive_list_centralizer(self, other, af=False):
if hasattr(other, 'generators'):
elements = list(self.generate_dimino(af=True))
gens = [x._array_form for x in other.generators]
commutes_with_gens = lambda x: all(_af_commutes_with(x, gen) for gen in gens)
def commutes_with_gens(x):
return all(_af_commutes_with(x, gen) for gen in gens)
centralizer_list = []
if not af:
for element in elements:
Expand Down
2 changes: 1 addition & 1 deletion sympy/combinatorics/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def _check_cycles_alt_sym(perm):
total_len = 0
used = set()
for i in range(n//2):
if not i in used and i < n//2 - total_len:
if i not in used and i < n//2 - total_len:
current_len = 1
used.add(i)
j = i
Expand Down
2 changes: 0 additions & 2 deletions sympy/concrete/expr_with_intlimits.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ def change_index(self, var, trafo, newvar=None):

return self.func(function, *limits)


def index(expr, x):
"""
Return the index of a dummy variable in the list of limits.
Expand Down Expand Up @@ -237,7 +236,6 @@ def reorder(expr, *arg):

return new_expr


def reorder_limit(expr, x, y):
"""
Interchange two limit tuples of a Sum or Product expression.
Expand Down
9 changes: 4 additions & 5 deletions sympy/concrete/summations.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,6 @@ def fpoint(expr):
g = g.diff(i, 2, simplify=False)
return s + iterm, abs(term)


def reverse_order(self, *indices):
"""
Reverse the order of a limit in a Sum.
Expand Down Expand Up @@ -710,7 +709,7 @@ def eval_sum_symbolic(f, limits):

if None not in (lsum, rsum):
r = lsum + rsum
if not r is S.NaN:
if r is not S.NaN:
return r

# Polynomial terms with Faulhaber's formula
Expand All @@ -722,8 +721,8 @@ def eval_sum_symbolic(f, limits):

if n.is_Integer:
if n >= 0:
if (b is S.Infinity and not a is S.NegativeInfinity) or \
(a is S.NegativeInfinity and not b is S.Infinity):
if (b is S.Infinity and a is not S.NegativeInfinity) or \
(a is S.NegativeInfinity and b is not S.Infinity):
return S.Infinity
return ((bernoulli(n + 1, b + 1) - bernoulli(n + 1, a))/(n + 1)).expand()
elif a.is_Integer and a >= 1:
Expand Down Expand Up @@ -752,7 +751,7 @@ def eval_sum_symbolic(f, limits):

r = gosper_sum(f, (i, a, b))

if not r in (None, S.NaN):
if r not in (None, S.NaN):
return r

return eval_sum_hyper(f_orig, (i, a, b))
Expand Down
Loading

0 comments on commit 6fa3496

Please sign in to comment.