Exemplo n.º 1
0
def filter_versions(cp, versions):
    filtered = {}

    for url, version in versions:

        ''' Try to keep the most specific urls (determinted by the length) '''
        if version in filtered and len(url) < len(filtered[version]):
            continue

        ''' Remove blacklisted versions '''
        if helpers.version_blacklisted(cp, version):
            continue

        filtered[version] = url

    return [(cp, filtered[version], version) for version in filtered]
Exemplo n.º 2
0
def filter_versions(cp, versions):
    filtered = {}

    for url, version, handler, confidence in versions:

        # Try to keep the most specific urls (determinted by the length)
        if version in filtered and len(url) < len(filtered[version]):
            continue

        # Remove blacklisted versions
        if version_blacklisted(cp, version):
            continue

        filtered[version] = {
            "url": url,
            "handler": handler,
            "confidence": confidence
        }

    return [(cp, filtered[version]["url"], version,
             filtered[version]["handler"], filtered[version]["confidence"])
            for version in filtered]
Exemplo n.º 3
0
def filter_versions(cp, versions):
    filtered = {}

    for url, version, handler, confidence in versions:

        # Try to keep the most specific urls (determinted by the length)
        if version in filtered and len(url) < len(filtered[version]):
            continue

        # Remove blacklisted versions
        if helpers.version_blacklisted(cp, version):
            continue

        filtered[version] = {
            "url": url,
            "handler": handler,
            "confidence": confidence
        }

    return [
        (cp, filtered[version]["url"], version, filtered[version]["handler"],
         filtered[version]["confidence"])
        for version in filtered
    ]