示例#1
0
def load_schedule(file_path):
    schedule = []
    for line in helpers.load_lines(file_path):
        teams = line.split(helpers.SEPARATOR)
        assert len(teams) % 4 == 0

        matches = chunk(teams, 4)
        schedule.append(matches)

    return schedule
def load_schedule(file_path):
    schedule = []
    for line in helpers.load_lines(file_path):
        teams = line.split(helpers.SEPARATOR)
        assert len(teams) % 4 == 0

        matches = chunk(teams, 4)
        schedule.append(matches)

    return schedule
示例#3
0
#!/usr/bin/env python

import argparse
import collections
import sys

import helpers

parser = argparse.ArgumentParser("Displays statistics about which others a team have faced")
parser.add_argument('--verbose', action='store_true', default=False)
parser.add_argument('schedule_file', help='schedule to examine')

args = parser.parse_args()

matches = []
lines = helpers.load_lines(args.schedule_file)
for line in lines:
    players = line.split('|')
    while len(players) > 4:
        matches.append(players[0:4])
        players = players[4:]
    matches.append(players[0:4])

c = collections.defaultdict(collections.Counter)

for match in matches:
    for tla in match:
        for faces in match:
            c[tla][faces] += 1

all_teams = set(c.keys())
示例#4
0
#!/usr/bin/env python
import collections
import sys

import helpers

if __name__ == "__main__":

    if len(sys.argv) != 2 or '--help' in sys.argv:
        print 'Usage: pound.py <schedule-file>'
        print '  Prints the number of matches each team has, sorted by match count'
        exit(1)

    lines = helpers.load_lines(sys.argv[1])

    c = collections.Counter()

    for match in lines:
        teams = match.split("|")
        for team in teams:
            c[team] += 1

    for line in c.most_common(300):
        print line
示例#5
0
import argparse
import collections
import sys

import helpers

parser = argparse.ArgumentParser(
    "Displays statistics about which others a team have faced")
parser.add_argument('--verbose', action='store_true', default=False)
parser.add_argument('schedule_file', help='schedule to examine')

args = parser.parse_args()

matches = []
lines = helpers.load_lines(args.schedule_file)
for line in lines:
    players = line.split('|')
    while len(players) > 4:
        matches.append(players[0:4])
        players = players[4:]
    matches.append(players[0:4])

c = collections.defaultdict(collections.Counter)

for match in matches:
    for tla in match:
        for faces in match:
            c[tla][faces] += 1

all_teams = set(c.keys())