sverchok
sverchok copied to clipboard
sv_mesh_utils np_pols = np.array(pols) np warning
the np warning explains it. it's easy enough to fix but it may come with a penalty.
2022-06-17 10:29:54,634 [WARNING] py.warnings:
~sverchok\utils\sv_mesh_utils.py:68: VisibleDeprecationWarning:
Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays
with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object'
when creating the ndarray.
np_pols = np.array(pols)
eventually this will go from a warning to an Error. if we don't know in advance if the array is ragged, then we have to somehow do a lazy test?
def is_ragged(array):
len_set = set(len(array[0]))
for item in array:
len_set.add(len(item))
if len(len_set) > 1: return True
def is_ragged(array):
m = set(map(len, array))
return not len(m) == 1
then
params = {'dtype': object} if is_ragged(pols) else {}
np_pols = np.array(pols, **params)