parsing.py
def parse_gamelog(path):
    """
    parse gamelog and return list of users

    :param problemId: id (as string) of problem to process
    :param path: path to directory with logs
    :return: list of users
    """

    users = []
    firstLine = True
    currentUser = None

    with open(path, "r") as f:
        for line in f:
            if firstLine:
                # First line contains the name of the problem, which can be arbitrary and can therefore interfere
                # with conditions below. For example the problem "960" interferes with if re.match("\d",line)
                firstLine = False
                continue
            if re.search("User", line):
                uid = int(line.rstrip().split()[-1])
                currentUser = User(uid)
                users.append(currentUser)

            if re.search("Game", line):
                currentUser.games.append(Game())

            if re.match("\d", line):
                currentUser.games[-1].submits.append(Submit.parsedFromStr(line))

    return users

    parse gamelog and return list of users

    :param problemId: id (as string) of problem to process
    :param path: path to directory with logs
    :return: list of users
    
parse gamelog and return list of users
parse gamelog and return list of users
def parse_gamelog(path):
    users = []
    firstLine = True
    currentUser = None
    with open(path, "r") as f:
        for line in f:
            if firstLine:
                firstLine = False
                continue
            if re.search("User", line):
                uid = int(line.rstrip().split()[-1])
                currentUser = User(uid)
                users.append(currentUser)
            if re.search("Game", line):
                currentUser.games.append(Game())
            if re.match("\d", line):
                currentUser.games[-1].submits.append(Submit.parsedFromStr(line))
    return users
def parse_gamelog ( path ) : users = [ ] firstLine = True currentUser = None with open ( path , "r" ) as f : for line in f : if firstLine : firstLine = False continue if re . search ( "User" , line ) : uid = int ( line . rstrip ( ) . split ( ) [ - 1 ] ) currentUser = User ( uid ) users . append ( currentUser ) if re . search ( "Game" , line ) : currentUser . games . append ( Game ( ) ) if re . match ( "\d" , line ) : currentUser . games [ - 1 ] . submits . append ( Submit . parsedFromStr ( line ) ) return users
parse gamelog and return list of users
parse gamelog and return list of users
"""
    parse gamelog and return list of users

    :param problemId: id (as string) of problem to process
    :param path: path to directory with logs
    :return: list of users
    """ # First line contains the name of the problem, which can be arbitrary and can therefore interfere # with conditions below. For example the problem "960" interferes with if re.match("\d",line)
list of users
list of users
path
path to directory with logs
path to directory with logs
problemId
id (as string) of problem to process
id ( as string ) of problem to process