Did I find the right examples for you? yes no

All Samples(165)  |  Call(164)  |  Derive(0)  |  Import(1)
getweakrefcount(object) -- return the number of weak references
to 'object'.

src/l/d/ldapdict-1.4/mrucache.py   ldapdict(Download)
 
import gc
from weakref import WeakValueDictionary, getweakrefcount, getweakrefs
 
class MRUCache(WeakValueDictionary, object):
        try:
            c = cache[i]
            print "%s, %s, %s" % (c, getweakrefcount(c), id(gc.get_referrers(c)[1]))
 
        except KeyError:
        try:
            c = cache[i]
            print "%s, %s, %s" % (c, getweakrefcount(c), id(gc.get_referrers(c)[1]))
 
        except KeyError:

src/d/r/droned-HEAD/romeo/lib/romeo/entity.py   droned(Download)
    #make sure runtime errors aren't thrown when the undelying dict is modified
    for obj in Foo.objects: #this is a generator accessing the dict
        _print("Reference Count of %s is %d" % (obj,weakref.getweakrefcount(obj)))
        _print("Preparing to delete Entity %s during Iteration" % obj)
        Foo.delete(obj) #this modifies the dict
        try:
            _print(obj) #this should throw an invalid entity error
        except InValidEntity:
            _print('Foo Entity Successfully Invalidated during Iteration')
            _print("Reference Count is now %d" % (weakref.getweakrefcount(obj),))

src/m/a/main-HEAD/External.LCA_RESTRICTED/Languages/IronPython/27/Lib/test/test_weakref.py   main(Download)
        self.assertTrue(ref1 is ref2,
                     "reference object w/out callback should be re-used")
        self.assertTrue(weakref.getweakrefcount(o) == 2,
                     "wrong weak ref count for object")
        del proxy
        self.assertTrue(weakref.getweakrefcount(o) == 1,
    def test_getweakrefcount(self):
        o = C()
        ref1 = weakref.ref(o)
        ref2 = weakref.ref(o, self.callback)
        self.assertTrue(weakref.getweakrefcount(o) == 2,
                     "got wrong number of weak reference objects")
 
        proxy1 = weakref.proxy(o)
        proxy2 = weakref.proxy(o, self.callback)
        self.assertTrue(weakref.getweakrefcount(o) == 4,
 
        del ref1, ref2, proxy1, proxy2
        self.assertTrue(weakref.getweakrefcount(o) == 0,
                     "weak reference objects not unlinked from"
                     " referent when discarded.")

src/m/a/main-HEAD/External.LCA_RESTRICTED/Languages/CPython/27/Lib/test/test_weakref.py   main(Download)
        self.assertTrue(ref1 is ref2,
                     "reference object w/out callback should be re-used")
        self.assertTrue(weakref.getweakrefcount(o) == 2,
                     "wrong weak ref count for object")
        del proxy
        self.assertTrue(weakref.getweakrefcount(o) == 1,
    def test_getweakrefcount(self):
        o = C()
        ref1 = weakref.ref(o)
        ref2 = weakref.ref(o, self.callback)
        self.assertTrue(weakref.getweakrefcount(o) == 2,
                     "got wrong number of weak reference objects")
 
        proxy1 = weakref.proxy(o)
        proxy2 = weakref.proxy(o, self.callback)
        self.assertTrue(weakref.getweakrefcount(o) == 4,
 
        del ref1, ref2, proxy1, proxy2
        self.assertTrue(weakref.getweakrefcount(o) == 0,
                     "weak reference objects not unlinked from"
                     " referent when discarded.")

src/p/l/plexnet-HEAD/third_party/generic/pypy/lib-python/2.5.2/test/test_weakref.py   plexnet(Download)
        self.assert_(ref1 is ref2,
                     "reference object w/out callback should be re-used")
        self.assert_(weakref.getweakrefcount(o) == 2,
                     "wrong weak ref count for object")
        del proxy
        self.assert_(weakref.getweakrefcount(o) == 1,
    def test_getweakrefcount(self):
        o = C()
        ref1 = weakref.ref(o)
        ref2 = weakref.ref(o, self.callback)
        self.assert_(weakref.getweakrefcount(o) == 2,
                     "got wrong number of weak reference objects")
 
        proxy1 = weakref.proxy(o)
        proxy2 = weakref.proxy(o, self.callback)
        self.assert_(weakref.getweakrefcount(o) == 4,
 
        del ref1, ref2, proxy1, proxy2
        self.assert_(weakref.getweakrefcount(o) == 0,
                     "weak reference objects not unlinked from"
                     " referent when discarded.")

src/p/l/plexnet-HEAD/third_party/generic/pypy/lib-python/modified-2.5.2/test/test_weakref.py   plexnet(Download)
        self.assert_(ref1 is ref2,
                     "reference object w/out callback should be re-used")
        self.assert_(weakref.getweakrefcount(o) == 2,
                     "wrong weak ref count for object")
        del proxy
        test_support.gc_collect()
        self.assert_(weakref.getweakrefcount(o) == 1,
    def test_getweakrefcount(self):
        o = C()
        ref1 = weakref.ref(o)
        ref2 = weakref.ref(o, self.callback)
        self.assert_(weakref.getweakrefcount(o) == 2,
                     "got wrong number of weak reference objects")
 
        proxy1 = weakref.proxy(o)
        proxy2 = weakref.proxy(o, self.callback)
        self.assert_(weakref.getweakrefcount(o) == 4,
        del ref1, ref2, proxy1, proxy2
        test_support.gc_collect()
        self.assert_(weakref.getweakrefcount(o) == 0,
                     "weak reference objects not unlinked from"
                     " referent when discarded.")

src/t/r/TrustRouter-HEAD/client/packaging/Windows/Python32/Lib/test/test_weakref.py   TrustRouter(Download)
        self.assertTrue(ref1 is ref2,
                     "reference object w/out callback should be re-used")
        self.assertTrue(weakref.getweakrefcount(o) == 2,
                     "wrong weak ref count for object")
        del proxy
        self.assertTrue(weakref.getweakrefcount(o) == 1,
    def test_getweakrefcount(self):
        o = C()
        ref1 = weakref.ref(o)
        ref2 = weakref.ref(o, self.callback)
        self.assertTrue(weakref.getweakrefcount(o) == 2,
                     "got wrong number of weak reference objects")
 
        proxy1 = weakref.proxy(o)
        proxy2 = weakref.proxy(o, self.callback)
        self.assertTrue(weakref.getweakrefcount(o) == 4,
 
        del ref1, ref2, proxy1, proxy2
        self.assertTrue(weakref.getweakrefcount(o) == 0,
                     "weak reference objects not unlinked from"
                     " referent when discarded.")

src/o/p/openvault-core-HEAD/hydra-jetty/webapps/media/WEB-INF/lib/Lib/test/test_weakref.py   openvault-core(Download)
        self.assert_(ref1 is ref2,
                     "reference object w/out callback should be re-used")
        self.assert_(weakref.getweakrefcount(o) == 2,
                     "wrong weak ref count for object")
        del proxy
        extra_collect()
        self.assert_(weakref.getweakrefcount(o) == 1,
    def test_getweakrefcount(self):
        o = C()
        ref1 = weakref.ref(o)
        ref2 = weakref.ref(o, self.callback)
        self.assert_(weakref.getweakrefcount(o) == 2,
                     "got wrong number of weak reference objects")
 
        proxy1 = weakref.proxy(o)
        proxy2 = weakref.proxy(o, self.callback)
        self.assert_(weakref.getweakrefcount(o) == 4,
        del ref1, ref2, proxy1, proxy2
        extra_collect()
        self.assert_(weakref.getweakrefcount(o) == 0,
                     "weak reference objects not unlinked from"
                     " referent when discarded.")

src/e/m/empythoned-HEAD/cpython/Lib/test/test_weakref.py   empythoned(Download)
        self.assertTrue(ref1 is ref2,
                     "reference object w/out callback should be re-used")
        self.assertTrue(weakref.getweakrefcount(o) == 2,
                     "wrong weak ref count for object")
        del proxy
        self.assertTrue(weakref.getweakrefcount(o) == 1,
    def test_getweakrefcount(self):
        o = C()
        ref1 = weakref.ref(o)
        ref2 = weakref.ref(o, self.callback)
        self.assertTrue(weakref.getweakrefcount(o) == 2,
                     "got wrong number of weak reference objects")
 
        proxy1 = weakref.proxy(o)
        proxy2 = weakref.proxy(o, self.callback)
        self.assertTrue(weakref.getweakrefcount(o) == 4,
 
        del ref1, ref2, proxy1, proxy2
        self.assertTrue(weakref.getweakrefcount(o) == 0,
                     "weak reference objects not unlinked from"
                     " referent when discarded.")

src/p/y/pytaint-HEAD/Python-2.7.5-pytaint/Lib/test/test_weakref.py   pytaint(Download)
        self.assertTrue(ref1 is ref2,
                     "reference object w/out callback should be re-used")
        self.assertTrue(weakref.getweakrefcount(o) == 2,
                     "wrong weak ref count for object")
        del proxy
        self.assertTrue(weakref.getweakrefcount(o) == 1,
    def test_getweakrefcount(self):
        o = C()
        ref1 = weakref.ref(o)
        ref2 = weakref.ref(o, self.callback)
        self.assertTrue(weakref.getweakrefcount(o) == 2,
                     "got wrong number of weak reference objects")
 
        proxy1 = weakref.proxy(o)
        proxy2 = weakref.proxy(o, self.callback)
        self.assertTrue(weakref.getweakrefcount(o) == 4,
 
        del ref1, ref2, proxy1, proxy2
        self.assertTrue(weakref.getweakrefcount(o) == 0,
                     "weak reference objects not unlinked from"
                     " referent when discarded.")

  1 | 2  Next