<commit_before>
class RulesOfTheTechnique(object):
    
    EVERY_FOUR_POMODOROS = 4
    
    def __init__(self, pomodoroCls, shortBreakCls, longBreakCls, longBreakInterval=EVERY_FOUR_POMODOROS):
        self.Pomodoro = pomodoroCls
        self.ShortBreak = shortBreakCls
        self.LongBreak = longBreakCls
        self._completedPomodoros = 0
        self.longBreakInterval = longBreakInterval

    @property
    def longBreakInterval(self):
        return self._longBreakInterval

    @longBreakInterval.setter
    def longBreakInterval(self, newInterval):
        self._longBreakInterval = newInterval
        
    def isLongBreakTime(self):
        return self._completedPomodoros % self.longBreakInterval == 0
        
    def newTimer(self, prevTimer=None):        
        timer = self.Pomodoro()
        if prevTimer is not None:
            if isinstance(prevTimer, self.Pomodoro):
                self._completedPomodoros += 1
                if self.isLongBreakTime():
                    timer = self.LongBreak()
                else:
                    timer = self.ShortBreak()
        
        return timer
<commit_msg>Documented the purpose of the class.<commit_after>
class RulesOfTheTechnique(object):
    '''
    Encapsulates the following rules of the Pomodoro technique:
      Begin with a Pomodoro.
      After a Pomodoro, take a rest break.
      After a rest break, start a new Pomodoro.
      Usually a Pomodoro is followed by a short break, except when the long break interval is reached.
      After a decided number of Pomodoros (default=4) a long break will replace the short break.
    '''
      
    EVERY_FOUR_POMODOROS = 4
    
    def __init__(self, pomodoroCls, shortBreakCls, longBreakCls, longBreakInterval=EVERY_FOUR_POMODOROS):        
        self.Pomodoro = pomodoroCls
        self.ShortBreak = shortBreakCls
        self.LongBreak = longBreakCls
        self._completedPomodoros = 0
        self.longBreakInterval = longBreakInterval

    @property
    def longBreakInterval(self):
        return self._longBreakInterval

    @longBreakInterval.setter
    def longBreakInterval(self, newInterval):
        self._longBreakInterval = newInterval
        
    def isLongBreakTime(self):
        return self._completedPomodoros % self.longBreakInterval == 0
        
    def newTimer(self, prevTimer=None):        
        timer = self.Pomodoro()
        if prevTimer is not None:
            if isinstance(prevTimer, self.Pomodoro):
                self._completedPomodoros += 1
                if self.isLongBreakTime():
                    timer = self.LongBreak()
                else:
                    timer = self.ShortBreak()
        
        return timer

{'fraction_non_alphanumeric': 0.06386120339608711, 'fraction_numerical': 0.0033222591362126247, 'mean_word_length': 2.2223543400713437, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1678921', 'n_tokens_mistral': 781, 'n_tokens_neox': 741, 'n_words': 188}