Mentions légales du service

Skip to content
Snippets Groups Projects
Commit cac357d8 authored by CERUTTI Guillaume's avatar CERUTTI Guillaume
Browse files

also avoid deprecation warnings for ragged sequences array

parent e63e2f07
Branches
Tags
1 merge request!4NumPy warnings + verbosity updates
import warnings
import numpy as np
from scipy import ndimage as nd
......@@ -10,6 +12,7 @@ def isiterable(obj):
def make_values_array(values, has_keys:bool=False):
warnings.filterwarnings("error", category=np.VisibleDeprecationWarning)
is_ragged = False
try:
if isinstance(values,dict):
......@@ -23,7 +26,7 @@ def make_values_array(values, has_keys:bool=False):
vls = np.array(list(values))
else:
vls = np.array([values])
except ValueError:
except (ValueError, np.VisibleDeprecationWarning):
is_ragged = True
if isinstance(values,dict):
vls = np.array(list(values.values()), dtype=object)
......@@ -36,6 +39,8 @@ def make_values_array(values, has_keys:bool=False):
vls = np.array(list(values), dtype=object)
else:
vls = np.array([values], dtype=object)
warnings.resetwarnings()
return vls, is_ragged
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment