Skip to content

Commit

Permalink
Merge pull request #73 from skirpichev/misc-py2.6
Browse files Browse the repository at this point in the history
Misc fixes
  • Loading branch information
skirpichev committed May 13, 2015
2 parents 18b0590 + 3b3f27d commit a829ca3
Show file tree
Hide file tree
Showing 28 changed files with 70 additions and 85 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ script:
- if [[ "${TEST_PEP}" == "true" ]]; then
pep8;
fi
- travis_wait 50 bin/test_travis.sh
- bin/test_travis.sh
after_success:
- if [[ "${TRAVIS_PYTHON_VERSION}" == "2.7" ]]; then
coveralls;
Expand Down
3 changes: 2 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Copyright (c) 2006-2015 SymPy Development Team
Copyright (c) 2006-2015 SymPy Development Team,
2015 Sergey B Kirpichev

All rights reserved.

Expand Down
6 changes: 4 additions & 2 deletions doc/guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -518,5 +518,7 @@ and how to make your life easier as you get started with SymPy.
Improving the docs
------------------

Please see :ref:`the documentation <module-docs>` how to fix and improve
SymPy's documentation. All contribution is very welcome.
All contributions are welcome. If you'd like to improve something, look into
the sources if they contain the information you need (if not, please fix them),
otherwise the documentation generation needs to be improved (look in the
``doc/`` directory).
6 changes: 3 additions & 3 deletions doc/modules/assumptions/index.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
==================
Assumptions module
==================
===========
Assumptions
===========

.. automodule:: sympy.assumptions

Expand Down
4 changes: 2 additions & 2 deletions doc/modules/categories.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Category Theory Module
======================
Category Theory
===============

Introduction
------------
Expand Down
6 changes: 3 additions & 3 deletions doc/modules/combinatorics/index.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.. _combinatiorics-docs:

====================
Combinatorics Module
====================
=============
Combinatorics
=============

Contents
========
Expand Down
4 changes: 2 additions & 2 deletions doc/modules/crypto.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Basic Cryptography Module
=========================
Basic Cryptography
==================

Included in this module are both block ciphers and stream ciphers.

Expand Down
4 changes: 2 additions & 2 deletions doc/modules/diffgeom.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Differential Geometry Module
============================
Differential Geometry
=====================

.. module:: sympy.diffgeom

Expand Down
4 changes: 2 additions & 2 deletions doc/modules/functions/index.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. _functions:

Functions Module
****************
Mathematical Functions
**********************

.. module:: sympy.functions

Expand Down
6 changes: 3 additions & 3 deletions doc/modules/geometry/index.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
===============
Geometry Module
===============
========
Geometry
========


Introduction
Expand Down
8 changes: 0 additions & 8 deletions doc/modules/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,3 @@ access any SymPy module, or use this contens:
calculus/index.rst
categories.rst
diffgeom.rst

Contributions to docs
---------------------

All contributions are welcome. If you'd like to improve something, look into
the sources if they contain the information you need (if not, please fix them),
otherwise the documentation generation needs to be improved (look in the
``doc/`` directory).
4 changes: 2 additions & 2 deletions doc/modules/logic.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Logic Module
===============
Logic
=====

.. module:: sympy.logic

Expand Down
4 changes: 2 additions & 2 deletions doc/modules/plotting.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Plotting Module
===============
Plotting
========

.. module:: sympy.plotting.plot

Expand Down
6 changes: 3 additions & 3 deletions doc/modules/polys/index.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.. _polys-docs:

===============================
Polynomials Manipulation Module
===============================
========================
Polynomials Manipulation
========================

Computations with polynomials are at the core of computer algebra and
having a fast and robust polynomials manipulation module is a key for
Expand Down
4 changes: 2 additions & 2 deletions doc/modules/simplify/hyperexpand.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Details on the Hypergeometric Function Expansion Module
#######################################################
Details on the Hypergeometric Function Expansion
################################################

This page describes how the function :func:`~sympy.simplify.hyperexpand.hyperexpand` and related code
work. For usage, see the documentation of the symplify module.
Expand Down
6 changes: 3 additions & 3 deletions doc/modules/tensor/index.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.. _tensor_module:

=============
Tensor Module
=============
=======
Tensors
=======

.. automodule:: sympy.tensor

Expand Down
4 changes: 2 additions & 2 deletions sympy/core/tests/test_containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ def test_Dict():
assert d[y] == 2
raises(KeyError, lambda: d[2])
assert len(d) == 3
assert set(d.keys()) == set((x, y, z))
assert set(d.values()) == set((S(1), S(2), S(3)))
assert set(d.keys()) == {x, y, z}
assert set(d.values()) == {S(1), S(2), S(3)}
assert d.get(5, 'default') == 'default'
assert x in d and z in d and not 5 in d
assert d.has(x) and d.has(1) # SymPy Basic .has method
Expand Down
2 changes: 1 addition & 1 deletion sympy/matrices/expressions/matexpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ def _entry(self, i, j):

@property
def free_symbols(self):
return set((self,))
return {self}

def doit(self, **hints):
if hints.get('deep', True):
Expand Down
2 changes: 1 addition & 1 deletion sympy/matrices/expressions/tests/test_hadamard.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def test_HadamardProduct():
mix = HadamardProduct(Z*A, B)*C
assert mix.shape == (n, k)

assert set(HadamardProduct(A, B, A).T.args) == set((A.T, A.T, B.T))
assert set(HadamardProduct(A, B, A).T.args) == {A.T, A.T, B.T}

def test_HadamardProduct_isnt_commutative():
assert HadamardProduct(A, B) != HadamardProduct(B, A)
Expand Down
2 changes: 1 addition & 1 deletion sympy/matrices/expressions/tests/test_matrix_exprs.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def test_dense_conversion():


def test_free_symbols():
assert (C*D).free_symbols == set((C, D))
assert (C*D).free_symbols == {C, D}


def test_zero_matmul():
Expand Down
2 changes: 1 addition & 1 deletion sympy/polys/distributedmodules.py
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ def removethis(pair):

# Finally interreduce the standard basis.
# (TODO again, better data structures)
S = set((tuple(f), i) for i, f in enumerate(S))
S = {(tuple(f), i) for i, f in enumerate(S)}
for (a, ai), (b, bi) in permutations(S, 2):
A = sdm_LM(a)
B = sdm_LM(b)
Expand Down
8 changes: 4 additions & 4 deletions sympy/series/tests/test_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,10 @@ def test_leading_order():


def test_leading_order2():
assert set((2 + pi + x**2).extract_leading_order(x)) == set(((pi, O(1, x)),
(S(2), O(1, x))))
assert set((2*x + pi*x + x**2).extract_leading_order(x)) == set(((2*x, O(x)),
(x*pi, O(x))))
assert set((2 + pi + x**2).extract_leading_order(x)) == {(pi, O(1, x)),
(S(2), O(1, x))}
assert set((2*x + pi*x + x**2).extract_leading_order(x)) == {(2*x, O(x)),
(x*pi, O(x))}


def test_order_leadterm():
Expand Down
29 changes: 12 additions & 17 deletions sympy/sets/sets.py
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ def _union(self, other):
start = Max(self.start, other.start)
if (end < start or
(end == start and (end not in self and end not in other))):
return None
return
else:
start = Min(self.start, other.start)
end = Max(self.end, other.end)
Expand All @@ -920,9 +920,7 @@ def _union(self, other):
open_left = self.left_open and self.start not in other
open_right = self.right_open and self.end not in other
new_self = Interval(self.start, self.end, open_left, open_right)
return set((new_self, other))

return None
return {new_self, other}

@property
def _boundary(self):
Expand Down Expand Up @@ -1154,14 +1152,14 @@ def reduce(args):
while(new_args):
for s in args:
new_args = False
for t in args - set((s,)):
for t in args - {s}:
new_set = s._union(t)
# This returns None if s does not know how to intersect
# with t. Returns the newly intersected set otherwise
if new_set is not None:
if not isinstance(new_set, set):
new_set = set((new_set, ))
new_args = (args - set((s, t))).union(new_set)
new_set = {new_set}
new_args = (args - {s, t}).union(new_set)
break
if new_args:
args = new_args
Expand Down Expand Up @@ -1368,7 +1366,7 @@ def _contains(self, other):
def __iter__(self):
for s in self.args:
if s.is_iterable:
other_sets = set(self.args) - set((s,))
other_sets = set(self.args) - {s}
other = Intersection(other_sets, evaluate=False)
return (x for x in s if x in other)

Expand Down Expand Up @@ -1401,7 +1399,7 @@ def reduce(args):
# If any of the sets are unions, return a Union of Intersections
for s in args:
if s.is_Union:
other_sets = set(args) - set((s,))
other_sets = set(args) - {s}
if len(other_sets) > 0:
other = Intersection(other_sets)
return Union(Intersection(arg, other) for arg in s.args)
Expand All @@ -1424,12 +1422,12 @@ def reduce(args):
while(new_args):
for s in args:
new_args = False
for t in args - set((s,)):
for t in args - {s}:
new_set = s._intersect(t)
# This returns None if s does not know how to intersect
# with t. Returns the newly intersected set otherwise
if new_set is not None:
new_args = (args - set((s, t))).union(set((new_set, )))
new_args = (args - {s, t}).union({new_set})
break
if new_args:
args = new_args
Expand Down Expand Up @@ -1717,12 +1715,9 @@ def _union(self, other):

# If other set contains one of my elements, remove it from myself
if any(other.contains(x) is true for x in self):
return set((
FiniteSet(*[x for x in self if other.contains(x) is not true]),
other))

return None

return {FiniteSet(*[x for x in self
if other.contains(x) is not true]),
other}

def _contains(self, other):
"""
Expand Down
2 changes: 1 addition & 1 deletion sympy/sets/tests/test_sets.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ def test_product_basic():
assert (.5, .5, .5) in square * unit_line
assert (H, 3, 3) in coin * d6* d6
HH, TT = sympify(H), sympify(T)
assert set(coin**2) == set(((HH, HH), (HH, TT), (TT, HH), (TT, TT)))
assert set(coin**2) == {(HH, HH), (HH, TT), (TT, HH), (TT, TT)}

assert (d4*d4).is_subset(d6*d6)

Expand Down
5 changes: 0 additions & 5 deletions sympy/solvers/diophantine.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@ def diophantine(eq, param=symbols("t", integer=True)):
>>> diophantine(x**2 - y**2)
set([(-t, -t), (t, -t)])
#>>> diophantine(x*(2*x + 3*y - z))
#set([(0, n1, n2), (3*t - z, -2*t + z, z)])
#>>> diophantine(x**2 + 3*x*y + 4*x)
#set([(0, n1), (3*t - 4, -t)])
See Also
========
Expand Down
4 changes: 2 additions & 2 deletions sympy/solvers/tests/test_solvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,8 @@ def test_solve_for_functions_derivatives():
assert solve(x.diff(t) - 1, x.diff(t)) == [1]
assert solve(3*x.diff(t) - 2, x.diff(t)) == [Rational(2, 3)]

eqns = set((3*x - 1, 2*y - 4))
assert solve(eqns, set((x, y))) == { x: Rational(1, 3), y: 2 }
eqns = {3*x - 1, 2*y - 4}
assert solve(eqns, {x, y}) == {x: Rational(1, 3), y: 2}
x = Symbol('x')
f = Function('f')
F = x**2 + f(x)**2 - 4*x - 1
Expand Down
6 changes: 3 additions & 3 deletions sympy/stats/tests/test_rv.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ def test_where():
def test_random_symbols():
X, Y = Normal('X', 0, 1), Normal('Y', 0, 1)

assert set(random_symbols(2*X + 1)) == set((X,))
assert set(random_symbols(2*X + Y)) == set((X, Y))
assert set(random_symbols(2*X + Y.symbol)) == set((X,))
assert set(random_symbols(2*X + 1)) == {X}
assert set(random_symbols(2*X + Y)) == {X, Y}
assert set(random_symbols(2*X + Y.symbol)) == {X}
assert set(random_symbols(2)) == set()


Expand Down
12 changes: 6 additions & 6 deletions sympy/unify/tests/test_unify.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,17 @@ def test_commutative():

def _test_combinations_assoc():
assert set(allcombinations((1,2,3), (a,b), True)) == \
set(((((1, 2), (3,)), (a, b)), (((1,), (2, 3)), (a, b))))
{(((1, 2), (3,)), (a, b)), (((1,), (2, 3)), (a, b))}

def _test_combinations_comm():
assert set(allcombinations((1,2,3), (a,b), None)) == \
set(((((1,), (2, 3)), ('a', 'b')), (((2,), (3, 1)), ('a', 'b')),
(((3,), (1, 2)), ('a', 'b')), (((1, 2), (3,)), ('a', 'b')),
(((2, 3), (1,)), ('a', 'b')), (((3, 1), (2,)), ('a', 'b'))))
{(((1,), (2, 3)), ('a', 'b')), (((2,), (3, 1)), ('a', 'b')),
(((3,), (1, 2)), ('a', 'b')), (((1, 2), (3,)), ('a', 'b')),
(((2, 3), (1,)), ('a', 'b')), (((3, 1), (2,)), ('a', 'b'))}

def test_allcombinations():
assert set(allcombinations((1,2), (1,2), 'commutative')) ==\
set(((((1,),(2,)), ((1,),(2,))), (((1,),(2,)), ((2,),(1,)))))
assert set(allcombinations((1,2), (1,2), 'commutative')) == \
{(((1,),(2,)), ((1,),(2,))), (((1,),(2,)), ((2,),(1,)))}


def test_commutativity():
Expand Down

0 comments on commit a829ca3

Please sign in to comment.