Return the unicode name decoded from *raw_name* using the encoding
        implied by the combination of *platform_id* and *encoding_id*.
544027
def _decode_name(raw_name, platform_id, encoding_id):
        
        if platform_id == 1:
            # reject non-Roman Mac font names
            if encoding_id != 0:
                return None
            return raw_name.decode('mac-roman')
        elif platform_id in (0, 3):
            return raw_name.decode('utf-16-be')
        else:
            return None
29830
def get_representation(self, prefix="", suffix="\n"):
        
        res = []
        if self.hidden:
            res.append(prefix + " - " + str(self._name)
                       + " : xxxxxxxx" + suffix)
        else:
            default = self.default
            if default is None:
                default = " - "
            a = prefix + " - "
            a += str(self._name) + " : "
            if isinstance(default, types.UnicodeType):
                a += default
            else:
                a += str(default)
            a += suffix
            res.append(a)
        return res
51906
def getName(self, length=512):
        
        name = ctypes.create_string_buffer(length)
        self._ioctl(_HIDIOCGRAWNAME(length), name, True)
        return name.value.decode('UTF-8')
487015
def decode_wireformat_uuid(rawguid):
    
    if isinstance(rawguid, list):
        rawguid = bytearray(rawguid)
    lebytes = struct.unpack_from('<IHH', buffer(rawguid[:8]))
    bebytes = struct.unpack_from('>HHI', buffer(rawguid[8:]))
    return '{0:08X}-{1:04X}-{2:04X}-{3:04X}-{4:04X}{5:08X}'.format(
        lebytes[0], lebytes[1], lebytes[2], bebytes[0], bebytes[1], bebytes[2])
1224055
def name(self) -> str:
        """"""
        if self.is_platform:
            if self._data["publicCode"]:
                return self._data['name'] + " Platform " + \
                       self._data["publicCode"]
            else:
                return self._data['name'] + " Platform " + \
                       self.place_id.split(':')[-1]
        else:
            return self._data['name']
343018
def decode_raw_stream(self, text, decode_raw, known_encoding, filename):
        
        if isinstance(text, compat.text_type):
            m = self._coding_re.match(text)
            encoding = m and m.group(1) or known_encoding or 'ascii'
            return encoding, text

        if text.startswith(codecs.BOM_UTF8):
            text = text[len(codecs.BOM_UTF8):]
            parsed_encoding = 'utf-8'
            m = self._coding_re.match(text.decode('utf-8', 'ignore'))
            if m is not None and m.group(1) != 'utf-8':
                raise exceptions.CompileException(
                                "Found utf-8 BOM in file, with conflicting "
                                "magic encoding comment of '%s'" % m.group(1),
                                text.decode('utf-8', 'ignore'),
                                0, 0, filename)
        else:
            m = self._coding_re.match(text.decode('utf-8', 'ignore'))
            if m:
                parsed_encoding = m.group(1)
            else:
                parsed_encoding = known_encoding or 'ascii'

        if decode_raw:
            try:
                text = text.decode(parsed_encoding)
            except UnicodeDecodeError:
                raise exceptions.CompileException(
                        "Unicode decode operation of encoding '%s' failed" %
                        parsed_encoding,
                        text.decode('utf-8', 'ignore'),
                        0, 0, filename)

        return parsed_encoding, text
770429
def make_python_name(s, default=None, number_prefix='N',encoding="utf-8"):
    
    if s in ('', None):
        s = default
    s = str(s)
    s = re.sub("[^a-zA-Z0-9_]", "_", s)
    if not re.match('\d', s) is None:
        s = number_prefix+s
    return unicode(s, encoding)
553226
def raw(self):
        
        if self._raw:
            return text_type(self._raw).strip("\r\n")
        else:
            return text_type(base64decode(self._b64encoded)).strip("\r\n")
1180352
def decode_name(name, barcodemap):
    
    for barcode in barcodemap:
        if barcode in name:
            return barcodemap[barcode]

    return name
1093142
def _read_name(self, bufr, idx, strings_offset):
        
        platform_id, encoding_id, lang_id, name_id, length, str_offset = (
            self._name_header(bufr, idx)
        )
        name = self._read_name_text(
            bufr, platform_id, encoding_id, strings_offset, str_offset,
            length
        )
        return platform_id, name_id, name
772415
def _get_encoding(encoding_or_label):
    
    if hasattr(encoding_or_label, 'codec_info'):
        return encoding_or_label

    encoding = lookup(encoding_or_label)
    if encoding is None:
        raise LookupError('Unknown encoding label: %r' % encoding_or_label)
    return encoding
461247
def decode_Identification(data):
    """"""
    header_len = struct.calcsize('!HHBH')
    msgtype, msglen, idtype, bytecount = struct.unpack(
        '!HHBH', data[:header_len])
    ret = {}

    idtypes = ['MAC Address', 'EPC']
    try:
        ret['IDType'] = idtypes[idtype]
    except IndexError:
        return {'IDType': b''}, data[msglen:]

    # the remainder is ID value
    ret['ReaderID'] = data[header_len:(header_len+bytecount)]

    return ret, data[msglen:]
1278648
def entry_id_from_cobra_encoding(cobra_id):
    """"""
    for escape, symbol in iteritems(_COBRA_DECODE_ESCAPES):
        cobra_id = cobra_id.replace(escape, symbol)
    return cobra_id
737066
def get_canonical_encoding_name(name):
    # type: (str) -> str
    

    import codecs

    try:
        codec = codecs.lookup(name)
    except LookupError:
        return name
    else:
        return codec.name
770183
def decode_pc23_message(raw_string):
    

    data = {}
    wcy = raw_string.split("^")
    data[const.R] = int(wcy[1])
    data[const.expk] = int(wcy[2])
    data[const.CALLSIGN] = wcy[3]
    data[const.A] = wcy[4]
    data[const.SFI] = wcy[5]
    data[const.K] = wcy[6]
    data[const.AURORA] = wcy[7]
    data["node"] = wcy[7]
    data["ip"] = wcy[8]
    data["raw_data"] = raw_string
    return data
306735
def get_full_name(self):
        
        if self.is_tpl():
            return "tpl-%s/%s" % (getattr(self, 'host_name', 'XxX'), self.name)
        if hasattr(self, 'host_name') and hasattr(self, 'service_description'):
            return "%s/%s" % (self.host_name, self.service_description)
        return 'UNKNOWN-SERVICE'
925313
def GetName(self):
        
        if self.AssetType == AssetType.GoverningToken:
            return "NEO"
        elif self.AssetType == AssetType.UtilityToken:
            return "NEOGas"

        if type(self.Name) is bytes:
            return self.Name.decode('utf-8')
        return self.Name