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
dataset/ETHPy150Open kayhayen/Nuitka/nuitka/utils/InstanceCounters.py/counted_del/original