Skip to content

Commit

Permalink
return True in test_get_required_content_called; do not account for N…
Browse files Browse the repository at this point in the history
…oneType return in extraction code
  • Loading branch information
jsheunis committed Mar 3, 2023
1 parent 932d211 commit 58c51e5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
5 changes: 2 additions & 3 deletions datalad_metalad/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,10 +458,9 @@ def perform_dataset_metadata_extraction(ep: ExtractionArguments,
}

# Let the extractor get the files it requires
# Handle both possibilities of bool return and Generator yield
# Handle both return possibilities of bool and Generator
res = extractor.get_required_content()

if isinstance(res, bool) or res is None:
if isinstance(res, bool):
if res is False:
yield {
"status": "impossible",
Expand Down
1 change: 1 addition & 0 deletions datalad_metalad/tests/test_extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,7 @@ def __init__(self, dataset, ref_commit, parameter):

def get_required_content(self):
self.required_content_called = True
return True

def get_id(self) -> UUID:
return UUID(int=10)
Expand Down
2 changes: 1 addition & 1 deletion docs/source/user_guide/writing-extractors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ It will be called by MetaLad prior to metadata extraction.
Its purpose is to allow the extractor to ensure that content that is required for metadata extraction is present
(relevant, for example, if some of files to be inspected may be annexed).

The function should either return a boolean value (``True | False``) or yield a ``Generator`` with
The function should either return a boolean value (``True | False``) or return a ``Generator`` with
`DataLad result records`_. In the case of a boolean value, the function should return ``True`` if
it has obtained the required content, or confirmed its presence. If it returns ``False``,
metadata extraction will not proceed. Alternatively, yielding result records provides extractors with
Expand Down

0 comments on commit 58c51e5

Please sign in to comment.