def _extract(self, stim):
stims = listify(stim)
with nested(*(s.get_filename() for s in stims)) as files:
with nested(*(open(f, "rb") for f in files)) as fps:
tags = self.tagger.tag_images(fps, select_classes=self.select_classes)
After Change
stims = listify(stim)
with ExitStack() as stack:
files = [stack.enter_context(s.get_filename()) for s in stims]
fps = [stack.enter_context(open(f, "rb")) for f in files]
tags = self.tagger.tag_images(fps, select_classes=self.select_classes)
extracted = []