set the extended addresss of Thread device

        Args:
            xEUI: extended address in hex format

        Returns:
            True: successful to set the extended address
            False: fail to set the extended address
332439
def setMAC(self, xEUI):
        
        print '%s call setMAC' % self.port

        address64 = ''
        try:
            if not xEUI:
                address64 = self.mac

            if not isinstance(xEUI, str):
                address64 = self.__convertLongToString(xEUI)

                # prepend 0 at the beginning
                if len(address64) < 16:
                    address64 = address64.zfill(16)
                    print address64
            else:
                address64 = xEUI

            cmd = WPANCTL_CMD + 'setprop NCP:MACAddress %s' % address64

            if self.__sendCommand(cmd)[0] != 'Fail':
                self.mac = address64
                return True
            else:
                return False
        except Exception, e:
            ModuleHelper.WriteIntoDebugLogger('setMAC() Error: ' + str(e))
808425
def setPANID(self, xPAN):
        
        print '%s call setPANID' % self.port
        print xPAN
        panid = ''
        try:
            if not isinstance(xPAN, str):
                panid = str(hex(xPAN))
                print panid

            cmd = WPANCTL_CMD + 'setprop -s Network:PANID %s' % panid
            datasetCmd = WPANCTL_CMD + 'setprop Dataset:PanId %s' % panid
            self.hasActiveDatasetToCommit = True
            return self.__sendCommand(cmd)[0] != 'Fail' and self.__sendCommand(datasetCmd)[0] != 'Fail'
        except Exception, e:
            ModuleHelper.WriteIntoDebugLogger('setPANID() Error: ' + str(e))
247141
def __set_ethernet_uris(self, ethernet_names, operation="add"):
        """"""
        if not isinstance(ethernet_names, list):
            ethernet_names = [ethernet_names]

        associated_enets = self.data.get('networkUris', [])
        ethernet_uris = []

        for i, enet in enumerate(ethernet_names):
            enet_exists = self._ethernet_networks.get_by_name(enet)
            if enet_exists:
                ethernet_uris.append(enet_exists.data['uri'])
            else:
                raise HPOneViewResourceNotFound("Ethernet: {} does not exist".foramt(enet))

        if operation == "remove":
            enets_to_update = sorted(list(set(associated_enets) - set(ethernet_uris)))
        elif operation == "add":
            enets_to_update = sorted(list(set(associated_enets).union(set(ethernet_uris))))
        else:
            raise ValueError("Value {} is not supported as operation. The supported values are: ['add', 'remove']")

        if set(enets_to_update) != set(associated_enets):
            updated_network = {'networkUris': enets_to_update}
            self.update(updated_network)
138236
def start_linear_address(eip):
        
        b = [4, 0, 0, 0x05, (eip>>24)&0x0FF, (eip>>16)&0x0FF,
             (eip>>8)&0x0FF, eip&0x0FF]
        return Record._from_bytes(b)
859356
def set_iscsi_initiator_info(self, initiator_iqn):
        
        if(self._is_boot_mode_uefi() is True):
            iscsi_uri = self._check_iscsi_rest_patch_allowed()
            initiator_info = {'iSCSIInitiatorName': initiator_iqn}
            status, headers, response = self._rest_patch(iscsi_uri,
                                                         None, initiator_info)
            if status >= 300:
                msg = self._get_extended_error(response)
                raise exception.IloError(msg)
        else:
            msg = 'iSCSI initiator cannot be set in the BIOS boot mode'
            raise exception.IloCommandNotSupportedError(msg)
855750
def _set_serial_console(self):
        

        # activate the first serial port
        yield from self._modify_vm("--uart1 0x3F8 4")

        # set server mode with a pipe on the first serial port
        pipe_name = self._get_pipe_name()
        args = [self._vmname, "--uartmode1", "server", pipe_name]
        yield from self.manager.execute("modifyvm", args)
93046
def set_oem_capping_enabled(self, enable):
        
        # 1 - Enable power capping(default)
        if enable:
            statecode = 1
        # 0 - Disable power capping
        else:
            statecode = 0
        if self.has_tsm:
            self.ipmicmd.xraw_command(netfn=0x3a, command=0x1a,
                                      data=(3, statecode))
            return True
820644
def _u2i(uint32):
    
    v = u2i(uint32)
    if v < 0:
        if exceptions:
            raise ApigpioError(error_text(v))
    return v
524345
def __Address_lineEdit_set_ui(self):
        

        # Adding settings key if it doesn't exists.
        self.__settings.get_key(self.__settings_section, "address").isNull() and \
        self.__settings.set_key(self.__settings_section, "address", self.__address)

        address = self.__settings.get_key(self.__settings_section, "address").toString()
        LOGGER.debug("> Setting '{0}' with value '{1}'.".format("Address_lineEdit",
                                                                address))
        self.__address = address
        self.Address_lineEdit.setText(address)
1266126
def inet_ntoa(address):
    

    if len(address) != 16:
        raise ValueError("IPv6 addresses are 16 bytes long")
    hex = address.encode('hex_codec')
    chunks = []
    i = 0
    l = len(hex)
    while i < l:
        chunk = hex[i : i + 4]
        # strip leading zeros.  we do this with an re instead of
        # with lstrip() because lstrip() didn't support chars until
        # python 2.2.2
        m = _leading_zero.match(chunk)
        if not m is None:
            chunk = m.group(1)
        chunks.append(chunk)
        i += 4
    #
    # Compress the longest subsequence of 0-value chunks to ::
    #
    best_start = 0
    best_len = 0
    start = -1
    last_was_zero = False
    for i in xrange(8):
        if chunks[i] != '0':
            if last_was_zero:
                end = i
                current_len = end - start
                if current_len > best_len:
                    best_start = start
                    best_len = current_len
                last_was_zero = False
        elif not last_was_zero:
            start = i
            last_was_zero = True
    if last_was_zero:
        end = 8
        current_len = end - start
        if current_len > best_len:
            best_start = start
            best_len = current_len
    if best_len > 0:
        if best_start == 0 and \
           (best_len == 6 or
            best_len == 5 and chunks[5] == 'ffff'):
            # We have an embedded IPv4 address
            if best_len == 6:
                prefix = '::'
            else:
                prefix = '::ffff:'
            hex = prefix + dns.ipv4.inet_ntoa(address[12:])
        else:
            hex = ':'.join(chunks[:best_start]) + '::' + \
                  ':'.join(chunks[best_start + best_len:])
    else:
        hex = ':'.join(chunks)
    return hex
596265
def set_ports(self, port0 = 0x00, port1 = 0x00):
        ''
        self.bus.write_byte_data(self.address, self.CONTROL_PORT0, port0)
        self.bus.write_byte_data(self.address, self.CONTROL_PORT0, port1)
        return
196682
def set_pullups(self, port0 = 0x00, port1 = 0x00):
        ''
        self.bus.write_byte_data(self.address, self.PULLUP_PORT0, port0)
        self.bus.write_byte_data(self.address, self.PULLUP_PORT1, port1)
        return
165757
def write_byte(self, address, value):
        
        LOGGER.debug("Writing byte %s to device %s!", bin(value), hex(address))
        return self.driver.write_byte(address, value)
904492
def set_qinq_port(self, port_number, outer_vlan, ethertype):
        

        if port_number not in self._nios:
            raise DynamipsError("Port {} is not allocated".format(port_number))

        nio = self._nios[port_number]
        if ethertype != "0x8100" and parse_version(self.hypervisor.version) < parse_version('0.2.16'):
            raise DynamipsError("Dynamips version required is >= 0.2.16 to change the default QinQ Ethernet type, detected version is {}".format(self.hypervisor.version))

        yield from self._hypervisor.send('ethsw set_qinq_port "{name}" {nio} {outer_vlan} {ethertype}'.format(name=self._name,
                                                                                                              nio=nio,
                                                                                                              outer_vlan=outer_vlan,
                                                                                                              ethertype=ethertype if ethertype != "0x8100" else ""))

        log.info('Ethernet switch "{name}" [{id}]: port {port} set as a QinQ ({ethertype}) port with outer VLAN {vlan_id}'.format(name=self._name,
                                                                                                                                  id=self._id,
                                                                                                                                  port=port_number,
                                                                                                                                  vlan_id=outer_vlan,
                                                                                                                                  ethertype=ethertype))
        self._mappings[port_number] = ("qinq", outer_vlan, ethertype)
1261894
def bind_addr(self, value):
        """"""
        if isinstance(value, tuple) and value[0] in ('', None):
            # Despite the socket module docs, using '' does not
            # allow AI_PASSIVE to work. Passing None instead
            # returns '0.0.0.0' like we want. In other words:
            #     host    AI_PASSIVE     result
            #      ''         Y         192.168.x.y
            #      ''         N         192.168.x.y
            #     None        Y         0.0.0.0
            #     None        N         127.0.0.1
            # But since you can get the same effect with an explicit
            # '0.0.0.0', we deny both the empty string and None as values.
            raise ValueError(
                "Host values of '' or None are not allowed. "
                "Use '0.0.0.0' (IPv4) or '::' (IPv6) instead "
                'to listen on all active interfaces.',
            )
        self._bind_addr = value
97867
def set_flag_bit(self, x):
        
        x = bytes_to_byte(x)
        if KeyTypes.COMM_ENC in self.keys:
            x &= ~0x8
        if KeyTypes.APP_KEY in self.keys:
            x &= ~0x10
        return byte_to_bytes(x)
619228
def is_hex_address(value: Any) -> bool:
    
    if not is_text(value):
        return False
    elif not is_hex(value):
        return False
    else:
        unprefixed = remove_0x_prefix(value)
        return len(unprefixed) == 40