return local file contents as endpoint.
198114
def read(self, _file):
        """"""
        with open(_file) as fh:
            data = fh.read()
            if self.verbose:
                sys.stdout.write("read %d bytes from %s\n"
                                 % (fh.tell(), _file))
        return data
155878
def files(self):
        """"""
        contents = self.paths
        contents = (BinFile(path.path) for path in contents if path.is_file)
        return contents
899102
def file(data, response, **kwargs):
    """"""
    if not data:
        response.content_type = 'text/plain'
        return ''

    if hasattr(data, 'read'):
        name, data = getattr(data, 'name', ''), data
    elif os.path.isfile(data):
        name, data = data, open(data, 'rb')
    else:
        response.content_type = 'text/plain'
        response.status = HTTP_NOT_FOUND
        return 'File not found!'

    response.content_type = mimetypes.guess_type(name, None)[0] or 'application/octet-stream'
    return data
251257
def File(self, path):
    """"""

    return vfs.FileRef(
        client_id=self.client_id, path=path, context=self._context)
431206
def get_file_contents(file_path):
  """"""
  full_path = os.path.join(package_dir, file_path)
  return open(full_path, 'r').read()
416140
def get_local_uri(m, file_names, _):
    
    path = m.group(2)
    result = 0
    for root, _, files in os.walk(path):
        for file_name in files:
            absolute_path = os.path.join(root, file_name)
            file_names.append("file:/{}".format(absolute_path))
            result += os.path.getsize(absolute_path)
    return result
1153524
def get_files(client, bucket, prefix=''):
    """"""
    bucket = client.get_bucket(bucket)
    files = list(bucket.list_blobs(prefix=prefix))    
    return files
317135
def get_local_file(file):
    
    try:
        with open(file.path):
            yield file.path
    except NotImplementedError:
        _, ext = os.path.splitext(file.name)
        with NamedTemporaryFile(prefix='wagtailvideo-', suffix=ext) as tmp:
            try:
                file.open('rb')
                for chunk in file.chunks():
                    tmp.write(chunk)
            finally:
                file.close()
            tmp.flush()
            yield tmp.name
1161374
def files(self):
        """"""
        self._check_session()
        status, data = self._rest.get_request('files')
        return data
1094663
def retrieve(self, url, filename=None, reporthook=None, data=None):
        """"""
        url = unwrap(to_bytes(url))
        if self.tempcache and url in self.tempcache:
            return self.tempcache[url]
        type, url1 = splittype(url)
        if filename is None and (not type or type == 'file'):
            try:
                fp = self.open_local_file(url1)
                hdrs = fp.info()
                fp.close()
                return url2pathname(splithost(url1)[1]), hdrs
            except IOError as msg:
                pass
        fp = self.open(url, data)
        try:
            headers = fp.info()
            if filename:
                tfp = open(filename, 'wb')
            else:
                import tempfile
                garbage, path = splittype(url)
                garbage, path = splithost(path or "")
                path, garbage = splitquery(path or "")
                path, garbage = splitattr(path or "")
                suffix = os.path.splitext(path)[1]
                (fd, filename) = tempfile.mkstemp(suffix)
                self.__tempfiles.append(filename)
                tfp = os.fdopen(fd, 'wb')
            try:
                result = filename, headers
                if self.tempcache is not None:
                    self.tempcache[url] = result
                bs = 1024*8
                size = -1
                read = 0
                blocknum = 0
                if "content-length" in headers:
                    size = int(headers["Content-Length"])
                if reporthook:
                    reporthook(blocknum, bs, size)
                while 1:
                    block = fp.read(bs)
                    if not block:
                        break
                    read += len(block)
                    tfp.write(block)
                    blocknum += 1
                    if reporthook:
                        reporthook(blocknum, bs, size)
            finally:
                tfp.close()
        finally:
            fp.close()

        # raise exception if actual size does not match content-length header
        if size >= 0 and read < size:
            raise ContentTooShortError(
                "retrieval incomplete: got only %i out of %i bytes"
                % (read, size), result)

        return result
610934
def get(self, remote, local=None):
        
        if isinstance(local, file_type):  # open file, leave open
            local_file = local
        elif local is None:  # return string
            local_file = buffer_type()
        else:  # path to file, open, write/close return None
            local_file = open(local, 'wb')

        self.conn.retrbinary("RETR %s" % remote, local_file.write)

        if isinstance(local, file_type):
            pass
        elif local is None:
            contents = local_file.getvalue()
            local_file.close()
            return contents
        else:
            local_file.close()

        return None
1317818
def get_files_from_storage(paths):
        """"""
        for path in paths:
            f = default_storage.open(path)
            f.name = os.path.basename(path)
            try:
                yield f
            except ClientError:
                logger.exception("File not found: %s", path)
204436
def query_file(self, path, fetchall=False, **params):
        """"""

        with self.get_connection() as conn:
            return conn.query_file(path, fetchall, **params)
513903
def file_attribs(location, mode=None, owner=None, group=None, sudo=False):
    """"""
    return dir_attribs(location, mode, owner, group, False, sudo)
241315
def get_files():
    """"""

    files = dict()

    for k, v in request.files.items():
        content_type = request.files[k].content_type or 'application/octet-stream'
        val = json_safe(v.read(), content_type)
        if files.get(k):
            if not isinstance(files[k], list):
                files[k] = [files[k]]
            files[k].append(val)
        else:
            files[k] = val

    return files
694600
def files(self):
        """"""
        contents = self.paths
        contents = (VenvFile(path.path) for path in contents if path.is_file)
        return contents
154992
def parse_files(self, req, name, field):
        """"""
        return get_value(req.files, name, field)