revert_json_alias.py
python
sha256:18b983389ee1b55900fcd799bfbb496552d2e3ecded9d18cefbfef188947a12e
chore: remove blob-debug test marker file
Sonnet 4.6
20 hours ago
| 1 | """Remove all --json store_const aliases inserted by add_json_alias.py. |
| 2 | |
| 3 | Strips every block of the form: |
| 4 | <var>.add_argument( |
| 5 | "--json", action="store_const", const="json", dest="fmt", |
| 6 | help="Shorthand for --format json." |
| 7 | ) |
| 8 | |
| 9 | Safe to run multiple times. |
| 10 | """ |
| 11 | from __future__ import annotations |
| 12 | |
| 13 | import pathlib |
| 14 | import re |
| 15 | |
| 16 | _COMMANDS_DIR = pathlib.Path(__file__).parent.parent / "muse" / "cli" / "commands" |
| 17 | |
| 18 | # Match the exact 4-line block the insertion script emits (any indentation). |
| 19 | _BLOCK_RE = re.compile( |
| 20 | r'\n[ \t]*\w+\.add_argument\(\n' |
| 21 | r'[ \t]+"--json", action="store_const", const="json", dest="fmt",\n' |
| 22 | r'[ \t]+help="Shorthand for --format json\."\n' |
| 23 | r'[ \t]+\)', |
| 24 | re.MULTILINE, |
| 25 | ) |
| 26 | |
| 27 | |
| 28 | def revert_file(path: pathlib.Path) -> bool: |
| 29 | original = path.read_text(encoding="utf-8") |
| 30 | cleaned, count = _BLOCK_RE.subn("", original) |
| 31 | if count: |
| 32 | path.write_text(cleaned, encoding="utf-8") |
| 33 | print(f" reverted {count} block(s) in {path.relative_to(_COMMANDS_DIR.parent.parent.parent)}") |
| 34 | return bool(count) |
| 35 | |
| 36 | |
| 37 | def main() -> None: |
| 38 | total = 0 |
| 39 | for f in sorted(_COMMANDS_DIR.rglob("*.py")): |
| 40 | if revert_file(f): |
| 41 | total += 1 |
| 42 | print(f"\n{total} file(s) reverted.") |
| 43 | |
| 44 | |
| 45 | if __name__ == "__main__": |
| 46 | main() |
File History
7 commits
sha256:18b983389ee1b55900fcd799bfbb496552d2e3ecded9d18cefbfef188947a12e
chore: remove blob-debug test marker file
Sonnet 4.6
20 hours ago
sha256:e452ad9a6ace6ccc6d875a35e06caf9da5576a970c1c36133b69a891ce5fefa8
chore: prebuild timing test
Sonnet 4.6
8 days ago
sha256:0008ab6695e3e064b3e236b24fd19e538fef6a588eb0d211622f4466d919c0b1
merge: pull staging/dev — advance to 0.2.0rc12
Sonnet 4.6
patch
10 days ago
sha256:9c33d61749fff814c5226d5386aa2af7064c2c02788594a25fdd709358132eea
fix: _PROPOSAL_PREFIX_RESOLVE_LIMIT 200 → 100 to match hub …
Sonnet 4.6
21 days ago
sha256:36c3cb3e76619d4c30a6d9bf81b5ec4ff148e30dcfed913e3114ca7b43b81c7e
fix: rename objects→blobs in push client and all stale test…
Sonnet 4.6
patch
24 days ago
sha256:c06a9b9b9fee26c68ea725b44d54b2c0a171301ce9de746d5b656617b4463a9a
fix: repair four test failures from post-migration audit
Sonnet 4.6
patch
30 days ago
sha256:1900655993c83c4107067375548a7be823e471d2515830842f1a12cba4bd3cdf
fix: unified object store migration — idempotent writes, JS…
Sonnet 4.6
minor
⚠
30 days ago