Remove partion from disk
        :param disk: device path (/dev/sda, /dev/sdb, etc...)
        :param number: Partition number (starting from 1)
772747
def rmpart(self, disk, number):
        
        args = {
            'disk': disk,
            'number': number,
        }

        self._rmpart_chk.check(args)

        response = self._client.raw('disk.rmpart', args)

        result = response.get()

        if result.state != 'SUCCESS':
            raise RuntimeError('failed to remove partition: %s' % result.stderr)
1301200
def rm(self, path):
        """"""

        resp = self._sendRequest("DELETE", path)
        # By documentation server must return 200 "OK", but I get 204 "No Content".
        # Anyway file or directory have been removed.
        if not (resp.status_code in (200, 204)):
            raise YaDiskException(resp.status_code, resp.content)
40841
@Override
    public boolean remove(Object o) {

        synchronized (partitions) {
            boolean remove = getPartitions().remove(o);
            updateCache();
            return remove;
        }
    }
268416
public final Operation setPartitionId(int partitionId) {
        this.partitionId = partitionId;
        setFlag(partitionId > Short.MAX_VALUE, BITMASK_PARTITION_ID_32_BIT);
        return this;
    }
828001
def getinfo(self, disk, part=''):
        
        args = {
            "disk": disk,
            "part": part,
        }

        self._getpart_chk.check(args)

        response = self._client.raw('disk.getinfo', args)

        result = response.get()

        if result.state != 'SUCCESS':
            raise RuntimeError('failed to get info: %s' % result.data)

        if result.level != 20:  # 20 is JSON output.
            raise RuntimeError('invalid response type from disk.getinfo command')

        data = result.data.strip()
        if data:
            return json.loads(data)
        else:
            return {}
1140670
def remove_path_dirname(path):
        
        dir_to_remove = os.path.dirname(path)
        if not os.listdir(dir_to_remove):
            shutil.rmtree(dir_to_remove)
        else:
            if len(os.listdir(dir_to_remove)) == 1:
                if os.listdir(dir_to_remove)[0].startswith('.'):
                    shutil.rmtree(dir_to_remove)
641478
def delete_dcnm_out_part(self, tenant_id, fw_dict, is_fw_virt=False):
        
        res = fw_const.DCNM_OUT_PART_DEL_SUCCESS
        tenant_name = fw_dict.get('tenant_name')
        ret = True
        try:
            self._delete_partition(tenant_id, tenant_name)
        except Exception as exc:
            LOG.error("deletion of Out Partition failed for tenant "
                      "%(tenant)s, Exception %(exc)s",
                      {'tenant': tenant_id, 'exc': str(exc)})
            res = fw_const.DCNM_OUT_PART_DEL_FAIL
            ret = False
        self.update_fw_db_result(tenant_id, dcnm_status=res)
        LOG.info("Out partition deleted")
        return ret
1282732
def umount_partitions(device)
      partitions = mountable_partitions(device)

      @log.trace "Unmounting partitions..."
      partitions.reverse.each { |part| umount_partition(part) }
      @log.trace "All partitions unmounted."
    end
982245
def umount(self, source):
        

        args = {
            'source': source,
        }
        self._umount_chk.check(args)

        response = self._client.raw('disk.umount', args)

        result = response.get()

        if result.state != 'SUCCESS':
            raise RuntimeError('failed to umount partition: %s' % result.stderr)
1355968
def _delete_device_from_device_group(self, device):
        '''
        '''

        device_name = get_device_info(device).name
        dg = pollster(self._get_device_group)(device)
        device_to_remove = dg.devices_s.devices.load(
            name=device_name, partition=self.partition
        )
        device_to_remove.delete()
204632
def disk_toggle(device, flag):
    '''
    
    '''
    _validate_device(device)

    if flag not in VALID_DISK_FLAGS:
        raise CommandExecutionError('Invalid flag passed to partition.disk_toggle')

    cmd = ['parted', '-m', '-s', device, 'disk_toggle', flag]
    out = __salt__['cmd.run'](cmd).splitlines()
    return out
527493
def toggle(device, partition, flag):
    '''
    
    '''
    _validate_device(device)

    try:
        int(partition)
    except Exception:
        raise CommandExecutionError(
            'Invalid partition number passed to partition.toggle'
        )

    if flag not in VALID_PARTITION_FLAGS:
        raise CommandExecutionError('Invalid flag passed to partition.toggle')

    cmd = 'parted -m -s {0} toggle {1} {2}'.format(device, partition, flag)
    out = __salt__['cmd.run'](cmd).splitlines()
    return out
981207
def setPartationId(self, partationId):
        
        print '%s call setPartationId' % self.port
        print partationId

        cmd = WPANCTL_CMD + 'setprop Network:PartitionId %s' %(str(hex(partationId)).rstrip('L'))
        print cmd
        return self.__sendCommand(cmd)[0] != 'Fail'
791170
def _switch_partition() -> RootPartitions:
    
    res = subprocess.check_output(['ot-switch-partitions'])
    for line in res.split(b'\n'):
        matches = re.match(
            b'Current boot partition: ([23]), setting to ([23])',
            line)
        if matches:
            return {b'2': RootPartitions.TWO,
                    b'3': RootPartitions.THREE}[matches.group(2)]
    else:
        raise RuntimeError(f'Bad output from ot-switch-partitions: {res}')
51841
def move_partition(self, partition, broker_destination):
        """"""
        self.remove_partition(partition)
        broker_destination.add_partition(partition)
1060714
def disk2ram(self):
        """"""
        values = self.series
        self.deactivate_disk()
        self.ramflag = True
        self.__set_array(values)
        self.update_fastaccess()
859820
def partition(N, k):
    '''

    '''
    out = [N // k] * k
    remainder = N % k
    for i in range(remainder):
        out[i] += 1
    return out