Beispiel #1
0
def read(location, config=DefaultConfig()):
    if not os.path.exists(location):
        raise ValueError("Location must exist")

    if os.path.isdir(location):
        replays = list()
        for location in os.list_files(location):
            replays.extend(read(location, config))
        return replays
    else:
        return read_file(location, config)
Beispiel #2
0
    def from_dir(cls, directory, pattern=LOGNAME_PATTERN):
        '''Alternative constructor. Takes a directory
        and puts the files in it which match the pattern
        in the from_files constructor.
        '''

        files = []
        for filename in os.list_files('./%s' % directory):
            if re.match(pattern, filename):
                files.append(filename)
        return cls.from_files(files)
Beispiel #3
0
def read(location,config=DefaultConfig()):
    if not os.path.exists(location):
        raise ValueError("Location must exist")
    
    if os.path.isdir(location):
        replays = list()
        for location in os.list_files(location):
            replays.extend(read(location,config))
        return replays
    else:
        return read_file(location,config)