コード例 #1
0
def counted_init(init):
    if isShowMemory():
        def wrapped_init(self, *args, **kw):
            name = self.__class__.__name__
            assert type(name) is str

            if name not in counted_inits:
                counted_inits[name] = 0

            counted_inits[name] += 1

            init(self, *args, **kw)

        return wrapped_init
    else:
        return init
コード例 #2
0
def counted_init(init):
    if isShowMemory():
        def wrapped_init(self, *args, **kw):
            name = self.__class__.__name__
            assert type(name) is str

            if name not in counted_inits:
                counted_inits[name] = 0

            counted_inits[name] += 1

            init(self, *args, **kw)

        return wrapped_init
    else:
        return init
コード例 #3
0
def counted_del(del_func = empty_del):
    if isShowMemory():
        def wrapped_del(self):
            # This cannot be necessary, because in program finalization, the
            # global variables were assign to None.
            if counted_dels is None:
                return

            name = self.__class__.__name__
            assert type(name) is str

            if name not in counted_dels:
                counted_dels[name] = 0

            counted_dels[name] += 1

            if del_func is not empty_del:
                del_func(self)

        return wrapped_del
    else:
        return empty_del
コード例 #4
0
def counted_del(del_func = empty_del):
    if isShowMemory():
        def wrapped_del(self):
            # This cannot be necessary, because in program finalization, the
            # global variables were assign to None.
            if counted_dels is None:
                return

            name = self.__class__.__name__
            assert type(name) is str

            if name not in counted_dels:
                counted_dels[name] = 0

            counted_dels[name] += 1

            if del_func is not empty_del:
                del_func(self)

        return wrapped_del
    else:
        return empty_del
コード例 #5
0
ファイル: InstanceCounters.py プロジェクト: txf626/Nuitka
def counted_del():
    assert isShowMemory()

    return _wrapped_del
コード例 #6
0
ファイル: InstanceCounters.py プロジェクト: txf626/Nuitka
def isCountingInstances():
    return isShowMemory()