From d399d6c0d75f974bc00dbd2d432116096756a788 Mon Sep 17 00:00:00 2001 From: Jim Pivarski Date: Sun, 17 Jun 2018 16:29:36 +0200 Subject: [PATCH] numpy.divmod is too new for some systems --- appveyor.yml | 2 +- awkward/jagged.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index e6de92c8..ddbce40c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -44,5 +44,5 @@ install: - "python --version" build_script: - - "pip install numpy meta --user" + - "pip install numpy --user" - "python setup.py test" diff --git a/awkward/jagged.py b/awkward/jagged.py index 9b50de81..b296a9cc 100644 --- a/awkward/jagged.py +++ b/awkward/jagged.py @@ -273,7 +273,12 @@ def __setitem__(self, where, what): buf[startpos:stoppos] = what elif len(starts) != 0: - startposes, offsets = numpy.divmod(starts, self._dtype.itemsize) + if hasattr(numpy, "divmod"): + startposes, offsets = numpy.divmod(starts, self._dtype.itemsize) + else: + startposes = numpy.floor_divide(starts, self._dtype.itemsize) + offsets = numpy.remainder(starts, self._dtype.itemsize) + stopposes = numpy.floor_divide(stops, self._dtype.itemsize) if isinstance(what, JaggedArray):