Skip to content

Comments

refactor(typing): complete builder + inspect + overlay Any cleanup#41

Merged
tmustier merged 3 commits intomainfrom
refactor/typing-pass6-builder-inspect-overlays
Feb 12, 2026
Merged

refactor(typing): complete builder + inspect + overlay Any cleanup#41
tmustier merged 3 commits intomainfrom
refactor/typing-pass6-builder-inspect-overlays

Conversation

@tmustier
Copy link
Owner

Summary

Complete the remaining typing cleanup plan in one pass:

  1. Builder pass (chart_engine/builder.py)
  2. Inspect pass (inspect_pptx.py)
  3. Overlay pass (chart_engine/overlay_*.py)

Changes

1) Builder pass

  • clean_slides/chart_engine/builder.py
    • removed all Any usage from this module
    • introduced narrow local protocols for:
      • slide/presentation collections
      • shape/textbox/legend/title access
      • data-label access
      • XML series operations for template dLbl copying
    • replaced direct chart insertion with shared helpers:
      • slide_add_chart(...)
      • shape_chart(...)
      • chart_part_name(...)
    • replaced direct legend/data-label mutation with shared wrappers where available:
      • set_chart_has_legend(...)
      • chart_series(...)
      • chart_first_plot(...)
      • set_plot_has_data_labels(...)
      • plot_data_labels(...)
    • routed shape removal through shape_xml_element(...) + typed parent protocol

2) Inspect pass

  • clean_slides/inspect_pptx.py
    • removed local Any import/alias for XML element typing
    • now reuses shared XmlElement alias from clean_slides/xml_helpers.py

3) Overlay pass

  • clean_slides/chart_engine/overlay_bar.py
  • clean_slides/chart_engine/overlay_bar_legend.py
  • clean_slides/chart_engine/overlay_bar_segments.py
  • clean_slides/chart_engine/overlay_bar_totals_categories.py
  • clean_slides/chart_engine/overlay_waterfall.py
  • clean_slides/chart_engine/overlay_waterfall_connectors.py
  • clean_slides/chart_engine/overlay_waterfall_labels.py
  • clean_slides/chart_engine/overlay_waterfall_data_labels.py

Across these modules:

  • removed all Any usage
  • switched dynamic slide plumbing to object + explicit protocol casts
  • added typed shape protocols in modules that mutate shape fill/line
  • in overlay_waterfall_data_labels.py:
    • replaced direct _chartSpace probing with chart_xml_space(...)
    • replaced Any XML nodes with _XmlElementLike protocol-based casts

Plan completion

For targeted modules from the plan:

  • clean_slides/chart_engine/builder.py: ✅ no Any
  • clean_slides/inspect_pptx.py: ✅ no local Any
  • clean_slides/chart_engine/overlay_*.py: ✅ no Any

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 87eab57 into main Feb 12, 2026
6 checks passed
@tmustier tmustier deleted the refactor/typing-pass6-builder-inspect-overlays branch February 12, 2026 17:16
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