Esempio n. 1
0
def add_player_to_team():
    if len(free_players) < 1 or len(teams) < 1:
        Console.print("Not enough players or teams generated")
    else:
        show_free_players()
        player = Utils.choose_one_from_list(free_players)
        show_teams()
        team = Utils.choose_one_from_list(teams)
        team.add_player(player)
        free_players.remove(player)
Esempio n. 2
0
def show_teams():
    if len(teams) > 0:
        print("Team List:")
        for i, team in enumerate(teams):
            print("{}. {} ({})".format(i + 1, team.name, team.nationality))
        team = Utils.choose_one_from_list(teams)
        print(team)
        print("Players:")
        for player in team.players:
            print("{}".format(player))
    else:
        Console.print("No teams available", "r")
Esempio n. 3
0
def parse(output, file_path=None):
    output_file_name = '{}.{}'.format(config['output_file_name'], output)
    Console.print('converting csv data in {}'.format(output), 'g')
    if file_path is None:
        file_path = config['default_file']

    if os.path.isfile(file_path):
        if len(pycsverter.result_list) == 0:
            parsed = import_from_csv(file_path)
            validate_dict(parsed)
        Console.print_yellow('Printing output ({}), on file {}'.format(output, output_file_name))
        OutputDumper.dump(pycsverter.result_list, output, output_file_name)
        Console.print_green('Done!')
    else:
        Console.print_red(
            'File not found in path {}, please specify a valid filePath'.format(file_path))
Esempio n. 4
0
 def default(self, line):
     Console.print('Invalid command, type "help" for a list of commands')
Esempio n. 5
0
def show_free_players():
    if len(free_players) > 0:
        for i, player in enumerate(free_players):
            print("{} . {}".format(i + 1, player))
    else:
        Console.print("No free players available", "r")
Esempio n. 6
0
 def default(self, line):
     Console.print('Invalid command, type "help" for a list of commands')