Esempio n. 1
0
def compileYears():
    # This is the compiler for year-level summary data
    # This is the third compilation step.
    print('Compiling years data')
    log = Log('trapp-compile-years.log')
    log.message('Compiling years data')
    log.end()
Esempio n. 2
0
def importLineups(infile):
    # TODO: Lookup teams in a specified league and year?
    # TODO: Iterate over team list, with separate Importer for each?
    # Feedback, setup
    print('Importing lineups from ' + str(infile))
    log = Log('trapp-import-lineups.log')
    importer = ImporterLineups(infile, log)

    # Check for required fields
    requiredColumns = ([
        'Code',
        'Date',
        'H/A',
        'Opponent',
        'Score',
        'WDL',
        'Record',
        'Goals',
        'Lineup',
    ])
    importer.checkFields(requiredColumns)

    # Do the import
    importer.doImport()

    # Shutdown
    log.end()

    return True
Esempio n. 3
0
def compileTeammates():
    # This is the compiler for teammate networks
    # This is the fourth compilation step.
    print('Compiling teammates data')
    log = Log('trapp-compile-teammates.log')
    log.message('Compiling teammates data')
    c = CompilerTeammates(log)
    c.doCompile()
    log.end()
Esempio n. 4
0
def compileGames():
    # This is the compiler for game-level summary data
    # This is the first compilation step.
    print('Compiling games data')
    log = Log('trapp-compile-games.log')
    log.message('Compiling games data')
    c = CompilerGames(log)
    c.doCompile()
    log.end()
Esempio n. 5
0
def checkGames(args):
    print('Checking game counts\n')

    # Start log
    log = Log('trapp-check-games.log')
    log.message('Started')

    # Output file
    output = Log('trapp-check-games.csv')

    c = CheckerGames(log, output)
    c.checkGames()

    output.end()

    log.end()
Esempio n. 6
0
def importGames(infile):
    # Feedback, setup
    print('Importing games from ' + str(infile))
    log = Log('trapp-import-games.log')
    importer = ImporterGames(infile, log)

    # Check for required fields
    requiredColumns = ([
        'MatchTime',
        'MatchTypeID',
        'HTeamID',
        'ATeamID',
        'VenueID'
    ])
    importer.checkFields(requiredColumns)

    # Do the import
    importer.doImport()

    # Shutdown
    log.end()

    return True
Esempio n. 7
0
def importPlayers(infile):
    # Feedback, setup
    print('Importing players from ' + str(infile))
    log = Log('trapp-import-players.log')
    importer = ImporterPlayers(infile, log)

    # Check for required fields
    requiredColumns = ([
        'FirstName',
        'LastName',
        'Position',
        'DOB',
        'Hometown'
    ])
    importer.checkFields(requiredColumns)

    # Do the import
    importer.doImport()

    # Shutdown
    log.end()

    return True
Esempio n. 8
0
def importGoals(infile):
    # Feedback, setup
    print('Importing goals from ' + str(infile))
    log = Log('trapp-import-goals.log')
    importer = ImporterGoals(infile, log)

    # Check for required fields
    requiredColumns = ([
        'Code',
        'Date',
        'H/A',
        'Opponent',
        'Score',
        'Goals',
    ])
    importer.checkFields(requiredColumns)
    log.message('Required fields checked')

    # Do the import
    importer.doImport()
    log.message('Import done')

    # Shutdown
    log.end()
Esempio n. 9
0
def test_log_end():
    l = Log('test.log')
    l.end()
    assert l.file is None