Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if isinstance(v, np.ndarray):
node.add(name, NumpyArrayNode(v.shape, _format_dtype(v.dtype)))
else:
node.add(name, ValueNode(v))
if (level._v_title.startswith('list:') or
level._v_title.startswith('tuple:')):
s = level._v_title.split(':', 1)[1]
N = int(s)
lst = ListNode(typename=level._v_title.split(':')[0])
for i in range(N):
t = node.children['i{}'.format(i)]
lst.append(t)
return lst
elif level._v_title.startswith('nonetype:'):
return ValueNode(None)
elif is_pandas_dataframe(level):
pandas_type = level._v_attrs['pandas_type']
if raw:
# Treat as regular dictionary
pass
elif pandas_type == 'frame':
shape = _pandas_shape(level)
new_node = PandasDataFrameNode(shape)
return new_node
elif pandas_type == 'series':
try:
values = level._v_children['values']
size = len(values)
dtype = values.dtype
except:
size = None
for name in level._v_attrs._f_list():
v = level._v_attrs[name]
if name == DEEPDISH_IO_VERSION_STR:
node.header['dd_io_version'] = v
if name == DEEPDISH_IO_UNPACK:
node.header['dd_io_unpack'] = v
if name.startswith(DEEPDISH_IO_PREFIX):
continue
if isinstance(v, np.ndarray):
node.add(name, NumpyArrayNode(v.shape, _format_dtype(v.dtype)))
else:
node.add(name, ValueNode(v))
if (level._v_title.startswith('list:') or
level._v_title.startswith('tuple:')):
s = level._v_title.split(':', 1)[1]
N = int(s)
lst = ListNode(typename=level._v_title.split(':')[0])
for i in range(N):
t = node.children['i{}'.format(i)]
lst.append(t)
return lst
elif level._v_title.startswith('nonetype:'):
return ValueNode(None)
elif is_pandas_dataframe(level):
pandas_type = level._v_attrs['pandas_type']
if raw:
# Treat as regular dictionary