Skip to content

Conversation

@alexisylee
Copy link

This PR adds BagIt validation and compilation functionalities as well as a test suite testing it.

Included:

BagIt validator that validates: if file root exists, if file referenced exists, that all files in FileRoot must have corresponding tags, and if all files are readable
BagIt compiler that creates a .zip with: metadata files, manifest.txt, bag-info.txt, metadata.mfd, and metadata.json files
Test cases for all data provenance tokens and error cases.
Input .mfd files for testing.
Expected output Bags for validation
Test runner script and setup utilities
Run the test suite with python3 bagit_testsuite/bagit_testsuite_driver.py.

with open(bag_info_path, 'w', encoding='utf-8') as f:
for line in bag_info_lines:
f.write(line + '\n')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Run Flake8 on all files to catch inconsistent formatting.


def get_content(self, resolved_macros: Dict[str, str]) -> str :
out = self.headline.get_content(resolved_macros)
# print(f"Call stack: {traceback.format_stack()}", file=sys.stderr)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if DEBUG

assert L is not None
confirmed_lines.append(L)

lc : LineCollector = LineCollector(confirmed_lines)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this deal with the issue of the LineCollector TODO comment seen previously?

@alvacouch
Copy link

In general, now would be a good time to delete any file that became unused. Flake8 will tell you.

write_json=args.write_json,
output_path="."
)
>>>>>>> 90ea795 (halfway done with bagit handler)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

json.dump(self.dict_data, f, indent=2)
combined_data = process_blocks_to_dict(self.blocks)
json.dump(combined_data, f, indent=2)
hello
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

@infispiel
Copy link
Member

Have you checked if the medford command actually works with your changes? I've already found 2 locations that should cause the entire program not to compile.

@infispiel infispiel changed the base branch from main to dev August 8, 2025 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants