|
8 | 8 |
|
9 | 9 | from docx.enum.style import WD_STYLE_TYPE |
10 | 10 | from docx.oxml.ns import qn |
| 11 | +from docx.oxml.parser import OxmlElement |
| 12 | +from docx.oxml.text.run import CT_R |
| 13 | +from docx.revision import TrackedDeletion, TrackedInsertion |
11 | 14 | from docx.shared import StoryChild |
12 | 15 | from docx.styles.style import ParagraphStyle |
13 | 16 | from docx.text.hyperlink import Hyperlink |
|
19 | 22 | import docx.types as t |
20 | 23 | from docx.enum.text import WD_PARAGRAPH_ALIGNMENT |
21 | 24 | from docx.oxml.text.paragraph import CT_P |
22 | | - from docx.revision import TrackedDeletion, TrackedInsertion |
23 | 25 | from docx.styles.style import CharacterStyle |
24 | 26 |
|
25 | 27 |
|
@@ -67,9 +69,6 @@ def add_run_tracked( |
67 | 69 | Returns: |
68 | 70 | A TrackedInsertion object wrapping the `w:ins` element. |
69 | 71 | """ |
70 | | - from docx.oxml.parser import OxmlElement |
71 | | - from docx.revision import TrackedInsertion |
72 | | - |
73 | 72 | if revision_id is None: |
74 | 73 | revision_id = self._next_revision_id() |
75 | 74 |
|
@@ -176,8 +175,6 @@ def iter_inner_content( |
176 | 175 | Run, Hyperlink, TrackedInsertion, or TrackedDeletion objects in |
177 | 176 | document order. |
178 | 177 | """ |
179 | | - from docx.revision import TrackedDeletion, TrackedInsertion |
180 | | - |
181 | 178 | if include_revisions: |
182 | 179 | elements = self._p.inner_content_with_revisions |
183 | 180 | else: |
@@ -277,10 +274,6 @@ def replace_tracked( |
277 | 274 | Returns: |
278 | 275 | The number of replacements made. |
279 | 276 | """ |
280 | | - from docx.oxml.parser import OxmlElement |
281 | | - from docx.oxml.text.run import CT_R |
282 | | - from typing import cast as typing_cast |
283 | | - |
284 | 277 | count = 0 |
285 | 278 | now = dt.datetime.now(dt.timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ") |
286 | 279 |
|
@@ -367,7 +360,7 @@ def replace_tracked( |
367 | 360 | parent.insert(insert_idx, comment_end) |
368 | 361 | insert_idx += 1 |
369 | 362 |
|
370 | | - comment_ref_run = typing_cast(CT_R, OxmlElement("w:r")) |
| 363 | + comment_ref_run = cast(CT_R, OxmlElement("w:r")) |
371 | 364 | comment_ref_rPr = comment_ref_run.get_or_add_rPr() |
372 | 365 | comment_ref_rPr.style = "CommentReference" |
373 | 366 | comment_ref_run.append( |
|
0 commit comments