gtaylor / python-colormath

A python module that abstracts common color math operations. For example, converting from CIE L*a*b to XYZ, or from RGB to CMYK
python-colormath.readthedocs.org
BSD 3-Clause "New" or "Revised" License
456 stars 82 forks source link

Fix DeprecationWarning #96

Closed ZipFile closed 5 years ago

ZipFile commented 5 years ago

numpy.asscalar function is deprecated since NumPy v1.16

See: https://docs.scipy.org/doc/numpy-1.16.0/release.html#new-deprecations

KelSolaar commented 5 years ago

@ZipFile : Do you know which version of Numpy ndarray.item was introduced?

KelSolaar commented 5 years ago

Looking at it, it is here since a while: https://docs.scipy.org/doc/numpy-1.3.x/reference/generated/numpy.ndarray.item.html#numpy.ndarray.item, I will merge this one as it looks quite safe.

ZipFile commented 5 years ago

Not sure when it was introduced, but:

def asscalar(a):
    return a.item()

asscalar was implemented like this since forever (https://github.com/numpy/numpy/commit/65d5f7fc7378e7d8a05125c667ae933b7a6c040f or https://github.com/numpy/numpy/commit/54a193f1a0cdd6ccf40e36d09daa9fb0dd658456 before ndarray.toscalar -> ndarray.item rename). They moved it around over time and now decided to deprecate. So this PR is about removing annoying warning.