Skip to content

Comments

refactor(chart-engine): tighten text-template XML typing#40

Merged
tmustier merged 1 commit intomainfrom
refactor/text-templates-typing-pass5
Feb 12, 2026
Merged

refactor(chart-engine): tighten text-template XML typing#40
tmustier merged 1 commit intomainfrom
refactor/text-templates-typing-pass5

Conversation

@tmustier
Copy link
Owner

Summary

Continue chart-engine typing cleanup by removing Any-based XML casts from text_templates.py and replacing them with narrow protocol-based access.

Changes

  • clean_slides/chart_engine/text_templates.py
    • removed Any/Union imports and switched to Path | None.
    • introduced local XML protocols:
      • _XmlElementLike
      • _XmlParentLike
    • replaced cast(Any, ...) usage with narrow protocol casts in:
      • load_txbody_template(...)
      • apply_txbody_template(...)
    • tightened apply_txbody_template input type from box: Any to box: object.

Why

  • keeps dynamic XML handling explicit and constrained
  • improves readability and static typing signal without behavior changes
  • aligns with ongoing strict-typing cleanup across chart/render/template code

Validation

  • .venv/bin/ruff check clean_slides tests
  • .venv/bin/pyright
  • .venv/bin/pytest -q
  • .venv/bin/pre-commit run --all-files

All green locally.

@tmustier tmustier merged commit 8447cac into main Feb 12, 2026
7 checks passed
@tmustier tmustier deleted the refactor/text-templates-typing-pass5 branch February 12, 2026 16:48
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.

1 participant