sympy/sympy-python3.patch
2018-06-27 22:02:27 -06:00

189 lines
7.7 KiB
Diff

--- python3/sympy/assumptions/sathandlers.py.orig 2017-07-26 16:46:12.000000000 -0600
+++ python3/sympy/assumptions/sathandlers.py 2018-06-27 07:04:03.105607298 -0600
@@ -1,6 +1,7 @@
from __future__ import print_function, division
-from collections import MutableMapping, defaultdict
+from collections import defaultdict
+from collections.abc import MutableMapping
from sympy.core import (Add, Mul, Pow, Integer, Number, NumberSymbol,)
from sympy.core.numbers import ImaginaryUnit
--- python3/sympy/physics/mechanics/linearize.py.orig 2017-07-26 16:46:12.000000000 -0600
+++ python3/sympy/physics/mechanics/linearize.py 2018-06-27 18:50:27.377496377 -0600
@@ -8,6 +8,7 @@ from sympy.utilities.iterables import fl
from sympy.physics.vector import dynamicsymbols
from sympy.physics.mechanics.functions import msubs
import collections
+import collections.abc
class Linearizer(object):
@@ -262,7 +263,7 @@ class Linearizer(object):
# Compose dict of operating conditions
if isinstance(op_point, dict):
op_point_dict = op_point
- elif isinstance(op_point, collections.Iterable):
+ elif isinstance(op_point, collections.abc.Iterable):
op_point_dict = {}
for op in op_point:
op_point_dict.update(op)
--- python3/sympy/physics/units/util.py.orig 2017-07-26 16:46:12.000000000 -0600
+++ python3/sympy/physics/units/util.py 2018-06-27 18:48:35.345734211 -0600
@@ -6,7 +6,7 @@ Several methods to simplify expressions
from __future__ import division
-import collections
+import collections.abc
from sympy.physics.units.quantities import Quantity
from sympy import Add, Mul, Pow, Function, Rational, Tuple, sympify
@@ -110,7 +110,7 @@ def convert_to(expr, target_units):
7.62950196312651e-20*gravitational_constant**(-0.5)*hbar**0.5*speed_of_light**0.5
"""
- if not isinstance(target_units, (collections.Iterable, Tuple)):
+ if not isinstance(target_units, (collections.abc.Iterable, Tuple)):
target_units = [target_units]
if isinstance(expr, Add):
--- python3/sympy/printing/conventions.py.orig 2017-07-26 16:46:12.000000000 -0600
+++ python3/sympy/printing/conventions.py 2018-06-27 18:49:32.873611416 -0600
@@ -5,7 +5,7 @@ A few practical conventions common to al
from __future__ import print_function, division
import re
-import collections
+import collections.abc
_name_with_digits_p = re.compile(r'^([a-zA-Z]+)([0-9]+)$')
@@ -77,7 +77,7 @@ def requires_partial(expr):
get the context of the expression.
"""
- if not isinstance(expr.free_symbols, collections.Iterable):
+ if not isinstance(expr.free_symbols, collections.abc.Iterable):
return len(set(expr.variables)) > 1
return sum(not s.is_integer for s in expr.free_symbols) > 1
--- python3/sympy/tensor/array/arrayop.py.orig 2017-07-26 16:46:12.000000000 -0600
+++ python3/sympy/tensor/array/arrayop.py 2018-06-27 18:51:28.657367034 -0600
@@ -1,6 +1,6 @@
import itertools
-import collections
+import collections.abc
from sympy import S, Tuple, diff
@@ -103,7 +103,7 @@ def tensorcontraction(array, *contractio
# Verify contraction_axes:
taken_dims = set([])
for axes_group in contraction_axes:
- if not isinstance(axes_group, collections.Iterable):
+ if not isinstance(axes_group, collections.abc.Iterable):
raise ValueError("collections of contraction axes expected")
dim = array.shape[axes_group[0]]
@@ -190,7 +190,7 @@ def derive_by_array(expr, dx):
"""
from sympy.matrices import MatrixBase
- array_types = (collections.Iterable, MatrixBase, NDimArray)
+ array_types = (collections.abc.Iterable, MatrixBase, NDimArray)
if isinstance(dx, array_types):
dx = ImmutableDenseNDimArray(dx)
--- python3/sympy/tensor/array/ndim_array.py.orig 2017-07-26 16:46:12.000000000 -0600
+++ python3/sympy/tensor/array/ndim_array.py 2018-06-27 18:47:21.848896952 -0600
@@ -1,5 +1,5 @@
from __future__ import print_function, division
-import collections
+import collections.abc
from sympy import Basic
@@ -100,13 +100,13 @@ class NDimArray(object):
def _setter_iterable_check(self, value):
from sympy.matrices.matrices import MatrixBase
- if isinstance(value, (collections.Iterable, MatrixBase, NDimArray)):
+ if isinstance(value, (collections.abc.Iterable, MatrixBase, NDimArray)):
raise NotImplementedError
@classmethod
def _scan_iterable_shape(cls, iterable):
def f(pointer):
- if not isinstance(pointer, collections.Iterable):
+ if not isinstance(pointer, collections.abc.Iterable):
return [pointer], ()
result = []
@@ -131,7 +131,7 @@ class NDimArray(object):
shape = iterable.shape
iterable = list(iterable)
# Construct N-dim array from an iterable (numpy arrays included):
- elif shape is None and isinstance(iterable, collections.Iterable):
+ elif shape is None and isinstance(iterable, collections.abc.Iterable):
iterable, shape = cls._scan_iterable_shape(iterable)
# Construct N-dim array from a Matrix:
@@ -310,7 +310,7 @@ class NDimArray(object):
def __mul__(self, other):
from sympy.matrices.matrices import MatrixBase
- if isinstance(other, (collections.Iterable,NDimArray, MatrixBase)):
+ if isinstance(other, (collections.abc.Iterable,NDimArray, MatrixBase)):
raise ValueError("scalar expected, use tensorproduct(...) for tensorial product")
other = sympify(other)
result_list = [i*other for i in self]
@@ -319,7 +319,7 @@ class NDimArray(object):
def __rmul__(self, other):
from sympy.matrices.matrices import MatrixBase
- if isinstance(other, (collections.Iterable,NDimArray, MatrixBase)):
+ if isinstance(other, (collections.abc.Iterable,NDimArray, MatrixBase)):
raise ValueError("scalar expected, use tensorproduct(...) for tensorial product")
other = sympify(other)
result_list = [other*i for i in self]
@@ -328,7 +328,7 @@ class NDimArray(object):
def __div__(self, other):
from sympy.matrices.matrices import MatrixBase
- if isinstance(other, (collections.Iterable,NDimArray, MatrixBase)):
+ if isinstance(other, (collections.abc.Iterable,NDimArray, MatrixBase)):
raise ValueError("scalar expected")
other = sympify(other)
result_list = [i/other for i in self]
--- python3/sympy/tensor/indexed.py.orig 2017-07-26 16:46:12.000000000 -0600
+++ python3/sympy/tensor/indexed.py 2018-06-27 18:48:03.513804692 -0600
@@ -107,7 +107,7 @@ matrix element ``M[i, j]`` as in the fol
from __future__ import print_function, division
-import collections
+import collections.abc
from sympy.core.sympify import _sympify
from sympy.functions.special.tensor_functions import KroneckerDelta
@@ -153,7 +153,7 @@ class Indexed(Expr):
raise TypeError(filldedent("""
Indexed expects string, Symbol, or IndexedBase as base."""))
args = list(map(sympify, args))
- if isinstance(base, (NDimArray, collections.Iterable, Tuple, MatrixBase)) and all([i.is_number for i in args]):
+ if isinstance(base, (NDimArray, collections.abc.Iterable, Tuple, MatrixBase)) and all([i.is_number for i in args]):
if len(args) == 1:
return base[args[0]]
else:
@@ -376,7 +376,7 @@ class IndexedBase(Expr, NotIterable):
pass
elif isinstance(label, (MatrixBase, NDimArray)):
return label
- elif isinstance(label, collections.Iterable):
+ elif isinstance(label, collections.abc.Iterable):
return _sympify(label)
else:
label = _sympify(label)