refactor(chart-render): use typed pptx access wrappers for chart ops#37
Merged
refactor(chart-render): use typed pptx access wrappers for chart ops#37
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Continue the dynamic-access cleanup by moving remaining chart-render runtime probes into
pptx_accesshelpers and updatingchart_render.pyto consume those typed wrappers.Changes
Shared helper expansions (
clean_slides/pptx_access.py)Added wrappers for chart-render paths that previously relied on
Anyand direct dynamic attribute chains:chart_xml_element(...)slide_add_chart(...)set_chart_has_legend(...)chart_series(...)chart_plots(...)chart_first_plot(...)set_plot_has_data_labels(...)plot_data_labels(...)series_points(...)point_fill_solid(...)point_fill_fore_color(...)point_line_fill_background(...)slide_size_emu(...)paragraph_font(...)set_font_size(...)chart_render.pymigrationAny-based chart handling in this module for chart insertion/mutation paths.cast(Any, slide.shapes).add_chart(...)withslide_add_chart(...)chart_frame.chartaccess withshape_chart(...)chart.has_legend = ...withset_chart_has_legend(...)chart.plots[0]+ direct data-label access withchart_first_plot(...),set_plot_has_data_labels(...),plot_data_labels(...)_elementaccess withchart_xml_element(...)in label/title XML editsslide.part.package...presentation...chain withslide_size_emu(...)getattr(...)access withparagraph_font(...)+set_font_size(...)_XmlElementLike,_XmlSettable).Tests
tests/test_pptx_access.pywith dedicated coverage for all newly introduced chart mutation/slide access helpers:Validation
.venv/bin/ruff check clean_slides tests.venv/bin/pyright.venv/bin/pytest -q.venv/bin/pre-commit run --all-filesAll green locally.