Exemplo n.º 1
0
    def __str__(self):
        if isinstance(self.val, BaseException):
            self.val = dict(
                symbol=self.lookup.get(type(self.val).__name__) or
                type(self.val).__name__,
                # :reply should only be used for error messages that can be
                # displayed to START users
                # use :message for Python exceptions
                kw={'message': str(self.val.message)}
            )

        return output(u"(:error {symbol} {keys})".format(
            symbol=self.val['symbol'],
            keys=self._plist(sorted(self.val['kw'].items()))))
Exemplo n.º 2
0
 def __str__(self):
     return output(self.typed_value())
Exemplo n.º 3
0
 def __repr__(self):
     r = u"<%s object %s>" % (self.__class__.__name__,
                              self.__str__())
     return output(r)
Exemplo n.º 4
0
    def _kv_pair(self, k, v):
        if k is None:
            return output(u"%s" % v)

        if isinstance(k, basestring):
            return output(u":%s %s" % (k, v))
Exemplo n.º 5
0
 def __str__(self):
     pairs = sorted(self.val.items())
     return output(u'(%s)' % self._plist(pairs))