def parse(self, resource: Resource, content: str) -> ParserInfo: resource.children = deque() info = ParserInfo(description='Directory', expiration_time='never expires') n = 0 for fn in find_matching_files(content, self.extensions): child_opts = resource.opts.copy(update={'alias': None}) resource.add_child("file://" + fn, child_opts) n += 1 if n == 0: raise IOError("no entities found in {}".format(content)) resource.never_expires = True resource.expire_time = None resource.last_seen = utc_now().replace(microsecond=0) return info
def setUp(self): self.imagedir = resource_filename('images', 'test/data') self.files = [fn for fn in find_matching_files(self.imagedir, ['png', 'gif', 'jpeg', 'jpg', 'ico', 'svg'])]