2022-03-27 23:05:27 +02:00

17 lines
388 B
Python

import abc
from collections import namedtuple
from typing import Iterable
ImageMetadataPair = namedtuple("ImageMetadataPair", ["image", "metadata"])
class ImageExtractor(abc.ABC):
@abc.abstractmethod
def extract(self, obj) -> Iterable[ImageMetadataPair]:
"""Extracts images from an object"""
pass
def __call__(self, obj):
return self.extract(obj)