(pkgs, options)
return data, header
Convert the package data into something usable
    by output_package_listing_columns.
Convert the package data into something usable
    by output_package_listing_columns.
Convert the package data into something usable by output_package_listing_columns .
def format_for_columns(pkgs, options):
    """
    Convert the package data into something usable
    by output_package_listing_columns.
    """
    running_outdated = options.outdated
    # Adjust the header for the `pip list --outdated` case.
    if running_outdated:
        header = ["Package", "Version", "Latest", "Type"]
    else:
        header = ["Package", "Version"]

    data = []
    if options.verbose >= 1 or any(dist_is_editable(x) for x in pkgs):
        header.append("Location")
    if options.verbose >= 1:
        header.append("Installer")

    for proj in pkgs:
        # if we're working on the 'outdated' list, separate out the
        # latest_version and type
        row = [proj.project_name, proj.version]

        if running_outdated:
            row.append(proj.latest_version)
            row.append(proj.latest_filetype)

        if options.verbose >= 1 or dist_is_editable(proj):
            row.append(proj.location)
        if options.verbose >= 1:
            row.append(get_installer(proj))

        data.append(row)

    return data, header
def format_for_columns ( pkgs , options ) : running_outdated = options . outdated # Adjust the header for the `pip list --outdated` case. if running_outdated : header = [ "Package" , "Version" , "Latest" , "Type" ] else : header = [ "Package" , "Version" ] data = [ ] if options . verbose >= 1 or any ( dist_is_editable ( x ) for x in pkgs ) : header . append ( "Location" ) if options . verbose >= 1 : header . append ( "Installer" ) for proj in pkgs : # if we're working on the 'outdated' list, separate out the # latest_version and type row = [ proj . project_name , proj . version ] if running_outdated : row . append ( proj . latest_version ) row . append ( proj . latest_filetype ) if options . verbose >= 1 or dist_is_editable ( proj ) : row . append ( proj . location ) if options . verbose >= 1 : row . append ( get_installer ( proj ) ) data . append ( row ) return data , header