Check if device can be removed with ``auto_remove``.
423284
def is_removable(self, device):
        """"""
        if not self.is_handleable(device):
            return False
        if device.is_filesystem:
            return device.is_mounted
        if device.is_crypto:
            return device.is_unlocked
        if device.is_partition_table or device.is_drive:
            return any(self.is_removable(dev)
                       for dev in self.get_all_handleable()
                       if _is_parent_of(device, dev))
        return False
1347119
def unbind(self, ticket, device_id, user_id):
        
        return self._post(
            'unbind',
            data={
                'ticket': ticket,
                'device_id': device_id,
                'openid': user_id
            }
        )
442298
def check_removable(dev, opts):
    '''  '''
    try:  # get parent device from sys filesystem, look from right.  :-/
        parent = os.readlink(f'/sys/class/block/{dev}').rsplit("/", 2)[1]
        with open(f'/sys/block/{parent}/removable') as f:
            return f.read() == '1\n'

    except IndexError as err:
        if opts.debug:
            print('ERROR: parent block device not found.', err)
    except IOError as err:
        if opts.debug:
            print('ERROR:', err)
80720
def has_port_profile_to_delete(self, profile_name, device_id):
        """"""
        count = self.session.query(ucsm_model.PortProfileDelete).filter_by(
            profile_id=profile_name, device_id=device_id).count()
        return count != 0
242261
function DetectUbuntuTablet()
   {
      if ((stripos($this->useragent, $this->deviceUbuntu) > -1) &&
		(stripos($this->useragent, $this->deviceTablet) > -1))
         return $this->true;
            
      return $this->false; 
   }
226826
def devices(self):
        """"""
        self.verify_integrity()

        if session.get('u2f_device_management_authorized', False):
            if request.method == 'GET':
                return jsonify(self.get_devices()), 200

            elif request.method == 'DELETE':
                response = self.remove_device(request.json)

                if response['status'] == 'ok':
                    return jsonify(response), 200
                else:
                    return jsonify(response), 404

        return jsonify({'status': 'failed', 'error': 'Unauthorized!'}), 401
955729
def teardown(self):
        ''''''

        self.ensure_all_devices_in_sync()
        for device in self.devices:
            self._delete_device_from_device_group(device)
            self._sync_to_group(device)
            pollster(self._ensure_device_active)(device)
            self.ensure_all_devices_in_sync()
        dg = pollster(self._get_device_group)(self.devices[0])
        dg.delete()
        pollster(self._check_devices_active_licensed)()
        pollster(self._check_all_devices_in_sync)()
651244
def deactivate_mfa_device(self, user_name, serial_number):
        """"""
        user = self.get_user(user_name)
        if serial_number not in user.mfa_devices:
            raise IAMNotFoundException(
                "Device {0} not found".format(serial_number)
            )

        user.deactivate_mfa_device(serial_number)
384083
async def async_delete_device(self, device_id: int) -> None:
        

        # Lookup device using zone to obtain an accurate index, which is
        # needed to perform the delete command
        device = self._devices[device_id]
        response = await self._protocol.async_execute(
            GetDeviceCommand(device.category, device.group_number, device.unit_number))
        if isinstance(response, DeviceInfoResponse):
            response = await self._protocol.async_execute(
                DeleteDeviceCommand(device.category, response.index))
            if isinstance(response, DeviceDeletedResponse):
                self._devices._delete(device) # pylint: disable=protected-access
                if self._on_device_deleted:
                    try:
                        self._on_device_deleted(self, device)  # pylint: disable=protected-access
                    except Exception: # pylint: disable=broad-except
                        _LOGGER.error(
                            "Unhandled exception in on_device_deleted callback",
                            exc_info=True)
        if isinstance(response, DeviceNotFoundResponse):
            raise ValueError("Device to be deleted was not found")
1275013
def device_removed(self, device):
        """"""
        if not self._mounter.is_handleable(device):
            return
        device_file = device.device_presentation
        if (device.is_drive or device.is_toplevel) and device_file:
            self._show_notification(
                'device_removed',
                _('Device removed'),
                _('device disappeared on {0.device_presentation}', device),
                device.icon_name)
137292
async def unlock(self, device):
        
        device = self._find_device(device)
        if not self.is_handleable(device) or not device.is_crypto:
            self._log.warn(_('not unlocking {0}: unhandled device', device))
            return False
        if device.is_unlocked:
            self._log.info(_('not unlocking {0}: already unlocked', device))
            return True
        if not self._prompt:
            self._log.error(_('not unlocking {0}: no password prompt', device))
            return False
        unlocked = await self._unlock_from_cache(device)
        if unlocked:
            return True
        unlocked = await self._unlock_from_keyfile(device)
        if unlocked:
            return True
        options = dict(allow_keyfile=self.udisks.keyfile_support,
                       allow_cache=self._cache is not None,
                       cache_hint=self._cache_hint)
        password = await self._prompt(device, options)
        # password can be: None, str, or udiskie.prompt.PasswordResult
        cache_hint = getattr(password, 'cache_hint', self._cache_hint)
        password = getattr(password, 'password', password)
        if password is None:
            self._log.debug(_('not unlocking {0}: cancelled by user', device))
            return False
        if isinstance(password, bytes):
            self._log.debug(_('unlocking {0} using keyfile', device))
            await device.unlock_keyfile(password)
        else:
            self._log.debug(_('unlocking {0}', device))
            await device.unlock(password)
        self._update_cache(device, password, cache_hint)
        self._log.info(_('unlocked {0}', device))
        return True
240183
def device_changed(self, old_state, new_state):
        """"""
        # udisks2 sometimes adds empty devices and later updates them - which
        # makes is_external become true at a time later than device_added:
        if (self._mounter.is_addable(new_state)
                and not self._mounter.is_addable(old_state)
                and not self._mounter.is_removable(old_state)):
            self.auto_add(new_state)
47451
def _lock(self):
        """"""
        if not self.locked:
            self.device.cu.lock()
            self.locked = True
727007
def delete_device(self, device_id):
        
        api = self._get_api(device_directory.DefaultApi)
        return api.device_destroy(id=device_id)
467210
def UNREACH(self):
        
        if self._VALUES.get(PARAM_UNREACH, False):
            return True
        else:
            for device in self._hmchannels.values():
                if device.UNREACH:
                    return True
        return False
562362
def rm(filename, recursive=False, force=False):
    """"""
    return auto(remove_file, filename, recursive, force)
1232302
def kpl_off(self, address, group):
        """"""
        addr = Address(address)
        device = self.plm.devices[addr.id]
        device.states[group].off()