vdb/lib/db.py
def build_index(index_list):
    """This function builds two index. One with just name and version the other
    including vendor (aka group) string

    :param index_list:
    :return: Normal index and vendor index
    """
    idx = {}
    vendor_idx = {}
    for d in index_list:
        min_version = d.get(
            "min_affected_version_excluding", d.get("min_affected_version_including")
        )
        max_version = d.get(
            "max_affected_version_excluding", d.get("max_affected_version_including")
        )
        if not min_version:
            min_version = "0"
        if not max_version:
            max_version = "*"
        ver_range_str = str(min_version) + "-" + str(max_version)
        curr_list = idx.get(d["name"], [])
        curr_list.append(ver_range_str)
        idx[d["name"]] = curr_list
        if d.get("vendor"):
            vendor_idx_key = d.get("vendor") + "|" + d["name"]
            vendor_list = vendor_idx.get(vendor_idx_key, [])
            vendor_list.append((ver_range_str))
            vendor_idx[vendor_idx_key] = vendor_list
    return idx, vendor_idx
This function builds two index. One with just name and version the other
    including vendor (aka group) string

    :param index_list:
    :return: Normal index and vendor index
    
This function builds two index. One with just name and version the other
including vendor (aka group) string
This function builds two index . One with just name and version the other including vendor ( aka group ) string
def build_index(index_list):
    idx = {}
    vendor_idx = {}
    for d in index_list:
        min_version = d.get(
            "min_affected_version_excluding", d.get("min_affected_version_including")
        )
        max_version = d.get(
            "max_affected_version_excluding", d.get("max_affected_version_including")
        )
        if not min_version:
            min_version = "0"
        if not max_version:
            max_version = "*"
        ver_range_str = str(min_version) + "-" + str(max_version)
        curr_list = idx.get(d["name"], [])
        curr_list.append(ver_range_str)
        idx[d["name"]] = curr_list
        if d.get("vendor"):
            vendor_idx_key = d.get("vendor") + "|" + d["name"]
            vendor_list = vendor_idx.get(vendor_idx_key, [])
            vendor_list.append((ver_range_str))
            vendor_idx[vendor_idx_key] = vendor_list
    return idx, vendor_idx
def build_index ( index_list ) : idx = { } vendor_idx = { } for d in index_list : min_version = d . get ( "min_affected_version_excluding" , d . get ( "min_affected_version_including" ) ) max_version = d . get ( "max_affected_version_excluding" , d . get ( "max_affected_version_including" ) ) if not min_version : min_version = "0" if not max_version : max_version = "*" ver_range_str = str ( min_version ) + "-" + str ( max_version ) curr_list = idx . get ( d [ "name" ] , [ ] ) curr_list . append ( ver_range_str ) idx [ d [ "name" ] ] = curr_list if d . get ( "vendor" ) : vendor_idx_key = d . get ( "vendor" ) + "|" + d [ "name" ] vendor_list = vendor_idx . get ( vendor_idx_key , [ ] ) vendor_list . append ( ( ver_range_str ) ) vendor_idx [ vendor_idx_key ] = vendor_list return idx , vendor_idx
This function builds two index.
This function builds two index .
"""This function builds two index. One with just name and version the other
    including vendor (aka group) string

    :param index_list:
    :return: Normal index and vendor index
    """
Normal index and vendor index
Normal index and vendor index
index_list
None