コード例 #1
0
 def __str__(self):
     if isinstance(self.value, basestring):
         return self.value
     else:
         return _unicode_decode(repr(self.value),
                                encoding=_encodings['content'],
                                errors='replace')
コード例 #2
0
ファイル: exception.py プロジェクト: zy-sunshine/easymgc
 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')
コード例 #3
0
 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')
コード例 #4
0
ファイル: __init__.py プロジェクト: zy-sunshine/easymgc
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
コード例 #5
0
ファイル: __init__.py プロジェクト: zy-sunshine/easymgc
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
コード例 #6
0
ファイル: exception.py プロジェクト: zy-sunshine/easymgc
 def __str__(self):
     if isinstance(self.value, basestring):
         return self.value
     else:
         return _unicode_decode(repr(self.value),
             encoding=_encodings['content'], errors='replace')
コード例 #7
0
ファイル: exception.py プロジェクト: zy-sunshine/easymgc
 def __init__(self,value):
     self.value = value[:]
     if isinstance(self.value, basestring):
         self.value = _unicode_decode(self.value,
             encoding=_encodings['content'], errors='replace')
コード例 #8
0
 def __init__(self, value):
     self.value = value[:]
     if isinstance(self.value, basestring):
         self.value = _unicode_decode(self.value,
                                      encoding=_encodings['content'],
                                      errors='replace')