Skip to content

fix(exceptions): rename InvalidDatasetError.format to data_format#191

Merged
bityodha merged 2 commits into
mainfrom
fix/70-invalid-dataset-error-format-shadow
Jul 17, 2026
Merged

fix(exceptions): rename InvalidDatasetError.format to data_format#191
bityodha merged 2 commits into
mainfrom
fix/70-invalid-dataset-error-format-shadow

Conversation

@himanshu231204

Copy link
Copy Markdown
Member

Summary

Resolves #70. InvalidDatasetError declared a constructor parameter named format, which shadows Python's built-in format(). This is a code-quality/footgun issue flagged by linters and confuses readers who expect format to be the builtin.

The parameter (and its self.format attribute) is renamed to data_format across the exception definition and every call site. The details dict key remains "format" since it is only a string payload key, not a Python identifier, so there is no shadowing concern and no change to the serialized error output.

Changes

  • openagent_eval/exceptions/dataset.py — rename format param/attribute/docstring to data_format.
  • openagent_eval/datasets/factory.py — update data_format=config.format kwarg.
  • openagent_eval/datasets/json_loader.py, jsonl_loader.py, csv_loader.py, hf_loader.py, pdf_loader.py — update data_format= kwargs at all raise sites.
  • tests/unit/test_exceptions.py — update the InvalidDatasetError test to use data_format=.

Testing

  • pytest tests/unit/test_exceptions.py — 26 passed.
  • pytest tests/unit/test_datasets — 83 passed. (The 4 test_pdf_loader failures are pre-existing and environmental: pypdf is not installed in this environment. The error output confirms the new kwarg is passed correctly: InvalidDatasetError: ... (format=pdf, ...).)
  • ruff check openagent_eval/exceptions/dataset.py — all checks passed. Remaining ruff warnings in datasets/ are pre-existing and unrelated to this change.

Checklist

  • Branch created off main (fix/70-...)
  • InvalidDatasetError no longer shadows the format built-in
  • All call sites updated
  • Tests updated and passing
  • Lint clean on changed exception module

@bityodha
bityodha merged commit 1808e1e into main Jul 17, 2026
10 checks passed
@github-actions

Copy link
Copy Markdown

🎉 Congratulations @himanshu231204!

Your pull request has been successfully merged into main. 🚀

Thank you for contributing to OpenAgentHQ and helping improve the project.

We truly appreciate your contribution and hope to see you back with more amazing PRs!

Happy Open Sourcing! ❤️

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.

exceptions(dataset): InvalidDatasetError parameter ormat shadows built-in

2 participants