class twisted.python.util.FancyStrMixin: (source)
Known subclasses: twisted.names._rfc1982.SerialNumber, twisted.names.dns._OPTHeader, twisted.names.dns._OPTVariableOption, twisted.names.dns.Record_A6, twisted.names.dns.Record_AAAA, twisted.names.dns.Record_AFSDB, twisted.names.dns.Record_HINFO, twisted.names.dns.Record_MINFO, twisted.names.dns.Record_MX, twisted.names.dns.Record_NAPTR, twisted.names.dns.Record_NULL, twisted.names.dns.Record_RP, twisted.names.dns.Record_SOA, twisted.names.dns.Record_SRV, twisted.names.dns.Record_SSHFP, twisted.names.dns.Record_TSIG, twisted.names.dns.Record_TXT, twisted.names.dns.Record_WKS, twisted.names.dns.SimpleRecord, twisted.names.dns.UnknownRecord, twisted.pair.tuntap.TunnelAddress
Mixin providing a flexible implementation of __str__
.
__str__
output will begin with the name of the class, or the contents of the attribute fancybasename
if it is set.
The body of __str__
can be controlled by overriding showAttributes
in a subclass. Set showAttributes
to a sequence of strings naming attributes, or sequences of (attributeName, callable)
, or sequences of (attributeName, displayName, formatCharacter)
. In the second case, the callable is passed the value of the attribute and its return value used in the output of __str__
. In the final case, the attribute is looked up using attributeName
, but the output uses displayName
instead, and renders the value of the attribute using formatCharacter
, e.g. "%.3f"
might be used for a float.
Class Variable | showAttributes | Undocumented |
Method | __str__ | Undocumented |
Undocumented
Sequence[Union[str, Tuple[str, str, str], Tuple[str, Callable]]]
)
Undocumented
Returns | Undocumented (type: str ) |