Пример #1
0
    book = dw.Reader(filename)

    if len(sys.argv) >= 3:
        lastdate = sys.argv[2]
    else:
        lastdate = max([x.GetDate() for x in book.Games()])

    print "CONTINENTAL BASEBALL LEAGUE OFFICIAL STATISTICS"
    print "COORDINATOR OF STATISTICAL SERVICES, THEODORE L. TUROCY, COLLEGE STATION TX -- (979) 997-0666 -- [email protected]"
    print

    print "STANDING OF CLUBS THROUGH GAMES OF %s" % lastdate

    standings = report.team.Standings(book)
    reports.process_file(book, [standings])
    reports.standings_hack(standings)
    print str(standings)

    print "FINAL FIRST-HALF STANDING OF CLUBS"

    standings = report.team.Standings(book)
    reports.process_file(book, [standings], f=lambda x: x.GetDate() < "2008/07/01")
    reports.standings_hack(standings)
    print str(standings)

    print "TEAM BATTING"
    reports.print_report(book, report.team.TeamBattingTotals(book))

    print "TEAM PITCHING"
    reports.print_report(book, report.team.TeamPitchingTotals(book))
Пример #2
0
import report.team



if __name__ == "__main__":
    import sys
    import scorebook
    import dw
    import reports

    if len(sys.argv) >= 2:
        filename = sys.argv[1]
    else:
        filename = "/users/arbiter/Documents/CBL2008/2008CBL.chw"

    book = dw.Reader(filename)

    teams = [ x for x in book.Teams() ]

    for team in teams:
        for opp in [ x for x in teams if x != team ]:
            standings = report.team.Standings(book)

            reports.process_file(book, [ standings ],
                                 f=lambda y: team.GetID() in y.GetTeams() and \
                                             opp.GetID() in y.GetTeams())
            
            print str(standings)
Пример #3
0
               stat.w, stat.l,
               ("%5.3f" % stat.pct).replace("0.", " .") if stat.pct is not None else "   - ",
               GB,
               stat.hw, stat.hl,
               stat.rw, stat.rl,
               stat.ow, stat.ol,
               stat.xw, stat.xl))
        s += '</tr>'

    if firsthalf is not None:
        s += '<tr><td colspan=9 nowrap valign=top style=background-color:#cccccc;border-bottom:1px solid #666666><b>x</b>: First-half champion.  First-half champion plus the two other teams with the best records qualify for playoffs.</td></tr>'

    s += '</table>'
    return s
    

book = dw.Reader("/users/arbiter/Documents/CBL2008/2008CBL.chw")

#secondHalf = report.team.Standings(book)
#reports.process_file(book, [secondHalf],
#                     f=lambda x: x.GetDate()>="2008/07/01")

overall = report.team.Standings(book)
reports.process_file(book, [overall])
reports.standings_hack(overall)

print html(book, overall, firsthalf="COR")



Пример #4
0
if __name__ == "__main__":
    import sys
    import scorebook
    import dw
    import reports
    import report, report.register
    
    book = dw.Reader(sys.argv[1])

    print "CONTINENTAL BASEBALL LEAGUE OFFICIAL STATISTICS"
    print "COORDINATOR OF STATISTICAL SERVICES, THEODORE L. TUROCY, COLLEGE STATION TX -- (979) 997-0666 -- [email protected]"
    print

    batting = report.register.Batting(book)
    reports.process_file(book, [batting],
                        f = lambda x: x.GetDate()>="2008/08/11")

    subrep = batting.filter(lambda x: x.pa>=10)
    subrep.sorter = lambda x,y: cmp(y.avg, x.avg)
    print str(subrep)


    pitching = report.register.Pitching(book)
    reports.process_file(book, [pitching],
                        f = lambda x: x.GetDate()>="2008/08/11")
    
    subrep = pitching.filter(lambda x: x.outs>=9)
    subrep.sorter = lambda x,y: cmp(x.era, y.era)
    print str(subrep)