harbor run -t openthoughts/tasktrove-mix-h8-adversarial-tests-v2-mix-h8-adversarial-3433harbor download openthoughts/tasktrove-mix-h8-adversarial-tests-v2-mix-h8-adversarial-3433Task: Implement a minimal Django template extractor in a Python package located at /app/babel/
Overview: Create a self-contained Babel-like extraction module that can read a Django template from a file-like object and yield translation entries in the same shape the tests expect. The implementation must live inside /app/babel/ as a package (not a single file Babel module), so imports like from babel.messages import extract work correctly.
What to implement:
A variable DEFAULT_KEYWORDS that the tests will import as extract.DEFAULT_KEYWORDS. It can be an empty list or set (use a simple empty list for compatibility).
A function with the signature: def extract(format, fh, keywords, comments, options): ... yield (lineno, msgid, msg, comments, flags)
The function must be able to parse a Django template string provided via a file-like object fh (the tests use BytesIO).
Behavior for Django template patterns:
Translate tag: {% translate "foo" %} should yield a message with:
Translate with variables inside: {% translate "foo {{bar}}" %} should yield:
Blocktranslate (not trimmed): {% blocktranslate %} foo {% endblocktranslate %} should yield:
Blocktranslate with trimmed option: {% blocktranslate trimmed %} foo {{bar}} {% endblocktranslate %} should yield:
The exception/edge behavior is not required beyond what tests exercise; your implementation can conservatively handle only the patterns above.
Notes: