Add an ``_add_x()`` method to the element class for this child element.
(self)
| 291 | self._prop_name = prop_name |
| 292 | |
| 293 | def _add_adder(self): |
| 294 | """Add an ``_add_x()`` method to the element class for this child element.""" |
| 295 | |
| 296 | def _add_child(obj: BaseOxmlElement, **attrs: Any): |
| 297 | new_method = getattr(obj, self._new_method_name) |
| 298 | child = new_method() |
| 299 | for key, value in attrs.items(): |
| 300 | setattr(child, key, value) |
| 301 | insert_method = getattr(obj, self._insert_method_name) |
| 302 | insert_method(child) |
| 303 | return child |
| 304 | |
| 305 | _add_child.__doc__ = ( |
| 306 | "Add a new ``<%s>`` child element unconditionally, inserted in t" |
| 307 | "he correct sequence." % self._nsptagname |
| 308 | ) |
| 309 | self._add_to_class(self._add_method_name, _add_child) |
| 310 | |
| 311 | def _add_creator(self): |
| 312 | """Add a `_new_{prop_name}()` method to the element class. |
no test coverage detected