ndio/ramon/__init__.py
def to_dict(ramons, flatten=False):
    """
    Converts a RAMON object list to a JSON-style dictionary. Useful for going
    from an array of RAMONs to a dictionary, indexed by ID.

    Arguments:
        ramons (RAMON[]): A list of RAMON objects
        flatten (boolean: False): Not implemented

    Returns:
        dict: A python dictionary of RAMON objects.
    """
    if type(ramons) is not list:
        ramons = [ramons]

    out_ramons = {}
    for r in ramons:
        out_ramons[r.id] = {
            "id": r.id,
            "type": _reverse_ramon_types[type(r)],
            "metadata": vars(r)
        }
    return out_ramons
def to_dict(ramons, flatten=False):
    """
    Converts a RAMON object list to a JSON-style dictionary. Useful for going
    from an array of RAMONs to a dictionary, indexed by ID.

    Arguments:
        ramons (RAMON[]): A list of RAMON objects
        flatten (boolean: False): Not implemented

    Returns:
        dict: A python dictionary of RAMON objects.
    """
    if type(ramons) is not list:
        ramons = [ramons]

    out_ramons = {}
    for r in ramons:
        out_ramons[r.id] = {
            "id": r.id,
            "type": _reverse_ramon_types[type(r)],
            "metadata": vars(r)
        }
    return out_ramons
Converts a RAMON object list to a JSON-style dictionary. Useful for going
    from an array of RAMONs to a dictionary, indexed by ID.

    Arguments:
        ramons (RAMON[]): A list of RAMON objects
        flatten (boolean: False): Not implemented

    Returns:
        dict: A python dictionary of RAMON objects.