seequent / properties

An organizational aid and wrapper for validation and tab completion of class properties/traits.
http://propertiespy.rtfd.org
MIT License
18 stars 9 forks source link

properties.basic.GettableProperty.equal fail on numpy arrays on modern numpy #294

Open redhog opened 1 year ago

redhog commented 1 year ago

Comparing elements of numpy arrays of different sizes have long given deprecation warnings, and in modern numpy it fails with an exception. To handle this case, change https://github.com/seequent/properties/blob/dev/properties/basic.py#L264 to:

def equal(self, value_a, value_b):
    try:
        equal = value_a == value_b
    except:
        return False
    if hasattr(equal, '__iter__'):
        return all(equal)
    return equal