

def most_common_types(limit=10, objects=None, shortnames=True):
    "Count the names of types with the most instances.\n\n    Returns a list of (type_name, count), sorted most-frequent-first.\n\n    Limits the return value to at most ``limit`` items.  You may set ``limit``\n    to None to avoid that.\n\n    The caveats documented in :func:`typestats` apply.\n\n    Example:\n\n        >>> most_common_types(limit=2)\n        [('list', 12041), ('tuple', 10245)]\n\n    .. versionadded:: 1.4\n\n    .. versionchanged:: 1.7\n       New parameter: ``objects``.\n\n    .. versionchanged:: 1.8\n       New parameter: ``shortnames``.\n\n    "
    stats = sorted(typestats(objects, shortnames=shortnames).items(), key=operator.itemgetter(1), reverse=True)
    if limit:
        stats = stats[:limit]
    return stats

dataset/ETHPy150Open Exa-Networks/exabgp/lib/exabgp/dep/objgraph.py most_common_types/original