<commit_before>class TennisGame(object):
    
    def __init__(self):
        self.scoreLiterals = ("0", "15", "30", "40", "adv", "wins", "loses")
        self.playerOneProgress = 0
        self.playerTwoProgress = 0
    
    def score(self):
        return self.scoreLiterals[self.playerOneProgress] + " - " + self.scoreLiterals[self.playerTwoProgress]
        
    def playerOneScores(self):
        if self.playerTwoProgress == self.scoreLiterals.index("adv"):
            self.playerTwoProgress = self.scoreLiterals.index("40")
            return
        if self.playerOneProgress == self.scoreLiterals.index("40") and self.playerTwoProgress < self.scoreLiterals.index("30"):
            self.playerOneProgress = self.scoreLiterals.index("wins")
            self.playerTwoProgress = self.scoreLiterals.index("loses")    
        else:
            self.playerOneProgress += 1
        if self.playerOneProgress == self.scoreLiterals.index("wins"):
            self.playerTwoProgress = self.scoreLiterals.index("loses")
    
    def playerTwoScores(self):
        if self.playerOneProgress == self.scoreLiterals.index("adv"):
            self.playerOneProgress = self.scoreLiterals.index("40")
            return
        if self.playerTwoProgress == self.scoreLiterals.index("40") and self.playerOneProgress < self.scoreLiterals.index("30"):
            self.playerTwoProgress = self.scoreLiterals.index("wins")
            self.playerOneProgress = self.scoreLiterals.index("loses")
        else:
            self.playerTwoProgress += 1        
        if self.playerTwoProgress == self.scoreLiterals.index("wins"):
            self.playerOneProgress = self.scoreLiterals.index("loses")<commit_msg>refactored example, shorter and cleaner<commit_after>class TennisGame(object):
    
    def __init__(self):
        self.scoreLiterals = ("0", "15", "30", "40", "adv", "wins", "loses")
        self.playerOneProgress = 0
        self.playerTwoProgress = 0
    
    def score(self):
        return self.scoreLiterals[self.playerOneProgress] + " - " + self.scoreLiterals[self.playerTwoProgress]
        
    def playerOneScores(self):
        if self._otherPlayerLosesAdvantage(1):
            return
        elif self._playerWins(1):
            return        
        else:
            self.playerOneProgress += 1
    
    def playerTwoScores(self):
        if self._otherPlayerLosesAdvantage(2):
            return
        elif self._playerWins(2):
            return
        else:
            self.playerTwoProgress += 1                
        
    def _otherPlayerLosesAdvantage(self, player):
        if player == 1 and self.playerTwoProgress == self.scoreLiterals.index("adv"):
            self.playerTwoProgress = self.scoreLiterals.index("40")
            return True
        if player == 2 and self.playerOneProgress == self.scoreLiterals.index("adv"):
            self.playerOneProgress = self.scoreLiterals.index("40")
            return True
        return False

    def _playerWins(self, player):
        if player == 1:
            if self.playerOneProgress == self.scoreLiterals.index("40") and self.playerTwoProgress < self.scoreLiterals.index("40") \
            or self.playerOneProgress == self.scoreLiterals.index("adv"):
                self.playerOneProgress = self.scoreLiterals.index("wins")
                self.playerTwoProgress = self.scoreLiterals.index("loses")
                return True
        if player == 2:
            if self.playerTwoProgress == self.scoreLiterals.index("40") and self.playerOneProgress < self.scoreLiterals.index("40") \
            or self.playerTwoProgress == self.scoreLiterals.index("adv"):
                self.playerTwoProgress = self.scoreLiterals.index("wins")
                self.playerOneProgress = self.scoreLiterals.index("loses")
                return True
        return False


{'fraction_non_alphanumeric': 0.11249675240322161, 'fraction_numerical': 0.014029618082618862, 'mean_word_length': 2.422222222222222, 'pattern_counts': {'":': 0, '<': 7, '<?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': '6775502', 'n_tokens_mistral': 1127, 'n_tokens_neox': 1060, 'n_words': 185}