odfdo 3.26.0__tar.gz → 3.26.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {odfdo-3.26.0 → odfdo-3.26.2}/PKG-INFO +2 -1
- {odfdo-3.26.0 → odfdo-3.26.2}/pyproject.toml +22 -13
- {odfdo-3.26.0 → odfdo-3.26.2}/pyproject.toml.orig +26 -27
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/__init__.py +1 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/annotation.py +31 -13
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/body.py +6 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/bookmark.py +15 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/cell.py +25 -1
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/column.py +10 -2
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/config_elements.py +41 -8
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/container.py +56 -23
- odfdo-3.26.2/src/odfdo/container.py.orig +1952 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/content.py +2 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/datatype.py +33 -12
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/document.py +117 -46
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/draw_page.py +5 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/element.py +378 -192
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/element_strip.py +19 -17
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/element_typed.py +16 -6
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/elements_between.py +21 -14
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/form.py +4 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/form_controls.py +79 -3
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/form_controls_mixins.py +11 -1
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/form_properties.py +10 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/frame.py +21 -1
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/header.py +6 -1
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/image.py +5 -1
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/line_break.py +2 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/link.py +4 -1
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/list.py +15 -3
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/manifest.py +11 -2
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/master_page.py +13 -3
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/meta.py +71 -18
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/meta_auto_reload.py +4 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/meta_hyperlink_behaviour.py +3 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/meta_template.py +4 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/meta_user_defined.py +19 -5
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/mixin_dc_creator.py +2 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/mixin_dc_date.py +2 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/mixin_link.py +4 -2
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/mixin_list.py +5 -2
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/mixin_md.py +42 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/mixin_named_range.py +9 -2
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/mixin_paragraph.py +50 -18
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/mixin_paragraph_formatted.py +11 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/mixin_toc.py +8 -3
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/named_range.py +44 -15
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/note.py +18 -4
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/office_forms.py +7 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/page_layout.py +15 -1
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/paragraph.py +2 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/presentation_notes.py +1 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/reference.py +28 -3
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/row.py +36 -2
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/row_group.py +1 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/scripts/diff.py +9 -1
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/scripts/flat.py +11 -5
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/scripts/folder.py +7 -1
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/scripts/from_csv.py +6 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/scripts/from_json.py +6 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/scripts/headers.py +7 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/scripts/highlight.py +11 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/scripts/meta_print.py +9 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/scripts/meta_update.py +8 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/scripts/replace.py +5 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/scripts/show.py +12 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/scripts/styles.py +11 -1
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/scripts/table_shrink.py +7 -1
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/scripts/to_csv.py +12 -4
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/scripts/to_json.py +5 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/scripts/to_markdown.py +44 -12
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/scripts/userfield.py +9 -1
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/section.py +6 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/security.py +21 -13
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/settings.py +5 -1
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/shapes.py +53 -14
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/smil.py +6 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/spacer.py +6 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/span.py +2 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/style.py +37 -14
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/style_base.py +9 -1
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/style_containers.py +1 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/style_defaults.py +6 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/style_props.py +36 -21
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/style_utils.py +45 -20
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/styles.py +13 -1
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/svg.py +12 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/tab.py +4 -1
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/table.py +147 -40
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/table_cache.py +30 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/table_serializer.py +8 -1
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/text_index.py +2 -1
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/toc.py +30 -8
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/tracked_changes.py +86 -47
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/unit.py +15 -7
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/user_field.py +15 -5
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/user_field_declaration.py +16 -7
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/utils/blob.py +4 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/utils/color.py +15 -8
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/utils/coordinates.py +27 -14
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/utils/formula.py +2 -1
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/utils/isiterable.py +2 -1
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/utils/json_formater.py +1 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/utils/remove_tree.py +3 -2
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/utils/rfc3066.py +4 -2
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/utils/script_utils.py +8 -4
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/utils/str_convert.py +8 -4
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/utils/unify_name.py +2 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/utils/xpath_query.py +2 -1
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/variable.py +46 -13
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/variable_declaration.py +14 -6
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/xmlpart.py +26 -12
- odfdo-3.26.0/src/odfdo/utils/unify_name.py.orig +0 -74
- {odfdo-3.26.0 → odfdo-3.26.2}/LICENSE +0 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/NOTICE.txt +0 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/README.md +0 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/const.py +0 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/header_rows.py +0 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/meta_field.py +0 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/py.typed +0 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/ruby_base.py +0 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/scripts/__init__.py +0 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/templates/__init__.py +0 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/templates/drawing.otg +0 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/templates/lpod_styles.odt +0 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/templates/presentation.otp +0 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/templates/spreadsheet.ots +0 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/templates/text.ott +0 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/utils/__init__.py +0 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/utils/css3_colormap.py +0 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/utils/style_constants.py +0 -0
- {odfdo-3.26.0 → odfdo-3.26.2}/src/odfdo/version.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: odfdo
|
|
3
|
-
Version: 3.26.
|
|
3
|
+
Version: 3.26.2
|
|
4
4
|
Summary: Python library for OpenDocument Format
|
|
5
5
|
Keywords: python,library,ODF,OpenDocument
|
|
6
6
|
Author: Jérôme Dumonteil
|
|
@@ -17,6 +17,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.12
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.13
|
|
19
19
|
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
20
21
|
Classifier: Operating System :: OS Independent
|
|
21
22
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
23
|
Requires-Dist: lxml>=4.8.0,<7 ; python_full_version == '3.10.*'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "odfdo"
|
|
3
|
-
version = "3.26.
|
|
3
|
+
version = "3.26.2"
|
|
4
4
|
description = "Python library for OpenDocument Format"
|
|
5
5
|
license = "Apache-2.0"
|
|
6
6
|
license-files = [
|
|
@@ -24,6 +24,7 @@ classifiers = [
|
|
|
24
24
|
"Programming Language :: Python :: 3.12",
|
|
25
25
|
"Programming Language :: Python :: 3.13",
|
|
26
26
|
"Programming Language :: Python :: 3.14",
|
|
27
|
+
"Programming Language :: Python :: 3.15",
|
|
27
28
|
"Operating System :: OS Independent",
|
|
28
29
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
29
30
|
]
|
|
@@ -84,12 +85,12 @@ dev = [
|
|
|
84
85
|
"pyexcel>=0.7.0",
|
|
85
86
|
"pytest>=8.4.2",
|
|
86
87
|
"pytest-xdist>=3.8.0",
|
|
87
|
-
"coverage>=7.16.
|
|
88
|
+
"coverage>=7.16.1",
|
|
88
89
|
"pytest-cov>=7.0.0",
|
|
89
90
|
"tabulate>=0.9.0",
|
|
90
|
-
"tox>=4.
|
|
91
|
-
"ruff>=0.16.
|
|
92
|
-
"ty>=0.0.
|
|
91
|
+
"tox>=4.64.3",
|
|
92
|
+
"ruff>=0.16.9",
|
|
93
|
+
"ty>=0.0.84",
|
|
93
94
|
]
|
|
94
95
|
|
|
95
96
|
[tool.uv]
|
|
@@ -139,6 +140,7 @@ select = [
|
|
|
139
140
|
"TC",
|
|
140
141
|
"I",
|
|
141
142
|
"PERF",
|
|
143
|
+
"D",
|
|
142
144
|
"C90",
|
|
143
145
|
"E",
|
|
144
146
|
"W",
|
|
@@ -151,16 +153,19 @@ select = [
|
|
|
151
153
|
ignore = [
|
|
152
154
|
"E501",
|
|
153
155
|
"A003",
|
|
154
|
-
"TRY003",
|
|
155
156
|
"SIM108",
|
|
156
157
|
"C901",
|
|
157
158
|
"B904",
|
|
158
|
-
"D104",
|
|
159
159
|
"PYI041",
|
|
160
|
+
"D213",
|
|
161
|
+
"D105",
|
|
162
|
+
"D301",
|
|
163
|
+
"D205",
|
|
164
|
+
"D203",
|
|
160
165
|
]
|
|
161
166
|
|
|
162
167
|
[tool.ruff.lint.per-file-ignores]
|
|
163
|
-
"tests
|
|
168
|
+
"tests/*" = [
|
|
164
169
|
"S101",
|
|
165
170
|
"S404",
|
|
166
171
|
"RUF005",
|
|
@@ -169,12 +174,14 @@ ignore = [
|
|
|
169
174
|
"YTT204",
|
|
170
175
|
"SIM117",
|
|
171
176
|
"S603",
|
|
172
|
-
"D103",
|
|
173
177
|
"D100",
|
|
174
178
|
"D101",
|
|
175
|
-
"
|
|
179
|
+
"D102",
|
|
180
|
+
"D103",
|
|
181
|
+
"D107",
|
|
176
182
|
"D205",
|
|
177
183
|
"D400",
|
|
184
|
+
"D401",
|
|
178
185
|
"D415",
|
|
179
186
|
"PERF401",
|
|
180
187
|
]
|
|
@@ -187,12 +194,14 @@ ignore = [
|
|
|
187
194
|
"YTT204",
|
|
188
195
|
"SIM117",
|
|
189
196
|
"S603",
|
|
190
|
-
"D103",
|
|
191
197
|
"D100",
|
|
192
198
|
"D101",
|
|
193
|
-
"
|
|
199
|
+
"D102",
|
|
200
|
+
"D103",
|
|
201
|
+
"D107",
|
|
194
202
|
"D205",
|
|
195
203
|
"D400",
|
|
204
|
+
"D401",
|
|
196
205
|
"D415",
|
|
197
206
|
"PERF401",
|
|
198
207
|
]
|
|
@@ -200,8 +209,8 @@ ignore = [
|
|
|
200
209
|
"S101",
|
|
201
210
|
"SIM102",
|
|
202
211
|
"B903",
|
|
203
|
-
"D103",
|
|
204
212
|
"D100",
|
|
213
|
+
"D103",
|
|
205
214
|
"PERF401",
|
|
206
215
|
]
|
|
207
216
|
"recipes/accessing_a_single_element.py" = ["RUF001"]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "odfdo"
|
|
3
|
-
version = "3.26.
|
|
3
|
+
version = "3.26.2"
|
|
4
4
|
description = "Python library for OpenDocument Format"
|
|
5
5
|
license = "Apache-2.0"
|
|
6
6
|
license-files = ["LICENSE", "NOTICE.txt"]
|
|
@@ -17,6 +17,7 @@ classifiers = [
|
|
|
17
17
|
"Programming Language :: Python :: 3.12",
|
|
18
18
|
"Programming Language :: Python :: 3.13",
|
|
19
19
|
"Programming Language :: Python :: 3.14",
|
|
20
|
+
"Programming Language :: Python :: 3.15",
|
|
20
21
|
"Operating System :: OS Independent",
|
|
21
22
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
22
23
|
]
|
|
@@ -73,12 +74,12 @@ dev = [
|
|
|
73
74
|
"pyexcel>=0.7.0", # for recipes about pyexcel
|
|
74
75
|
"pytest>=8.4.2",
|
|
75
76
|
"pytest-xdist>=3.8.0",
|
|
76
|
-
"coverage>=7.16.
|
|
77
|
+
"coverage>=7.16.1",
|
|
77
78
|
"pytest-cov>=7.0.0",
|
|
78
79
|
"tabulate>=0.9.0", # for recipes about tabulate
|
|
79
|
-
"tox>=4.
|
|
80
|
-
"ruff>=0.16.
|
|
81
|
-
"ty>=0.0.
|
|
80
|
+
"tox>=4.64.3",
|
|
81
|
+
"ruff>=0.16.9",
|
|
82
|
+
"ty>=0.0.84",
|
|
82
83
|
]
|
|
83
84
|
|
|
84
85
|
[tool.uv]
|
|
@@ -147,7 +148,7 @@ select = [
|
|
|
147
148
|
# perflint
|
|
148
149
|
"PERF",
|
|
149
150
|
# pydocstyle
|
|
150
|
-
|
|
151
|
+
"D",
|
|
151
152
|
# mccabe
|
|
152
153
|
"C90",
|
|
153
154
|
# pycodestyle
|
|
@@ -167,44 +168,42 @@ select = [
|
|
|
167
168
|
ignore = [
|
|
168
169
|
# LineTooLong
|
|
169
170
|
"E501",
|
|
170
|
-
# DoNotAssignLambda
|
|
171
|
-
# "E731",
|
|
172
|
-
# Use specific rule codes when ignoring type issues
|
|
173
|
-
# "PGH003",
|
|
174
171
|
# check for execution of untrusted input
|
|
175
172
|
# "S603",
|
|
176
173
|
# Class attribute `open` is shadowing a Python builtin
|
|
177
174
|
"A003",
|
|
178
|
-
# Use `X | Y` in `isinstance` call instead of `(X, Y)`
|
|
179
|
-
# "UP038",
|
|
180
|
-
# Use `X | Y` for type annotations
|
|
181
|
-
# "UP007",
|
|
182
|
-
# Avoid specifying long messages outside the exception class
|
|
183
|
-
"TRY003",
|
|
184
175
|
# Use ternary operator
|
|
185
176
|
"SIM108",
|
|
186
|
-
# Use of `assert` detected
|
|
187
|
-
# "S101",
|
|
188
177
|
# is too complex (12 > 10)
|
|
189
178
|
"C901",
|
|
190
179
|
# Within an `except` clause, raise exceptions with `raise ... from err`
|
|
191
180
|
"B904",
|
|
192
|
-
#
|
|
193
|
-
"D104",
|
|
194
|
-
#redundant-numeric-union
|
|
181
|
+
# redundant-numeric-union
|
|
195
182
|
"PYI041",
|
|
183
|
+
# multi-line-summary-second-line
|
|
184
|
+
"D213",
|
|
185
|
+
# Missing docstring in magic method
|
|
186
|
+
"D105",
|
|
187
|
+
# Use `r"""` if any backslashes in a docstring
|
|
188
|
+
"D301",
|
|
189
|
+
# 1 blank line required between summary line and description
|
|
190
|
+
"D205",
|
|
191
|
+
# blank line before class
|
|
192
|
+
"D203",
|
|
196
193
|
]
|
|
197
194
|
|
|
198
195
|
[tool.ruff.lint.per-file-ignores]
|
|
199
|
-
"tests
|
|
200
|
-
"S101", "S404", "RUF005", "B007", "UP017", "YTT204", "SIM117","S603",
|
|
201
|
-
"
|
|
196
|
+
"tests/*" = [
|
|
197
|
+
"S101", "S404", "RUF005", "B007", "UP017", "YTT204", "SIM117", "S603",
|
|
198
|
+
"D100", "D101", "D102", "D103", "D107", "D205", "D400", "D401", "D415",
|
|
199
|
+
"PERF401",
|
|
202
200
|
]
|
|
203
201
|
"tests/*/test_*" = [
|
|
204
|
-
"S101", "S404", "RUF005", "B007", "UP017", "YTT204", "SIM117","S603",
|
|
205
|
-
"
|
|
202
|
+
"S101", "S404", "RUF005", "B007", "UP017", "YTT204", "SIM117", "S603",
|
|
203
|
+
"D100", "D101", "D102", "D103", "D107", "D205", "D400", "D401", "D415",
|
|
204
|
+
"PERF401",
|
|
206
205
|
]
|
|
207
|
-
"recipes/*" = ["S101", "SIM102", "B903","
|
|
206
|
+
"recipes/*" = ["S101", "SIM102", "B903", "D100", "D103", "PERF401"]
|
|
208
207
|
"recipes/accessing_a_single_element.py" = ["RUF001"]
|
|
209
208
|
|
|
210
209
|
[tool.pytest.ini_options]
|
|
@@ -74,6 +74,7 @@ class AnnotationMixin(Element):
|
|
|
74
74
|
|
|
75
75
|
Returns:
|
|
76
76
|
list[Annotation]: A list of matching Annotation elements.
|
|
77
|
+
|
|
77
78
|
"""
|
|
78
79
|
annotations: list[Annotation] = []
|
|
79
80
|
for annotation in cast(
|
|
@@ -114,6 +115,7 @@ class AnnotationMixin(Element):
|
|
|
114
115
|
|
|
115
116
|
Returns:
|
|
116
117
|
Annotation or None: The matching Annotation element, or None if not found.
|
|
118
|
+
|
|
117
119
|
"""
|
|
118
120
|
if name is not None:
|
|
119
121
|
return cast(
|
|
@@ -140,6 +142,7 @@ class AnnotationMixin(Element):
|
|
|
140
142
|
|
|
141
143
|
Returns:
|
|
142
144
|
list[AnnotationEnd]: A list of AnnotationEnd elements.
|
|
145
|
+
|
|
143
146
|
"""
|
|
144
147
|
return cast(
|
|
145
148
|
"list[AnnotationEnd]",
|
|
@@ -162,6 +165,7 @@ class AnnotationMixin(Element):
|
|
|
162
165
|
Returns:
|
|
163
166
|
AnnotationEnd or None: The matching AnnotationEnd element, or
|
|
164
167
|
None if not found.
|
|
168
|
+
|
|
165
169
|
"""
|
|
166
170
|
return cast(
|
|
167
171
|
"AnnotationEnd | None",
|
|
@@ -179,6 +183,7 @@ def get_unique_office_name(element: Element | None = None) -> str:
|
|
|
179
183
|
|
|
180
184
|
Returns:
|
|
181
185
|
str: A unique name.
|
|
186
|
+
|
|
182
187
|
"""
|
|
183
188
|
if element is not None:
|
|
184
189
|
body = element.document_body
|
|
@@ -213,6 +218,7 @@ class Annotation(MDTail, ListMixin, LinkMixin, Element, DcCreatorMixin, DcDateMi
|
|
|
213
218
|
creator (str): The creator of the annotation.
|
|
214
219
|
date (datetime): The date of the annotation.
|
|
215
220
|
note_body (str or Element): The body content of the annotation.
|
|
221
|
+
|
|
216
222
|
"""
|
|
217
223
|
|
|
218
224
|
_tag = "office:annotation"
|
|
@@ -249,6 +255,8 @@ class Annotation(MDTail, ListMixin, LinkMixin, Element, DcCreatorMixin, DcDateMi
|
|
|
249
255
|
name is generated.
|
|
250
256
|
parent: The parent element to which this annotation will be
|
|
251
257
|
associated for name generation.
|
|
258
|
+
kwargs: Arbitrary keyword arguments for the Element base class.
|
|
259
|
+
|
|
252
260
|
"""
|
|
253
261
|
# fixme : use offset
|
|
254
262
|
# TODO allow paragraph and text styles
|
|
@@ -285,6 +293,7 @@ class Annotation(MDTail, ListMixin, LinkMixin, Element, DcCreatorMixin, DcDateMi
|
|
|
285
293
|
|
|
286
294
|
@property
|
|
287
295
|
def note_body(self) -> str:
|
|
296
|
+
"""Get or set the text content or element of the annotation body."""
|
|
288
297
|
return self.text_content
|
|
289
298
|
|
|
290
299
|
@note_body.setter
|
|
@@ -297,7 +306,8 @@ class Annotation(MDTail, ListMixin, LinkMixin, Element, DcCreatorMixin, DcDateMi
|
|
|
297
306
|
self.clear()
|
|
298
307
|
self.append(text_or_element)
|
|
299
308
|
else:
|
|
300
|
-
|
|
309
|
+
msg = f"Unexpected type for body: {type(text_or_element)!r}"
|
|
310
|
+
raise TypeError(msg)
|
|
301
311
|
|
|
302
312
|
@property
|
|
303
313
|
def start(self) -> Annotation:
|
|
@@ -309,8 +319,9 @@ class Annotation(MDTail, ListMixin, LinkMixin, Element, DcCreatorMixin, DcDateMi
|
|
|
309
319
|
"""Return the corresponding annotation-end tag or None."""
|
|
310
320
|
name = self.name
|
|
311
321
|
parent = self.parent
|
|
312
|
-
if parent is None:
|
|
313
|
-
|
|
322
|
+
if parent is None:
|
|
323
|
+
msg = "Can't find end tag: no parent available"
|
|
324
|
+
raise ValueError(msg)
|
|
314
325
|
body: Body | Element = self.document_body or parent
|
|
315
326
|
method = getattr(body, "get_annotation_end", None)
|
|
316
327
|
if callable(method):
|
|
@@ -323,7 +334,7 @@ class Annotation(MDTail, ListMixin, LinkMixin, Element, DcCreatorMixin, DcDateMi
|
|
|
323
334
|
no_header: bool = True,
|
|
324
335
|
clean: bool = True,
|
|
325
336
|
) -> Element | list | str | None:
|
|
326
|
-
"""
|
|
337
|
+
"""Return the annotated content from an annotation.
|
|
327
338
|
|
|
328
339
|
If no content exists (e.g., single position annotation or if the
|
|
329
340
|
annotation-end tag is not found), it returns an empty list or an
|
|
@@ -341,6 +352,7 @@ class Annotation(MDTail, ListMixin, LinkMixin, Element, DcCreatorMixin, DcDateMi
|
|
|
341
352
|
Element | list | str | None: The content of the annotation, which
|
|
342
353
|
can be a single element, a list of elements, a string, or None if
|
|
343
354
|
the end tag is missing.
|
|
355
|
+
|
|
344
356
|
"""
|
|
345
357
|
end = self.end
|
|
346
358
|
if end is None:
|
|
@@ -364,6 +376,7 @@ class Annotation(MDTail, ListMixin, LinkMixin, Element, DcCreatorMixin, DcDateMi
|
|
|
364
376
|
the annotation itself is deleted. Defaults to None.
|
|
365
377
|
keep_tail: This argument is not used in this context but is
|
|
366
378
|
kept for compatibility. Defaults to True.
|
|
379
|
+
|
|
367
380
|
"""
|
|
368
381
|
if child is not None: # act like normal delete
|
|
369
382
|
super().delete(child)
|
|
@@ -375,11 +388,13 @@ class Annotation(MDTail, ListMixin, LinkMixin, Element, DcCreatorMixin, DcDateMi
|
|
|
375
388
|
super().delete()
|
|
376
389
|
|
|
377
390
|
def check_validity(self) -> None:
|
|
378
|
-
"""
|
|
391
|
+
"""Check the validity of the Annotation."""
|
|
379
392
|
if not self.note_body:
|
|
380
|
-
|
|
393
|
+
msg = "Annotation must have a body"
|
|
394
|
+
raise ValueError(msg)
|
|
381
395
|
if not self.dc_creator:
|
|
382
|
-
|
|
396
|
+
msg = "Annotation must have a creator"
|
|
397
|
+
raise ValueError(msg)
|
|
383
398
|
if not self.dc_date:
|
|
384
399
|
self.dc_date = datetime.now()
|
|
385
400
|
|
|
@@ -405,6 +420,7 @@ class AnnotationEnd(MDTail, Element):
|
|
|
405
420
|
name (str): The name of the annotation this element is closing. This
|
|
406
421
|
name must match the 'office:name' of a preceding
|
|
407
422
|
"office:annotation" element.
|
|
423
|
+
|
|
408
424
|
"""
|
|
409
425
|
|
|
410
426
|
_tag = "office:annotation-end"
|
|
@@ -428,6 +444,8 @@ class AnnotationEnd(MDTail, Element):
|
|
|
428
444
|
attribute will be taken from this annotation.
|
|
429
445
|
name: The name of the annotation to close. This is
|
|
430
446
|
required if 'annotation' is not provided.
|
|
447
|
+
kwargs: Arbitrary keyword arguments for the Element base class.
|
|
448
|
+
|
|
431
449
|
"""
|
|
432
450
|
# fixme : use offset
|
|
433
451
|
# TODO allow paragraph and text styles
|
|
@@ -436,7 +454,8 @@ class AnnotationEnd(MDTail, Element):
|
|
|
436
454
|
if annotation:
|
|
437
455
|
name = annotation.name
|
|
438
456
|
if not name:
|
|
439
|
-
|
|
457
|
+
msg = "Annotation-end must have a name"
|
|
458
|
+
raise ValueError(msg)
|
|
440
459
|
self.name = name
|
|
441
460
|
|
|
442
461
|
@property
|
|
@@ -445,14 +464,13 @@ class AnnotationEnd(MDTail, Element):
|
|
|
445
464
|
name = self.name
|
|
446
465
|
parent = self.parent
|
|
447
466
|
if parent is None:
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
) # pragma: nocover
|
|
467
|
+
msg = "Can't find start tag: no parent available"
|
|
468
|
+
raise ValueError(msg)
|
|
451
469
|
body: Body | Element = self.document_body or parent
|
|
452
470
|
method = getattr(body, "get_annotation", None)
|
|
453
|
-
if callable(method):
|
|
471
|
+
if callable(method):
|
|
454
472
|
return cast("Annotation | None", method(name=name))
|
|
455
|
-
return None
|
|
473
|
+
return None
|
|
456
474
|
|
|
457
475
|
@property
|
|
458
476
|
def end(self) -> AnnotationEnd:
|
|
@@ -70,6 +70,7 @@ class Body(Element):
|
|
|
70
70
|
|
|
71
71
|
Returns:
|
|
72
72
|
list[Table]: A list of matching Table elements.
|
|
73
|
+
|
|
73
74
|
"""
|
|
74
75
|
return self._filtered_elements( # ty: ignore[invalid-return-type]
|
|
75
76
|
"descendant::table:table",
|
|
@@ -87,6 +88,7 @@ class Body(Element):
|
|
|
87
88
|
|
|
88
89
|
Returns:
|
|
89
90
|
list[Table]: A list of all Table elements.
|
|
91
|
+
|
|
90
92
|
"""
|
|
91
93
|
return cast("list[Table]", self.get_elements("descendant::table:table"))
|
|
92
94
|
|
|
@@ -110,6 +112,7 @@ class Body(Element):
|
|
|
110
112
|
|
|
111
113
|
Returns:
|
|
112
114
|
Table or None: The matching Table element, or None if not found.
|
|
115
|
+
|
|
113
116
|
"""
|
|
114
117
|
if name is None and content is None:
|
|
115
118
|
result = self._filtered_element("descendant::table:table", position)
|
|
@@ -134,6 +137,7 @@ class Body(Element):
|
|
|
134
137
|
|
|
135
138
|
Returns:
|
|
136
139
|
Table or None: The matching Table element, or None if not found.
|
|
140
|
+
|
|
137
141
|
"""
|
|
138
142
|
if not name:
|
|
139
143
|
return None
|
|
@@ -252,6 +256,7 @@ class OfficeSettings(Body):
|
|
|
252
256
|
dict: A dictionary representing the OfficeSettings element,
|
|
253
257
|
where the key is the element's tag and the value is a
|
|
254
258
|
dictionary containing its children's representations.
|
|
259
|
+
|
|
255
260
|
"""
|
|
256
261
|
conf: dict[str, str | int | bool | dict[str, Any] | list[Any]] = {
|
|
257
262
|
"class": self._tag
|
|
@@ -278,6 +283,7 @@ class OfficeSettings(Body):
|
|
|
278
283
|
|
|
279
284
|
Returns:
|
|
280
285
|
An OfficeSettings instance populated with data from the dictionary.
|
|
286
|
+
|
|
281
287
|
"""
|
|
282
288
|
return cast("OfficeSettings", _from_dict(data))
|
|
283
289
|
|
|
@@ -40,6 +40,7 @@ class BookmarkMixin(Element):
|
|
|
40
40
|
|
|
41
41
|
Returns:
|
|
42
42
|
list[Bookmark]: All bookmarks in the element's subtree.
|
|
43
|
+
|
|
43
44
|
"""
|
|
44
45
|
return cast(
|
|
45
46
|
"list[Bookmark]",
|
|
@@ -61,6 +62,7 @@ class BookmarkMixin(Element):
|
|
|
61
62
|
|
|
62
63
|
Returns:
|
|
63
64
|
Bookmark or None: The found Bookmark or None if not found.
|
|
65
|
+
|
|
64
66
|
"""
|
|
65
67
|
return cast(
|
|
66
68
|
"Bookmark | None",
|
|
@@ -74,6 +76,7 @@ class BookmarkMixin(Element):
|
|
|
74
76
|
|
|
75
77
|
Returns:
|
|
76
78
|
list[BookmarkStart]: All bookmark start markers in the element's subtree.
|
|
79
|
+
|
|
77
80
|
"""
|
|
78
81
|
return cast(
|
|
79
82
|
"list[BookmarkStart]",
|
|
@@ -95,6 +98,7 @@ class BookmarkMixin(Element):
|
|
|
95
98
|
|
|
96
99
|
Returns:
|
|
97
100
|
BookmarkStart or None: The found BookmarkStart or None if not found.
|
|
101
|
+
|
|
98
102
|
"""
|
|
99
103
|
return cast(
|
|
100
104
|
"BookmarkStart | None",
|
|
@@ -108,6 +112,7 @@ class BookmarkMixin(Element):
|
|
|
108
112
|
|
|
109
113
|
Returns:
|
|
110
114
|
list[BookmarkEnd]: All bookmark end markers in the element's subtree.
|
|
115
|
+
|
|
111
116
|
"""
|
|
112
117
|
return cast(
|
|
113
118
|
"list[BookmarkEnd]",
|
|
@@ -129,6 +134,7 @@ class BookmarkMixin(Element):
|
|
|
129
134
|
|
|
130
135
|
Returns:
|
|
131
136
|
BookmarkEnd or None: The found BookmarkEnd or None if not found.
|
|
137
|
+
|
|
132
138
|
"""
|
|
133
139
|
return cast(
|
|
134
140
|
"BookmarkEnd | None",
|
|
@@ -143,6 +149,7 @@ class Bookmark(Element):
|
|
|
143
149
|
|
|
144
150
|
Attributes:
|
|
145
151
|
name (str): The name of the bookmark (text:name attribute).
|
|
152
|
+
|
|
146
153
|
"""
|
|
147
154
|
|
|
148
155
|
_tag = "text:bookmark"
|
|
@@ -153,6 +160,8 @@ class Bookmark(Element):
|
|
|
153
160
|
|
|
154
161
|
Args:
|
|
155
162
|
name: The name of the bookmark.
|
|
163
|
+
kwargs: Arbitrary keyword arguments for the Element base class.
|
|
164
|
+
|
|
156
165
|
"""
|
|
157
166
|
super().__init__(**kwargs)
|
|
158
167
|
if self._do_init:
|
|
@@ -167,6 +176,7 @@ class BookmarkStart(Element):
|
|
|
167
176
|
|
|
168
177
|
Attributes:
|
|
169
178
|
name (str): The name of the bookmark range being started (text:name attribute).
|
|
179
|
+
|
|
170
180
|
"""
|
|
171
181
|
|
|
172
182
|
_tag = "text:bookmark-start"
|
|
@@ -177,6 +187,8 @@ class BookmarkStart(Element):
|
|
|
177
187
|
|
|
178
188
|
Args:
|
|
179
189
|
name: The name of the bookmark range being started.
|
|
190
|
+
kwargs: Arbitrary keyword arguments for the Element base class.
|
|
191
|
+
|
|
180
192
|
"""
|
|
181
193
|
super().__init__(**kwargs)
|
|
182
194
|
if self._do_init:
|
|
@@ -191,6 +203,7 @@ class BookmarkEnd(Element):
|
|
|
191
203
|
|
|
192
204
|
Attributes:
|
|
193
205
|
name (str): The name of the bookmark range being ended (text:name attribute).
|
|
206
|
+
|
|
194
207
|
"""
|
|
195
208
|
|
|
196
209
|
_tag = "text:bookmark-end"
|
|
@@ -201,6 +214,8 @@ class BookmarkEnd(Element):
|
|
|
201
214
|
|
|
202
215
|
Args:
|
|
203
216
|
name: The name of the bookmark range being ended.
|
|
217
|
+
kwargs: Arbitrary keyword arguments for the Element base class.
|
|
218
|
+
|
|
204
219
|
"""
|
|
205
220
|
super().__init__(**kwargs)
|
|
206
221
|
if self._do_init:
|