def _determineClassName(x): c = _determineClass(x) try: return c.__name__ except: try: return str(c) except: return '<BROKEN CLASS AT 0x%x>' % unsignedID(c)
def _safeFormat(formatter, o): """ Helper function for L{safe_repr} and L{safe_str}. """ try: return formatter(o) except: io = StringIO() traceback.print_exc(file=io) className = _determineClassName(o) tbValue = io.getvalue() return "<%s instance at 0x%x with %s error:\n %s>" % ( className, unsignedID(o), formatter.__name__, tbValue)
def __str__(self): cname = self.__class__.__name__ if hasattr(self, "result"): return "<%s at %s current result: %r>" % (cname, hex(unsignedID(self)), self.result) return "<%s at %s>" % (cname, hex(unsignedID(self)))
def __str__(self): cname = self.__class__.__name__ if hasattr(self, 'result'): return "<%s at %s current result: %r>" % (cname, hex(unsignedID(self)), self.result) return "<%s at %s>" % (cname, hex(unsignedID(self)))