Given a class like this:
from enum import IntEnum
class T(IntEnum):
a = 0x10
b = 0x20
When documenting the attributes of this class, is it possible to have Sphinx document the enumerations with the hexadecimal representation instead of the default decimal?
edit
I have tried using autodoc-process-signature and this works except that attribute references break and I can no longer cross reference attributes anymore.
I am using it like this:
def attribute_hex_render(app, what, name, obj, options, signature, return_annotation):
if 'TestObject.' in name and what == 'attribute':
return f" = {obj:#06x}", return_annotation
return signature, return_annotation #no-op
def setup(app):
# -- Document attributes in hex
app.connect('autodoc-process-signature', attribute_hex_render)