批量还原文件或目录（非强一致接口，调用后请sleep1秒 ）.

        :param fs_ids: 所还原的文件或目录在 PCS 的临时唯一标识 ID 的列表。
        :type fs_ids: list or tuple
        :return: Response 对象
779189
def multi_restore_recycle_bin(self, fs_ids, **kwargs):
        

        data = {
            'param': json.dumps({
                'list': [{'fs_id': fs_id} for fs_id in fs_ids]
            }),
        }
        return self._request('file', 'restore', data=data, **kwargs)
658372
def get_drive_files_list(folder)
      ls = Hash.new
      page_token = nil
      begin
        (files, page_token) = folder.files("pageToken" => page_token)
        files.each do |f|
          ls[f.original_filename] = f
        end
      end while page_token
      return ls
    end
1020048
async def ListFilesystems(self, filters):
        '''
        
        '''
        # map input types to rpc msg
        _params = dict()
        msg = dict(type='Storage',
                   request='ListFilesystems',
                   version=4,
                   params=_params)
        _params['filters'] = filters
        reply = await self.rpc(msg)
        return reply
699450
def iterate_fs(self):
        # type: () -> Iterator[Tuple[Text, FS]]
        
        if self._fs_sequence is None:
            self._fs_sequence = [
                (name, fs)
                for name, (_order, fs) in sorted(
                    self._filesystems.items(), key=itemgetter(1), reverse=True
                )
            ]
        return iter(self._fs_sequence)
24868
def fileinfo(self, fid):
        """"""

        if not isinstance(fid, str):
            raise TypeError("Your file ID must be a string")
        try:
            info = self.conn.make_call_with_cb("getFileinfo", fid).get(timeout=5)
            if not info:
                warnings.warn(
                    f"Your query for file with ID: '{fid}' failed.", RuntimeWarning
                )
            elif fid in self.__files and not self.__files[fid].updated:
                self.__files[fid].fileupdate(info)
        except queue.Empty as ex:
            raise ValueError(
                "lain didn't produce a callback!\n"
                "Are you sure your query wasn't malformed?"
            ) from ex
        return info
510227
def compare_fetch_with_fs(self):
        

        files_on_fs = set(self.payload_files())
        files_in_fetch = set(self.files_to_be_fetched())

        return list(files_in_fetch - files_on_fs)
489006
def ids2strids(ids: Iterable[int]) -> str:
    
    return C.TOKEN_SEPARATOR.join(map(str, ids))
338819
def files(self, request, id):
        
        gist = self.send(request, id).json()
        return gist['files']
224031
def select_fds(read_fds, timeout, selector=AutoSelector):
    
    # Map to ensure that we return the objects that were passed in originally.
    # Whether they are a fd integer or an object that has a fileno().
    # (The 'poll' implementation for instance, returns always integers.)
    fd_map = dict((fd_to_int(fd), fd) for fd in read_fds)

    # Wait, using selector.
    sel = selector()
    try:
        for fd in read_fds:
            sel.register(fd)

        result = sel.select(timeout)

        if result is not None:
            return [fd_map[fd_to_int(fd)] for fd in result]
    finally:
        sel.close()
959025
def getIds(self, query='*:*', fq=None, start=0, rows=1000):
        
        params = {'q': query, 'start': str(start), 'rows': str(rows), 'wt': 'python'}
        if fq is not None:
            params['fq'] = fq
        request = urllib.parse.urlencode(params, doseq=True)
        data = None
        response = {'matches': 0, 'start': start, 'failed': True, 'ids': []}
        try:
            rsp = self.doPost(self.solrBase + '', request, self.formheaders)
            data = eval(rsp.read())
        except Exception:
            pass
        if data is None:
            return response
        response['failed'] = False
        response['matches'] = data['response']['numFound']
        for doc in data['response']['docs']:
            response['ids'].append(doc['id'][0])
        return response
1090069
def _get_sfs_idxs(sizes:Sizes) -> List[int]:
    ""
    feature_szs = [size[-1] for size in sizes]
    sfs_idxs = list(np.where(np.array(feature_szs[:-1]) != np.array(feature_szs[1:]))[0])
    if feature_szs[0] != feature_szs[1]: sfs_idxs = [0] + sfs_idxs
    return sfs_idxs
1330825
def download(self, *ids):
        
        bundles = sublists_of(ids, 20)  # 20 files at once is an API restriction

        for bundle in bundles:
            download_response = self._rpc.DownloadSubtitles(self._token, bundle)

            assert_status(download_response)

            download_data = download_response.get('data')

            for item in download_data:
                subtitle_id = item['idsubtitlefile']
                subtitle_data = item['data']

                decompressed = decompress(subtitle_data)

                yield Result(subtitle_id, decompressed)
1057486
def _list_directory(self, folder_id=''):
    
        '''  '''
        
        title = '%s._list_directory' % self.__class__.__name__
        
    # construct default response
        file_list = []
    
    # construct request kwargs
        list_kwargs = {
            'spaces': self.drive_space,
            'fields': 'nextPageToken, files(id, name, parents, mimeType)'
        }
    
    # add query field for parent
        if folder_id:
            list_kwargs['q'] = "'%s' in parents" % folder_id
    
    # retrieve space id
        if not self.space_id:
            self._get_space()
        
    # send request
        page_token = 1
        while page_token:
            try:
                response = self.drive.list(**list_kwargs).execute()
            except:
                raise DriveConnectionError(title)
        
        # populate list from response
            results = response.get('files', [])
            for file in results:
                if not folder_id and file.get('parents', [])[0] != self.space_id:
                    pass
                else:
                    yield file.get('id', ''), file.get('name', ''), file.get('mimeType', '')
    
        # get page token
            page_token = response.get('nextPageToken', None)
            if page_token:
                list_kwargs['pageToken'] = page_token
        
        return file_list
65832
def describe(self: object, fileids: str = None):
        
        started = time.time()

        # Structures to perform counting
        counts = FreqDist()
        tokens = FreqDist()

        # Perform a single pass over paragraphs, tokenize, and counts
        for para in self.paras(fileids):
            counts['paras'] += 1

            for sent in para:
                counts['sents'] += 1

                # Include POS at some point
                for word in sent:
                    counts['words'] += 1
                    tokens[word] += 1

        # Compute the number of files in the corpus
        n_fileids = len(self.fileids())

        # Return data structure with information
        return {
            'files': n_fileids,
            'paras': counts['paras'],
            'sents': counts['sents'],
            'words': counts['words'],
            'vocab': len(tokens),
            'lexdiv': round((counts['words'] / len(tokens)), 3),
            'ppdoc': round((counts['paras'] / n_fileids), 3),
            'sppar':round((counts['sents'] / counts['paras']), 3),
            'secs': round((time.time()-started), 3),
        }
692310
def get_open_fds():
    
    pid = os.getpid()
    procs = subprocess.check_output(["lsof", '-w', '-Ff', "-p", str(pid)])
    procs = procs.decode("utf-8")

    return len([s for s in procs.split('\n')
                if s and s[0] == 'f' and s[1:].isdigit()])
510960
def get_file_paths(self, id_list):
        
        if id_list is None:
            return []
        try:
            path_array = self._table[id_list - 1]['path']
        except IndexError:
            print("IndexError ", len(self._table), id_list)
            path_array = []
        return [path for path in path_array]
460971
def query_ids(self, ids):
        

        results = self._get_repo_filter(Layer.objects).filter(uuid__in=ids).all()

        if len(results) == 0:  # try services
            results = self._get_repo_filter(Service.objects).filter(uuid__in=ids).all()

        return results