

def count(typename, objects=None):
    "Count objects tracked by the garbage collector with a given class name.\n\n    Example:\n\n        >>> count('dict')\n        42\n        >>> count('MyClass', get_leaking_objects())\n        3\n        >>> count('mymodule.MyClass')\n        2\n\n    Note that the GC does not track simple objects like int or str.\n\n    .. versionchanged:: 1.7\n       New parameter: ``objects``.\n\n    .. versionchanged:: 1.8\n       Accepts fully-qualified type names (i.e. 'package.module.ClassName')\n       as well as short type names (i.e. 'ClassName').\n\n    "
    if (objects is None):
        objects = gc.get_objects()
    try:
        if ('.' in typename):
            return sum((1 for o in objects if (_long_typename(o) == typename)))
        else:
            return sum((1 for o in objects if (_short_typename(o) == typename)))
    finally:
        del objects

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