@classmethod<EOL><INDENT>def load(cls, file_pattern, nb_previous_files=<NUM_LIT:1>, parser=None):<DEDENT>
if not parser:<EOL><INDENT>parser = TimesheetParser()<EOL><DEDENT>timesheet_files = cls.get_files(file_pattern, nb_previous_files)<EOL>timesheet_collection = cls()<EOL>for file_path in timesheet_files:<EOL><INDENT>try:<EOL><INDENT>timesheet = Timesheet.load(<EOL>file_path, parser=parser, initial=lambda: timesheet_collection.get_new_timesheets_contents()<EOL>)<EOL><DEDENT>except ParseError as e:<EOL><INDENT>e.file = file_path<EOL>raise<EOL><DEDENT>timesheet_collection.timesheets.append(timesheet)<EOL><DEDENT>if parser.add_date_to_bottom is None:<EOL><INDENT>previous_timesheet = None<EOL>for timesheet in timesheet_collection.timesheets:<EOL><INDENT>if previous_timesheet:<EOL><INDENT>previous_timesheet_top_down = previous_timesheet.entries.is_top_down()<EOL>if previous_timesheet_top_down is not None:<EOL><INDENT>timesheet.entries.parser.add_date_to_bottom = previous_timesheet_top_down<EOL><DEDENT><DEDENT>previous_timesheet = timesheet<EOL><DEDENT><DEDENT>return timesheet_collection<EOL>
Load a collection of timesheet from the given `file_pattern`. `file_pattern` is a path to a timesheet file that
will be expanded with :func:`datetime.date.strftime` and the current date. `nb_previous_files` is the number of
other timesheets to load, depending on `file_pattern` this will result in either the timesheet from the
previous month or from the previous year to be loaded. If `parser` is not set, a default
:class:`taxi.timesheet.parser.TimesheetParser` will be used.