elif state.config['PYBIND11_COMPATIBILITY'] and hasattr(value.__class__, '__members__'):
return make_name_link(state, referrer_path, '{}.{}.{}'.format(value.__class__.__module__, value.__class__.__qualname__, str(value).partition('.')[2]))
elif '__repr__' in type(value).__dict__:
+ rendered = repr(value)
# TODO: tuples of non-representable values will still be ugly
- return html.escape(repr(value))
+ # If the value is too large, return just an ellipsis
+ return html.escape(rendered) if len(rendered) < 128 else '…'
else:
return None
<a href="#ENUM_THING" class="m-doc-self">ENUM_THING</a> = <a href="inspect_string.html#MyEnum-YAY" class="m-doc">MyEnum.YAY</a>
</dt>
<dd></dd>
+ <dt id="LARGE_VALUE_WILL_BE_AN_ELLIPSIS">
+ <a href="#LARGE_VALUE_WILL_BE_AN_ELLIPSIS" class="m-doc-self">LARGE_VALUE_WILL_BE_AN_ELLIPSIS</a> = …
+ </dt>
+ <dd></dd>
<dt id="foo">
<a href="#foo" class="m-doc-self">foo</a>
</dt>
A_FALSE_VALUE = False
A_NONE_VALUE = None
+# This value is too long and should be completely omitted
+LARGE_VALUE_WILL_BE_AN_ELLIPSIS = """Lorem ipsum dolor sit amet, consectetur
+ adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
+ magna aliqua."""
+
_PRIVATE_CONSTANT = -3
foo = Foo()