예제 #1
0
파일: wikiFG.py 프로젝트: netvor/fhwcs
def wikiFG(num=10,prefix=False):
  goals=list()
  for ms in unmarshalMatches('parsed/match%02d.pkl'):
    if ms.hasResults:
      goals += ms.goals()

  print '\n\n==== Fastest goal ====\n'.encode('utf-8')
  print wikiFGheader(prefix).encode('utf-8')

  for (minute,team) in sorted(goals, key=itemgetter(0))[:num]:
    print wikiFGrow(team,minute,prefix).encode('utf-8')
예제 #2
0
파일: wikiMYCPG.py 프로젝트: netvor/fhwcs
def wikiMYCPG(num=10,prefix=False):
  matches=list()
  for ms in unmarshalMatches('parsed/match%02d.pkl'):
    if ms.hasResults:
      ms.totalCards = ms.homeCards[3]+ms.awayCards[3]
      matches.append(ms)

  print '\n\n==== Most yellow cards per game ====\n'.encode('utf-8')
  print wikiMYCPGheader(prefix).encode('utf-8')

  for ms in list(sorted( sorted(matches,key=lambda x:x.when_tm()) ,key=attrgetter('totalCards'), reverse=True))[:num]:
    print wikiMYCPGrow(ms,prefix).encode('utf-8')
예제 #3
0
파일: wikiMYCIGS.py 프로젝트: netvor/fhwcs
def wikiMYCIGS(num=10,prefix=False):
  cards=dict()
  for ms in unmarshalMatches('parsed/match%02d.pkl',48):
    if ms.hasResults:
      for team in [ms.homeWiki(), ms.awayWiki()]: 
        if team not in cards: cards[team] = (0,0,0,0)
      cards[ms.homeWiki()] = tuple( old+new for old,new in zip(cards[ms.homeWiki()],ms.homeCards) )
      cards[ms.awayWiki()] = tuple( old+new for old,new in zip(cards[ms.awayWiki()],ms.awayCards) )

  print '\n\n==== Most yellow cards in group stage ====\n'.encode('utf-8')
  print wikiMYCIGSheader(prefix).encode('utf-8')

  for (team,[yellow,yyr,red,total]) in list(reversed(sorted(cards.items(),key=lambda f:f[1][3])))[:num]:
    print wikiMYCIGSrow(team,yellow,yyr,red,total,prefix).encode('utf-8')
예제 #4
0
파일: wikiMGPG.py 프로젝트: netvor/fhwcs
def wikiMGPG(num=10, prefix=False):
    matches = list()
    for ms in unmarshalMatches("parsed/match%02d.pkl"):
        if ms.hasResults:
            ms.totalGoals = len(ms.homeGoals) + len(ms.awayGoals)
            matches.append(ms)

    print "\n\n==== Most goals per game ====\n".encode("utf-8")
    print wikiMGPGheader(prefix).encode("utf-8")

    for ms in list(sorted(sorted(matches, key=lambda x: x.when_tm()), key=attrgetter("totalGoals"), reverse=True))[
        :num
    ]:
        print wikiMGPGrow(ms, prefix).encode("utf-8")
예제 #5
0
파일: wikiMGS.py 프로젝트: netvor/fhwcs
def wikiMGS(num=10,prefix=False):
  mgs=dict()
  for ms in unmarshalMatches('parsed/match%02d.pkl'):
    if ms.hasResults:
      for team in [ms.homeWiki(), ms.awayWiki()]: 
        if team not in mgs: mgs[team] = [0,0]
      mgs[ms.homeWiki()][0] += len(ms.homeGoals)
      mgs[ms.awayWiki()][0] += len(ms.awayGoals)
      mgs[ms.awayWiki()][1] -= len(ms.homeGoals)
      mgs[ms.homeWiki()][1] -= len(ms.awayGoals)

  print '\n\n==== Most goals scored ====\n'.encode('utf-8')
  print wikiMGSheader(prefix).encode('utf-8')

  for (team,goals) in list(reversed(sorted(mgs.items(), key=itemgetter(1))))[:num]:
    print wikiMGSrow(team,goals,prefix).encode('utf-8')
예제 #6
0
def wikiCAL(title='Calendar', start=1, end=64):
  matches = unmarshalMatches('parsed/match%02d.pkl', end, start)
  print ( '\n\n===== %s =====\n' % (title) ).encode('utf-8')
  print wikiCALheader().encode('utf-8')
  for ms in matches: #already sorted by match number
    print wikiCALrow(ms).encode('utf-8')