def process_contact_match(match): """I process a contact match and return a C{Contact} object out of it""" from vmc.common.persistent import Contact name = from_ucs2(match.group('name')) number = from_ucs2(match.group('number')) index = int(match.group('id')) return Contact(name, number, index=index)
def process_contact_match(match): """I process a contact match and return a C{Contact} object out of it""" from vmc.common.persistent import Contact _name = match.group('name') if check_if_ucs2(_name): name = from_ucs2(_name) else: name = _name.decode('utf8','ignore').rstrip('\x1f') number = from_ucs2(match.group('number')) index = int(match.group('id')) return Contact(name, number, index=index)
def hw_process_contact_match(self, match): """I process a contact match and return a C{Contact} object out of it""" from vmc.common.persistent import Contact if int(match.group('raw')) == 0: name = match.group('name').decode('utf8', 'ignore').rstrip('\x1f') else: encoding = match.group('name')[:2] hexbytes = match.group('name')[2:] if encoding == '80': # example '80058300440586FF' name = unpack_ucs2_bytes_in_ts31101_80(hexbytes) elif encoding == '81': # example '810602A46563746F72FF' name = unpack_ucs2_bytes_in_ts31101_81(hexbytes) elif encoding == '82': # example '820505302D82D32D31' name = unpack_ucs2_bytes_in_ts31101_82(hexbytes) else: name = "Unsupported encoding" number = from_ucs2(match.group('number')) index = int(match.group('id')) return Contact(name, number, index=index)
def hw_process_contact_match(self, match): """I process a contact match and return a C{Contact} object out of it""" from vmc.common.persistent import Contact if int(match.group('raw')) == 0: name = match.group('name').decode('utf8','ignore').rstrip('\x1f') else: encoding = match.group('name')[:2] hexbytes = match.group('name')[2:] if encoding == '80': # example '80058300440586FF' name = unpack_ucs2_bytes_in_ts31101_80(hexbytes) elif encoding == '81': # example '810602A46563746F72FF' name = unpack_ucs2_bytes_in_ts31101_81(hexbytes) elif encoding == '82': # example '820505302D82D32D31' name = unpack_ucs2_bytes_in_ts31101_82(hexbytes) else: name = "Unsupported encoding" number = from_ucs2(match.group('number')) index = int(match.group('id')) return Contact(name, number, index=index)
def __init__(self, stat, long_name, short_name, netid, rat): super(NetworkOperator, self).__init__(int(netid)) self.stat = stat self.long_name = from_ucs2(long_name) self.short_name = from_ucs2(short_name) self.rat = rat