Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add __generation__ to metadata extractors to be able to tell one from another #351

Merged
merged 3 commits into from
Mar 24, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions datalad_metalad/extractors/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ class DataOutputCategory(enum.Enum):

class MetadataExtractorBase(metaclass=abc.ABCMeta):

__generation__ = 'gen4'

@abc.abstractmethod
def extract(self,
output_location: Optional[Union[IO, str]] = None
Expand Down Expand Up @@ -243,6 +245,10 @@ class MetadataExtractor(metaclass=abc.ABCMeta):
# ATM this doesn't do anything, but inheritance from this class enables
# detection of new-style extractor API

# associated with times when metadata records collections (ds- vs cn-) were aggregated
# within `.datalad/metadata/aggregate_v1.json` .
__generation__ = 'legacy'

@abc.abstractmethod
def __call__(self,
dataset: Dataset,
Expand Down Expand Up @@ -338,6 +344,8 @@ def get_state(self, dataset):
# remove
class BaseMetadataExtractor:

__generation__ = 'legacy-legacy'

NEEDS_CONTENT = True # majority of the extractors need data content

def __init__(self, ds, paths):
Expand Down