<commit_before># -*- coding: utf-8 -*-

from eanhlstats.interface import *
import eanhlstats.settings

def command_ts(bot, user, channel, args):
    team = get_team(args)
    if team:
        data = get_team_stats(team)
        if not data:
            bot.say(channel, 'Error in fetching data for: ' + args)
            return
    bot.say(channel, stats_of_team(data))

def command_ps(bot, user, channel, args):
    if len(args.split('@')) == 2:
        team_string = args.split('@')[1]
        player_string = args.split('@')[0]
    else:
        team_string = eanhlstats.settings.DEFAULT_TEAM    
        player_string = args
    team = get_team(team_string)
    if team:
        player = get_player(player_string, team)
        if not player:
            bot.say(channel, 'Player ' + player_string + ' not found from team: ' + team.name)
            return
    bot.say(channel, stats_of_player(player))
    
def command_switch(bot, user, channel, args):
    if eanhlstats.settings.SYSTEM == "PS3":
        eanhlstats.settings.SYSTEM = "XBX"
        bot.say(channel, 'Switched nhl stats to XBX')
    else:
        eanhlstats.settings.SYSTEM = "PS3"
        bot.say(channel, 'Switched nhl stats to PS3')
        
def command_top(bot, user, channel, args):
    team = get_team(args)
    if team:
        players = get_players(team)
        if not players:
            bot.say(channel, 'No player data found from team: ' + team.name)
            return
    bot.say(channel, top_players(players, 5))
    
def _get_team(team_name):
    team = get_team(team_name)
    if not team:
        bot.say(channel, 'Team not found: ' + team_string)
        return None
    else:
        return team
        <commit_msg>fix bot module<commit_after># -*- coding: utf-8 -*-

from eanhlstats.interface import *
import eanhlstats.settings

def command_ts(bot, user, channel, args):
    team = get_team(args)
    if team:
        data = get_team_stats(team)
        if not data:
            bot.say(channel, 'Error in fetching data for: ' + args)
            return
        bot.say(channel, stats_of_team(data))
    else:
        bot.say(channel, 'Team not found: ' + args)
    

def command_ps(bot, user, channel, args):
    if len(args.split('@')) == 2:
        team_string = args.split('@')[1]
        player_string = args.split('@')[0]
    else:
        team_string = eanhlstats.settings.DEFAULT_TEAM    
        player_string = args
    team = get_team(team_string)
    if team:
        player = get_player(player_string, team)
        if not player:
            bot.say(channel, 'Player ' + player_string + ' not found from team: ' + team.name)
            return
        bot.say(channel, stats_of_player(player))
    else:
        bot.say(channel, 'Team not found: ' + team_string)
    
def command_switch(bot, user, channel, args):
    if eanhlstats.settings.SYSTEM == "PS3":
        eanhlstats.settings.SYSTEM = "XBX"
        bot.say(channel, 'Switched nhl stats to XBX')
    else:
        eanhlstats.settings.SYSTEM = "PS3"
        bot.say(channel, 'Switched nhl stats to PS3')
        
def command_top(bot, user, channel, args):
    team = get_team(args)
    if team:
        players = get_players(team)
        if not players:
            bot.say(channel, 'No player data found from team: ' + team.name)
            return
        bot.say(channel, top_players(players, 5))
    else:
        bot.say(channel, 'Team not found: ' + args)        
{'fraction_non_alphanumeric': 0.11554132712456344, 'fraction_numerical': 0.004656577415599534, 'mean_word_length': 2.3499025341130606, 'pattern_counts': {'":': 2, '<': 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': '2628785', 'n_tokens_mistral': 1117, 'n_tokens_neox': 1110, 'n_words': 279}