<commit_before>from PandaModules import *
from DirectNotifyGlobal import *
import Interval
import types

class IntervalManager(CIntervalManager):

    # This is a Python-C++ hybrid class.  IntervalManager is a Python
    # extension of the C++ class CIntervalManager; the main purpose of
    # the Python extensions is to add support for Python-based
    # intervals (like MetaIntervals).

    def __init__(self, globalPtr = 0):
        # Pass globalPtr == 1 to the constructor to trick it into
        # "constructing" a Python wrapper around the global
        # CIntervalManager object.

        if globalPtr:
            CIntervalManager.__init__(self, None)
            cObj = CIntervalManager.getGlobalPtr()
            self.this = cObj.this
            self.userManagesMemory = 0

        else:
            CIntervalManager.__init__(self)

        self.ivals = []

    def addInterval(self, interval):
        index = self.addCInterval(interval, 1)
        self.__storeInterval(interval, index)

    def removeInterval(self, interval):
        index = self.findCInterval(interval.getName())
        if index >= 0:
            self.removeCInterval(index)
            self.ivals[index] = None
            return 1
        return 0

    def getInterval(self, name):
        index = self.findCInterval(name)
        if index >= 0:
            return self.ivals[index]
        return None

    def step(self):
        # Call C++ step, then do all the required Python post-processing.
        CIntervalManager.step(self)

        # It is important to call all of the python callbacks on the
        # just-removed intervals before we call any of the callbacks
        # on the still-running intervals.
        index = self.getNextRemoval()
        while index >= 0:
            self.ivals[index].privPostEvent()
            self.ivals[index] = None
            index = self.getNextRemoval()

        index = self.getNextEvent()
        while index >= 0:
            self.ivals[index].privPostEvent()
            index = self.getNextEvent()
        
    def __storeInterval(self, interval, index):
        while index >= len(self.ivals):
            self.ivals.append(None)
        self.ivals[index] = interval

    def __repr__(self):
        return self.__str__()

# The global IntervalManager object.
ivalMgr = IntervalManager(1)<commit_msg>oopsy<commit_after>from PandaModules import *
from DirectNotifyGlobal import *
import Interval
import types

class IntervalManager(CIntervalManager):

    # This is a Python-C++ hybrid class.  IntervalManager is a Python
    # extension of the C++ class CIntervalManager; the main purpose of
    # the Python extensions is to add support for Python-based
    # intervals (like MetaIntervals).

    def __init__(self, globalPtr = 0):
        # Pass globalPtr == 1 to the constructor to trick it into
        # "constructing" a Python wrapper around the global
        # CIntervalManager object.

        if globalPtr:
            CIntervalManager.__init__(self, None)
            cObj = CIntervalManager.getGlobalPtr()
            self.this = cObj.this
            self.userManagesMemory = 0

        else:
            CIntervalManager.__init__(self)

        self.ivals = []

    def addInterval(self, interval):
        index = self.addCInterval(interval, 1)
        self.__storeInterval(interval, index)

    def removeInterval(self, interval):
        index = self.findCInterval(interval.getName())
        if index >= 0:
            self.removeCInterval(index)
            self.ivals[index] = None
            return 1
        return 0

    def getInterval(self, name):
        index = self.findCInterval(name)
        if index >= 0:
            return self.ivals[index]
        return None

    def step(self):
        # Call C++ step, then do all the required Python post-processing.
        CIntervalManager.step(self)

        # It is important to call all of the python callbacks on the
        # just-removed intervals before we call any of the callbacks
        # on the still-running intervals.
        index = self.getNextRemoval()
        while index >= 0:
            if self.ivals[index]:
                self.ivals[index].privPostEvent()
            self.ivals[index] = None
            index = self.getNextRemoval()

        index = self.getNextEvent()
        while index >= 0:
            self.ivals[index].privPostEvent()
            index = self.getNextEvent()
        
    def __storeInterval(self, interval, index):
        while index >= len(self.ivals):
            self.ivals.append(None)
        self.ivals[index] = interval

    def __repr__(self):
        return self.__str__()

# The global IntervalManager object.
ivalMgr = IntervalManager(1)
{'fraction_non_alphanumeric': 0.08223823654090716, 'fraction_numerical': 0.0046629927935565915, 'mean_word_length': 2.214577656675749, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3384139', 'n_tokens_mistral': 1269, 'n_tokens_neox': 1225, 'n_words': 383}