capybara/virtualenv/lib/python2.7/site-packages/pip/commands/search.py
def transform_hits(hits):
    """
    The list from pypi is really a list of versions. We want a list of
    packages with the list of versions stored inline. This converts the
    list from pypi into one we can use.
    """
    packages = {}
    for hit in hits:
        name = hit['name']
        summary = hit['summary']
        version = hit['version']
        score = hit['_pypi_ordering']
        if score is None:
            score = 0

        if name not in packages.keys():
            packages[name] = {
                'name': name,
                'summary': summary,
                'versions': [version],
                'score': score,
            }
        else:
            packages[name]['versions'].append(version)

            # if this is the highest version, replace summary and score
            if version == highest_version(packages[name]['versions']):
                packages[name]['summary'] = summary
                packages[name]['score'] = score

    # each record has a unique name now, so we will convert the dict into a
    # list sorted by score
    package_list = sorted(
        packages.values(),
        key=lambda x: x['score'],
        reverse=True,
    )
    return package_list
def transform_hits(hits):
    packages = {}
    for hit in hits:
        name = hit['name']
        summary = hit['summary']
        version = hit['version']
        score = hit['_pypi_ordering']
        if score is None:
            score = 0

        if name not in packages.keys():
            packages[name] = {
                'name': name,
                'summary': summary,
                'versions': [version],
                'score': score,
            }
        else:
            packages[name]['versions'].append(version)

            # if this is the highest version, replace summary and score
            if version == highest_version(packages[name]['versions']):
                packages[name]['summary'] = summary
                packages[name]['score'] = score

    # each record has a unique name now, so we will convert the dict into a
    # list sorted by score
    package_list = sorted(
        packages.values(),
        key=lambda x: x['score'],
        reverse=True,
    )
    return package_list
def transform_hits ( hits ) : packages = { } for hit in hits : name = hit [ 'name' ] summary = hit [ 'summary' ] version = hit [ 'version' ] score = hit [ '_pypi_ordering' ] if score is None : score = 0 if name not in packages . keys ( ) : packages [ name ] = { 'name' : name , 'summary' : summary , 'versions' : [ version ] , 'score' : score , } else : packages [ name ] [ 'versions' ] . append ( version ) # if this is the highest version, replace summary and score if version == highest_version ( packages [ name ] [ 'versions' ] ) : packages [ name ] [ 'summary' ] = summary packages [ name ] [ 'score' ] = score # each record has a unique name now, so we will convert the dict into a # list sorted by score package_list = sorted ( packages . values ( ) , key = lambda x : x [ 'score' ] , reverse = True , ) return package_list
The list from pypi is really a list of versions. We want a list of
    packages with the list of versions stored inline. This converts the
    list from pypi into one we can use.
The list from pypi is really a list of versions . We want a list of packages with the list of versions stored inline . This converts the list from pypi into one we can use .