Query all uncompleted multipart uploads.
175048
def query_expired(cls, dt, bucket=None):
        """"""
        q = cls.query.filter(cls.created < dt).filter_by(completed=True)
        if bucket:
            q = q.filter(cls.bucket_id == as_bucket_id(bucket))
        return q
149568
def _compute_all_files(self):
        """"""
        self._all_files = any(pat.all_files() for pat in self.patterns)
1145980
def get_all_cleaned_data(self):
        
        cleaned_data = {}
        for form_key in self.get_form_list():
            form_obj = self.get_form(
                step=form_key,
                data=self.storage.get_step_data(form_key),
                files=self.storage.get_step_files(form_key)
            )
            if form_obj.is_valid():
                if isinstance(form_obj.cleaned_data, (tuple, list)):
                    cleaned_data.update({
                        'formset-%s' % form_key: form_obj.cleaned_data
                    })
                else:
                    cleaned_data.update(form_obj.cleaned_data)
        return cleaned_data
367154
def files(self):
        
        files = FormsDict()
        for name, item in self.POST.allitems():
            if isinstance(item, FileUpload):
                files[name] = item
        return files
1059399
def multipart_upload_lister(bucket, key_marker='',
                            upload_id_marker='',
                            headers=None):
    
    more_results = True
    k = None
    while more_results:
        rs = bucket.get_all_multipart_uploads(key_marker=key_marker,
                                              upload_id_marker=upload_id_marker,
                                              headers=headers)
        for k in rs:
            yield k
        key_marker = rs.next_key_marker
        upload_id_marker = rs.next_upload_id_marker
        more_results= rs.is_truncated
252247
def recent_uploads(limit = nil, offset = nil, page = nil)
      args = {
        "limit" => limit,
        "offset" => offset,
        "page" => page
      }.reject { |_, v| v.nil? }
      if args.size > 0
        search = "?"
        args.each { |k, v| search += "#{k}=#{v}&" }
      else
        search = ""
      end

      result = access_token.get("#{API_BASE}#{API_PATH}recent_uploads#{search}")
      raise ServiceError.new(result.code, result.body) unless result.code == "200"

      JSON.parse(result.body)["recent_uploads"].map { |icon| Icon.new(icon) }
    end
495592
def get_used_files():
    """"""
    import psutil
    loop_over_scanpy_processes = (proc for proc in psutil.process_iter()
                                  if proc.name() == 'scanpy')
    filenames = []
    for proc in loop_over_scanpy_processes:
        try:
            flist = proc.open_files()
            for nt in flist:
                filenames.append(nt.path)
        # This catches a race condition where a process ends
        # before we can examine its files
        except psutil.NoSuchProcess as err:
            pass
    return set(filenames)
188036
def uploads(self):
        
        if self.syncEnabled == True:
            return Uploads(url=self._url + "/uploads",
                           securityHandler=self._securityHandler,
                           proxy_url=self._proxy_url,
                           proxy_port=self._proxy_port)
        return None
853376
def handle_uploaded_files(files, folder=None, is_public=True):
    '''
    '''
    results = []

    for f in files:
        result = handle_uploaded_file(f, folder, is_public)
        results.append(result)
    return results
356472
def find_uncommitted_filefields(sender, instance, **kwargs):
    
    uncommitted = instance._uncommitted_filefields = []

    fields = sender._meta.fields
    if kwargs.get('update_fields', None):
        update_fields = set(kwargs['update_fields'])
        fields = update_fields.intersection(fields)
    for field in fields:
        if isinstance(field, FileField):
            fieldfile = getattr(instance, field.name)
            if fieldfile and not fieldfile._committed:
                uncommitted.append(field.name)
508306
def check_missing_files(client):
    """"""
    missing = defaultdict(list)

    for path, dataset in client.datasets.items():
        for file in dataset.files:
            filepath = (path.parent / file)
            if not filepath.exists():
                missing[str(
                    path.parent.relative_to(client.renku_datasets_path)
                )].append(
                    os.path.normpath(str(filepath.relative_to(client.path)))
                )

    if not missing:
        return True

    click.secho(
        WARNING + 'There are missing files in datasets.'
        # '\n  (use "renku dataset clean <name>" to clean them)'
    )

    for dataset, files in missing.items():
        click.secho(
            '\n\t' + click.style(dataset, fg='yellow') + ':\n\t  ' +
            '\n\t  '.join(click.style(path, fg='red') for path in files)
        )

    return False
128957
def get_unattached_volumes(self):
        
        volumes = {}
        ignored_tags = dbconfig.get('ignore_tags', self.ns)
        for volume in EBSVolume.get_all().values():
            issue_id = get_resource_id('evai', volume.id)

            if len(volume.attachments) == 0:
                if len(list(filter(set(ignored_tags).__contains__, [tag.key for tag in volume.tags]))):
                    continue

                volumes[issue_id] = volume

        return volumes
1064387
def _all(self, query):
        """"""
        if query.count() > 0:
            results = query.all()
            for result in results:
                if result.has_expired(self._expirations):
                    raise NotFoundError
            return results
        else:
            raise NotFoundError
828208
public function processAll()
    {
        $content_range = $this->getContentRange();
        $size = $this->getSize();
        $this->files = [];
        $upload = $this->upload;

        if ($this->logger) {
            $this->logger->debug('Processing uploads', [
                'Content-range' => $content_range,
                'Size' => $size,
                'Upload array' => $upload,
                'Server array' => $this->server,
            ]);
        }

        if ($upload && is_array($upload['tmp_name'])) {
            foreach ($upload['tmp_name'] as $index => $tmp_name) {
                if (empty($tmp_name)) {
                    // Discard empty uploads
                    continue;
                }

                $this->files[] = $this->process(
                    $tmp_name,
                    $upload['name'][$index],
                    $size ? $size : $upload['size'][$index],
                    $upload['type'][$index],
                    $upload['error'][$index],
                    $index,
                    $content_range
                );
            }
        } else {
            if ($upload && ! empty($upload['tmp_name'])) {
                $this->files[] = $this->process(
                    $upload['tmp_name'],
                    $upload['name'],
                    $size ? $size : (isset($upload['size']) ? $upload['size'] : $this->getContentLength()),
                    isset($upload['type']) ? $upload['type'] : $this->getContentType(),
                    $upload['error'],
                    0,
                    $content_range
                );
            } else {
                if ($upload && $upload['error'] != 0) {
                    // $this->fileContainer is empty at this point
                    // $upload['tmp_name'] is also empty
                    // So we create a File instance from $upload['name']
                    $file = new File($upload['name'], basename($upload['name']));
                    $file->error = $this->getMessage($upload['error']);
                    $file->errorCode = $upload['error'];
                    $this->files[] = $file;
                }
            }
        }

        return [$this->files, $this->getNewHeaders($this->files, $content_range)];
    }
1320300
def _upload_files(item, files, upload_kwargs, prev_identifier=None, archive_session=None):
    """"""
    responses = []
    if (upload_kwargs['verbose']) and (prev_identifier != item.identifier):
        print('{0}:'.format(item.identifier))

    try:
        response = item.upload(files, **upload_kwargs)
        responses += response
    except HTTPError as exc:
        responses += [exc.response]
    finally:
        # Debug mode.
        if upload_kwargs['debug']:
            for i, r in enumerate(responses):
                if i != 0:
                    print('---')
                headers = '\n'.join(
                    [' {0}:{1}'.format(k, v) for (k, v) in r.headers.items()]
                )
                print('Endpoint:\n {0}\n'.format(r.url))
                print('HTTP Headers:\n{0}'.format(headers))
                return responses

        # Format error message for any non 200 responses that
        # we haven't caught yet,and write to stderr.
        if responses and responses[-1].status_code and responses[-1].status_code != 200:
            if not responses[-1].status_code:
                return responses
            filename = responses[-1].request.url.split('/')[-1]
            try:
                msg = get_s3_xml_text(responses[-1].content)
            except:
                msg = responses[-1].content
            print(' error uploading {}: {}'.format(filename, msg), file=sys.stderr)

    return responses
86813
def unsaved_files_dialog(
            self, all_files=False, with_cancel=True, with_discard=True):
        """"""
        for image in self.images:
            if image.metadata.changed() and (all_files or image.selected):
                break
        else:
            return True
        dialog = QtWidgets.QMessageBox()
        dialog.setWindowTitle(self.tr('Photini: unsaved data'))
        dialog.setText(self.tr('<h3>Some images have unsaved metadata.</h3>'))
        dialog.setInformativeText(self.tr('Do you want to save your changes?'))
        dialog.setIcon(QtWidgets.QMessageBox.Warning)
        buttons = QtWidgets.QMessageBox.Save
        if with_cancel:
            buttons |= QtWidgets.QMessageBox.Cancel
        if with_discard:
            buttons |= QtWidgets.QMessageBox.Discard
        dialog.setStandardButtons(buttons)
        dialog.setDefaultButton(QtWidgets.QMessageBox.Save)
        result = dialog.exec_()
        if result == QtWidgets.QMessageBox.Save:
            self._save_files()
            return True
        return result == QtWidgets.QMessageBox.Discard
311985
def missing_input_files(self):
        
        ret_dict = OrderedDict()
        for link in self._links.values():
            link_dict = link.missing_input_files()
            for key, value in link_dict.items():
                try:
                    ret_dict[key] += value
                except KeyError:
                    ret_dict[key] = value
        return ret_dict