@classmethod<EOL><INDENT>def load(cls, file_path, parser=None, initial='<STR_LIT>'):<DEDENT>
if not parser:<EOL><INDENT>parser = TimesheetParser()<EOL><DEDENT>try:<EOL><INDENT>with codecs.open(file_path, '<STR_LIT:r>', '<STR_LIT:utf-8>') as timesheet_file:<EOL><INDENT>contents = timesheet_file.read()<EOL><DEDENT><DEDENT>except IOError:<EOL><INDENT>if callable(initial):<EOL><INDENT>contents = initial()<EOL><DEDENT>else:<EOL><INDENT>contents = initial<EOL><DEDENT><DEDENT>entries = EntriesCollection(parser, contents)<EOL>timesheet = cls(entries)<EOL>timesheet.file_path = file_path<EOL>return timesheet<EOL>
Load the timesheet file located in `file_path`. If `parser` is not set,
:class:`~taxi.timesheet.parser.TimesheetParser` will be used. If the file doesn't exist, an empty timesheet
will be returned. If the file exists and its contents are not a valid timesheet,
:exc:`~taxi.timesheet.parser.ParseError` will be raised.