def extract_source_params(src):
    """
    Extract params from source object.
    """
    tags = get_taglist(src)
    data = []
    for key, param, vtype in BASE_PARAMS:
        if key in src.attrib:
            if vtype == "c":
                data.append((param, src.attrib[key]))
            elif vtype == "f":
                data.append((param, float(src.attrib[key])))
            else:
                data.append((param, None))
        elif key in tags:
            if vtype == "c":
                data.append((param, src.nodes[tags.index(key)].text))
            elif vtype == "f":
                data.append((param, float(src.nodes[tags.index(key)].text)))
            else:
                data.append((param, None))
        else:
            data.append((param, None))
    return dict(data)
def extract_source_params ( src ) : tags = get_taglist ( src ) data = [ ] for key , param , vtype in BASE_PARAMS : if key in src . attrib : if vtype == "c" : data . append ( ( param , src . attrib [ key ] ) ) elif vtype == "f" : data . append ( ( param , float ( src . attrib [ key ] ) ) ) else : data . append ( ( param , None ) ) elif key in tags : if vtype == "c" : data . append ( ( param , src . nodes [ tags . index ( key ) ] . text ) ) elif vtype == "f" : data . append ( ( param , float ( src . nodes [ tags . index ( key ) ] . text ) ) ) else : data . append ( ( param , None ) ) else : data . append ( ( param , None ) ) return dict ( data )
Extract params from source object.