Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
:param ods: input data structure
:return: HDC container
"""
# recurrent function - check types
if isinstance(ods, ODS):
if isinstance(ods.keys(), Sequence):
# list type
# TODO implement a better check
hdc = HDC()
for value in ods:
hdc.append(save_omas_hdc(value))
else:
# mapping type
hdc = HDC()
for key, value in ods.items():
hdc[key] = save_omas_hdc(value)
else:
# primitive type
hdc = HDC(ods)
return hdc
# recurrent function - check types
if isinstance(ods, ODS):
if isinstance(ods.keys(), Sequence):
# list type
# TODO implement a better check
hdc = HDC()
for value in ods:
hdc.append(save_omas_hdc(value))
else:
# mapping type
hdc = HDC()
for key, value in ods.items():
hdc[key] = save_omas_hdc(value)
else:
# primitive type
hdc = HDC(ods)
return hdc
def save_omas_hdc(ods):
"""Convert OMAS data structure to HDC
:param ods: input data structure
:return: HDC container
"""
# recurrent function - check types
if isinstance(ods, ODS):
if isinstance(ods.keys(), Sequence):
# list type
# TODO implement a better check
hdc = HDC()
for value in ods:
hdc.append(save_omas_hdc(value))
else:
# mapping type
hdc = HDC()
for key, value in ods.items():
hdc[key] = save_omas_hdc(value)
else:
# primitive type
hdc = HDC(ods)
return hdc