Skip to content

Commit

Permalink
Merge ba37b98 into e3a9b65
Browse files Browse the repository at this point in the history
  • Loading branch information
skirpichev committed Jul 17, 2015
2 parents e3a9b65 + ba37b98 commit 912454b
Show file tree
Hide file tree
Showing 198 changed files with 995 additions and 1,171 deletions.
6 changes: 3 additions & 3 deletions bin/coverage_doctest.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def handle_starttag(self, tag, attr):
self.is_imported.append(a['id'])

def find_sphinx(name, mod_path, found={}):
if mod_path in found: # Cache results
if mod_path in found: # Cache results
return name in found[mod_path]

doc_path = mod_path.split('.')
Expand Down Expand Up @@ -312,7 +312,7 @@ def process_function(name, c_name, b_obj, mod_path, f_sk, f_md, f_mdt, f_idt,
else:
if not obj.__doc__:
add_md = True
elif not '>>>' in obj.__doc__:
elif '>>>' not in obj.__doc__:
add_mdt = True
elif _is_indirect(name, obj.__doc__):
add_idt = True
Expand Down Expand Up @@ -372,7 +372,7 @@ def process_class(c_name, obj, c_sk, c_md, c_mdt, c_idt, c_has_doctest,
full_name = "LINE %d: %s" % (line_no, c_name)
if not obj.__doc__:
c_md.append(full_name)
elif not '>>>' in obj.__doc__:
elif '>>>' not in obj.__doc__:
c_mdt.append(full_name)
elif _is_indirect(c_name, obj.__doc__):
c_idt.append(full_name)
Expand Down
2 changes: 1 addition & 1 deletion bin/mailmap_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
print(yellow("Please use a newer git version >= 1.8.4.2"))

with open(os.path.realpath(os.path.join(__file__, os.path.pardir,
os.path.pardir, "doc/aboutus.rst"))) as fd:
os.path.pardir, "doc/aboutus.rst"))) as fd:
AUTHORS = unicode(fd.read(), 'utf-8')

authors = []
Expand Down
99 changes: 0 additions & 99 deletions bin/strip_whitespace

This file was deleted.

Binary file removed doc/pics/pngview1.png
Binary file not shown.
5 changes: 3 additions & 2 deletions examples/intermediate/infinite_1d_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ def energy_corrections(perturbation, n, a=10, mass=0.5):
"""
x, _a = var("x _a")

Vnm = lambda n, m, a: Integral(X_n(n, a, x) * X_n(m, a, x)
* perturbation.subs({_a: a}), (x, 0, a)).n()
def Vnm(n, m, a):
return Integral(X_n(n, a, x) * X_n(m, a, x)
* perturbation.subs({_a: a}), (x, 0, a)).n()

# As we know from theory for V0*r/a we will just V(n, n-1) and V(n, n+1)
# wouldn't equals zero
Expand Down
17 changes: 16 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,22 @@
# 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
# E211 - whitespace before ‘(‘
# E272 - multiple spaces before keyword
# E701 - multiple statements on one line (colon)
# E262 - inline comment should start with ‘# ‘
# E703 - statement ends with a semicolon
# E714 - test for object identity should be ‘is not’
# E125 - continuation line with same indent as next logical line
# E271 - multiple spaces after keyword
# E713 - test for membership should be ‘not in’
# E711 - comparison to None should be ‘if cond is None:’
# E731 - do not assign a lambda expression, use a def
# E702 - multiple statements on one line (semicolon)
# E303 - too many blank lines (3)
# E261 - at least two spaces before inline comment
# E721 - do not compare types, use ‘isinstance()’
select = E101,W191,W291,W293,E111,E112,E113,W292,W391,E211,E272,E701,E262,E703,E714,E125,E271,E713,E711,E731,E702,E303,E261,E721
[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
Loading

0 comments on commit 912454b

Please sign in to comment.