@classmethod<EOL><INDENT>def get_files(cls, file_pattern, nb_previous_files, from_date=None):<DEDENT>
date_units = ['<STR_LIT:m>', '<STR_LIT:Y>']<EOL>smallest_unit = None<EOL>if not from_date:<EOL><INDENT>from_date = datetime.date.today()<EOL><DEDENT>for date_unit in date_units:<EOL><INDENT>if ('<STR_LIT:%>' + date_unit) in file_pattern:<EOL><INDENT>smallest_unit = date_unit<EOL>break<EOL><DEDENT><DEDENT>if smallest_unit is None:<EOL><INDENT>return OrderedSet([file_pattern])<EOL><DEDENT>files = OrderedSet()<EOL>for i in range(nb_previous_files, -<NUM_LIT:1>, -<NUM_LIT:1>):<EOL><INDENT>if smallest_unit == '<STR_LIT:m>':<EOL><INDENT>file_date = months_ago(from_date, i)<EOL><DEDENT>elif smallest_unit == '<STR_LIT:Y>':<EOL><INDENT>file_date = from_date.replace(day=<NUM_LIT:1>, year=from_date.year - i)<EOL><DEDENT>files.add(file_utils.expand_date(file_pattern, file_date))<EOL><DEDENT>return files<EOL>
Return an :class:`~taxi.utils.structures.OrderedSet` of file paths expanded from `filename`, with a maximum of
`nb_previous_files`. See :func:`taxi.utils.file.expand_date` for more information about filename expansion. If
`from_date` is set, it will be used as a starting date instead of the current date.