def __str__(self): if isinstance(self.value, basestring): return self.value else: return _unicode_decode(repr(self.value), encoding=_encodings['content'], errors='replace')
def __str__(self): eapi = self.eapi if not isinstance(eapi, basestring): eapi = str(eapi) eapi = eapi.lstrip("-") msg = _("Unable to do any operations on '%(cpv)s', since " "its EAPI is higher than this portage version's. Please upgrade" " to a portage version that supports EAPI '%(eapi)s'.") % \ {"cpv": self.cpv, "eapi": eapi} return _unicode_decode(msg, encoding=_encodings['content'], errors='replace')
def shlex_split(s): """ This is equivalent to shlex.split, but if the current interpreter is python2, it temporarily encodes unicode strings to bytes since python2's shlex.split() doesn't handle unicode strings. """ convert_to_bytes = sys.hexversion < 0x3000000 and not isinstance(s, bytes) if convert_to_bytes: s = _unicode_encode(s) rval = shlex.split(s) if convert_to_bytes: rval = [_unicode_decode(x) for x in rval] return rval
def __init__(self,value): self.value = value[:] if isinstance(self.value, basestring): self.value = _unicode_decode(self.value, encoding=_encodings['content'], errors='replace')
def __init__(self, value): self.value = value[:] if isinstance(self.value, basestring): self.value = _unicode_decode(self.value, encoding=_encodings['content'], errors='replace')