Convert an array of binary data to the iBeacon uuid format.
328431
def data_to_uuid(data):
    """"""
    string = data_to_hexstring(data)
    return string[0:8]+'-'+string[8:12]+'-'+string[12:16]+'-'+string[16:20]+'-'+string[20:32]
1018120
def to_binary_string(self, code, identifier):
        """"""
        return struct.pack(self.FORMAT, self.COMMAND, code, identifier)
685316
function fromNobleUuid(uuid) {
	if (uuid.length !== 32) return uuid;
	return (
		uuid.substring(0, 8) +
		'-' +
		uuid.substring(8, 12) +
		'-' +
		uuid.substring(12, 16) +
		'-' +
		uuid.substring(16, 20) +
		'-' +
		uuid.substring(20)
	);
}
974527
def uuid(self, value):
        """"""
        if value is not None:
            self.keystore['id'] = value
        elif 'id' in self.keystore:
            self.keystore.pop('id')
875229
function encodeAsBinary(obj, callback) {

  function writeEncoding(bloblessData) {
    var deconstruction = binary.deconstructPacket(bloblessData);
    var pack = encodeAsString(deconstruction.packet);
    var buffers = deconstruction.buffers;

    buffers.unshift(pack); // add packet info to beginning of data list
    callback(buffers); // write all the buffers
  }

  binary.removeBlobs(obj, writeEncoding);
}
239650
function base64toBlob(base64Data, contentType, sliceSize) {
        contentType = contentType || '';
        sliceSize = sliceSize || 512;

        var byteCharacters = atob(base64Data);
        var byteArrays = [];

        for (var offset = 0; offset < byteCharacters.length; offset += sliceSize) {
            var slice = byteCharacters.slice(offset, offset + sliceSize);
            var byteNumbers = new Array(slice.length);
            for (var i = 0; i < slice.length; i++) {
                byteNumbers[i] = slice.charCodeAt(i);
            }
            var byteArray = new Uint8Array(byteNumbers);
            byteArrays.push(byteArray);
        }

        return new Blob(byteArrays, {type: contentType});
    }
652158
def bytes_to_uuid_list(byte_array):
    
    result = []
    for i in range(0, len(byte_array)//16):
        result.append(uuid.UUID(bytes=bytes(byte_array[i*16:i*16+16])))
    return result
747564
def to_binary_string(self):
        """"""
        if self.priority not in self.PRIORITIES:
            raise NotificationInvalidPriorityError()

        try:
            token = binascii.unhexlify(self.token)
        except TypeError as error:
            raise NotificationTokenUnhexlifyError(error)

        try:
            payload = json.dumps(self.payload)
        except TypeError:
            raise NotificationPayloadNotSerializableError()

        fmt = ">BIBH{0}sBH{1}sBHIBHIBHB".format(len(token), len(payload))

        expire = (0 if self.expire == self.EXPIRE_IMMEDIATELY else
                  datetime_to_timestamp(self.expire))

        # |COMMAND|FRAME-LEN|{token}|{payload}|{id:4}|{expire:4}|{priority:1}
        # 5 items, each 3 bytes prefix, then each item length
        length = 3*5 + len(token) + len(payload) + 4 + 4 + 1
        message = struct.pack(fmt, self.COMMAND, length,
                              self.TOKEN, len(token), token,
                              self.PAYLOAD, len(payload), payload,
                              self.NOTIFICATION_ID, 4, self.iden,
                              self.EXPIRE, 4, expire,
                              self.PRIORITY, 1, self.priority)
        return message
413091
def to_binary(key = nil, jwe = nil)
      if not key.nil?
        jwe ||= kty.key_encryptor(fields, key)
      end
      if key and jwe
        return to_map(key, jwe).compact
      else
        return JOSE.encode(to_map)
      end
    end
335859
def _deconstruct_binary(self, data):
        """"""
        attachments = []
        data = self._deconstruct_binary_internal(data, attachments)
        return data, attachments
159559
def toUnicode(s):
    
    if isinstance(s, six.binary_type):
        s = s.decode('utf-8')
    return s
1212567
function stringToBinaryUUID(value) {
    // for compatiblity reason check if value is already converted...
    if (typeof value !== "string") {
        return value;
    }
    const hex = value.replace(/[{}-]/g, ""); // remove extra characters
    const buffer = new Buffer(hex, "hex");
    return new mongodb_1.Binary(buffer, mongodb_1.Binary.SUBTYPE_UUID);
}
1342094
def attributesToBinary(cls, attributes):
        
        chunks = [(int(k), v) for k, v in iteritems(attributes) if cls._isValidChunkName(k)]
        chunks.sort()
        numChunks = int(attributes[u'numChunks'])
        if numChunks:
            serializedJob = b''.join(v for k, v in chunks)
            compressed = base64.b64decode(serializedJob)
            if compressed[0] == b'C'[0]:
                binary = bz2.decompress(compressed[1:])
            elif compressed[0] == b'U'[0]:
                binary = compressed[1:]
            else:
                raise RuntimeError('Unexpected prefix {}'.format(compressed[0]))
        else:
            binary = None
        return binary, numChunks
1234185
def prepare_uuid(data, schema):
    
    if isinstance(data, uuid.UUID):
        return str(data)
    else:
        return data
835701
public static int writeUUID(byte[] target, int offset, UUID value) {
        writeLong(target, offset, value.getMostSignificantBits());
        writeLong(target, offset + Long.BYTES, value.getLeastSignificantBits());
        return 2 * Long.BYTES;
    }
555431
def conv_uuid(self, column, name, **kwargs):
        """"""
        return [f(column, name, **kwargs) for f in self.uuid_filters]
217300
def uuid2buid(value):
    
    if six.PY3:  # pragma: no cover
        return urlsafe_b64encode(value.bytes).decode('utf-8').rstrip('=')
    else:
        return six.text_type(urlsafe_b64encode(value.bytes).rstrip('='))