XML value of this enum member, generally an XML attribute value.
(cls: Type[_T], value: int | _T)
| 80 | |
| 81 | @classmethod |
| 82 | def to_xml(cls: Type[_T], value: int | _T) -> str: |
| 83 | """XML value of this enum member, generally an XML attribute value.""" |
| 84 | # -- presence of multi-arg `__new__()` method fools type-checker, but getting a |
| 85 | # -- member by its value using EnumCls(val) works as usual. |
| 86 | member = cls(value) |
| 87 | xml_value = member.xml_value |
| 88 | if not xml_value: |
| 89 | raise ValueError(f"{cls.__name__}.{member.name} has no XML representation") |
| 90 | return xml_value |
| 91 | |
| 92 | @classmethod |
| 93 | def validate(cls: Type[_T], value: _T): |
no outgoing calls