diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f333e761d5568ba256c3d5c48a2c6dfd6f4660b5..61ee1aff15b3aee0a869902a09b3bba73eaa676d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -21,7 +21,7 @@ tests-and-coverage: - mkdir -p ~/.config/matplotlib - echo "backend:template" > ~/.config/matplotlib/matplotlibrc - mkdir public - - py.test -v -n $NUM_CORES --cov-report html --cov-report term --cov=. -m "not longrun" --html test-report/index.html --junitxml=report.xml + - py.test -v -n $NUM_CORES --cov-report html --cov-report xml --cov-report term --cov=. -m "not longrun" --html test-report/index.html --junitxml=report.xml - python3 -m coverage xml tags: - docker diff --git a/doc/conf.py b/doc/conf.py old mode 100644 new mode 100755 index c230cc945b3e58403af84146081aea79e83ca6c7..c493f806640eba010d1afee128b9bcd3ee5add3e --- a/doc/conf.py +++ b/doc/conf.py @@ -33,7 +33,7 @@ version = re.sub(r'(\d+\.\d+)\.\d+(.*)', r'\1\2', pystencils.__version__) version = re.sub(r'(\.dev\d+).*?$', r'\1', version) # The full version, including alpha/beta/rc tags. release = pystencils.__version__ -language = None +language = 'en' exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '**.ipynb_checkpoints'] default_role = 'any' pygments_style = 'sphinx' diff --git a/pystencils/stencil.py b/pystencils/stencil.py index 10925735a868a34297d566d4fa4e14736e727992..73ecb15713a54a5a5da3bbe68a8368699bb9145d 100644 --- a/pystencils/stencil.py +++ b/pystencils/stencil.py @@ -341,7 +341,7 @@ def plot_2d(stencil, axes=None, figure=None, data=None, textsize='12', **kwargs) for direction, annotation in zip(stencil, data): assert len(direction) == 2, "Works only for 2D stencils" direction = tuple(int(i) for i in direction) - if not(direction[0] == 0 and direction[1] == 0): + if not (direction[0] == 0 and direction[1] == 0): axes.arrow(0, 0, direction[0], direction[1], head_width=0.08, head_length=head_length, color='k') if isinstance(annotation, sp.Basic): diff --git a/pystencils/typing/utilities.py b/pystencils/typing/utilities.py index da40c510ef91c7ca7fee0e6a0259b3eef50f0ab8..223da701a4d5c133715eb30f99366c44b13f16b2 100644 --- a/pystencils/typing/utilities.py +++ b/pystencils/typing/utilities.py @@ -187,18 +187,15 @@ def get_type_of_expression(expr, # Fix for sympy versions from 1.9 sympy_version = sp.__version__.split('.') -if int(sympy_version[0]) * 100 + int(sympy_version[1]) >= 109: +sympy_version_int = int(sympy_version[0]) * 100 + int(sympy_version[1]) +if sympy_version_int >= 109: # __setstate__ would bypass the contructor, so we remove it - sp.Number.__getstate__ = sp.Basic.__getstate__ - del sp.Basic.__getstate__ - - class FunctorWithStoredKwargs: - def __init__(self, func, **kwargs): - self.func = func - self.kwargs = kwargs - - def __call__(self, *args): - return self.func(*args, **self.kwargs) + if sympy_version_int >= 111: + del sp.Basic.__setstate__ + del sp.Symbol.__setstate__ + else: + sp.Number.__getstate__ = sp.Basic.__getstate__ + del sp.Basic.__getstate__ # __reduce_ex__ would strip kwargs, so we override it def basic_reduce_ex(self, protocol): @@ -210,9 +207,7 @@ if int(sympy_version[0]) * 100 + int(sympy_version[1]) >= 109: state = self.__getstate__() else: state = None - return FunctorWithStoredKwargs(type(self), **kwargs), args, state - - sp.Number.__reduce_ex__ = sp.Basic.__reduce_ex__ + return partial(type(self), **kwargs), args, state sp.Basic.__reduce_ex__ = basic_reduce_ex