How to use the omas.omas_hdc.HDC function in omas

To help you get started, we’ve selected a few omas examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gafusion / omas / omas / omas_hdc.py View on Github external
: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
github gafusion / omas / omas / omas_hdc.py View on Github external
# 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
github gafusion / omas / omas / omas_hdc.py View on Github external
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