MCPcopy Index your code
hub / github.com/python-openxml/python-docx / get_attr_value

Method get_attr_value

src/docx/oxml/xmlchemy.py:240–246  ·  view source on GitHub ↗
(obj: BaseOxmlElement)

Source from the content-addressed store, hash-verified

238 """function object suitable for "get" side of attr property descriptor."""
239
240 def get_attr_value(obj: BaseOxmlElement) -> Any | None:
241 attr_str_value = obj.get(self._clark_name)
242 if attr_str_value is None:
243 raise InvalidXmlError(
244 "required '%s' attribute not present on element %s" % (self._attr_name, obj.tag)
245 )
246 return self._simple_type.from_xml(attr_str_value)
247
248 get_attr_value.__doc__ = self._docstring
249 return get_attr_value

Callers

nothing calls this directly

Calls 3

InvalidXmlErrorClass · 0.90
getMethod · 0.45
from_xmlMethod · 0.45

Tested by

no test coverage detected