Skip to content

Conversation

@jrherskovic-mda
Copy link

No description provided.

scanny added 25 commits April 29, 2024 15:54
No need for two, use the already modernized `docx.shared.lazyproperty`.
Use XPath rather than oxml structures.
This property was formerly known as `._grid_col` but that didn't account for `.grid_before` in the computation.
This method was formerly named `.tc_at_grid_col()`. New implementation takes `CT_Tr.grid_before` into account.
The original implementation of `_Row.cells` did not take into account the fact that rows could include unoccupied grid cells at the beginning and/or end of the row. This "advanced" feature of tables is sometimes used by the Word table layout algorithm when the user does not carefully align the right boundary of cells during resizing, so while quite unusual to be used on purpose, this arises with some frequency in human-authored documents in the wild. The prior implementation of `_Row.cells` assumed that `Table.cells()` was uniform and the cells for a row could be reliably be computed from the table column-count and row and column offsets. That assumption does not always hold and can raise `IndexError` when omitted cells are present. This reimplementation remedies that situation. As a side-effect it should also perform much better when reading large tables.
`lxml` won't install on Apple Silicon after `4.9.2`. Dropping testing for Python 3.7.
`.rel_ref_count()` as implemented was only applicable to `XmlPart` where references to a related part could be present in the XML. Longer term it probably makes sense to override `Part.drop_rel()` in `XmlPart` and not have a `_rel_ref_count()` method in `part` at all, but this works and is less potentially disruptive.
Looks like this cure is worse than the disease. While it may ease installation on Apple Silicon in some instances, it breaks installation on Python 3.12. Pull this pin and we'll just have to live with troublesome `lxml` install on certain Mac/version combinations.
Sign up for freeto 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.

2 participants

@jrherskovic-mda@scanny