code
stringlengths
3
6.57k
os.path.isdir(path)
os.makedirs(path)
self.path.append(path)
self.path.insert(index, path)
self.cache.clear()
os.path.exists(path)
__iter__(self)
search.pop()
os.path.isdir(path)
os.listdir(path)
os.path.join(path, name)
os.path.isdir(full)
search.append(full)
lookup(self, name)
os.path.join(path, name)
os.path.isfile(fpath)
in ('all', 'found')
open(self, name, mode='r', *args, **kwargs)
self.lookup(name)
IOError("Resource %r not found." % name)
self.opener(fname, mode=mode, *args, **kwargs)
FileUpload(object)
__init__(self, fileobj, name, filename, headers=None)
file(-like)
object (BytesIO buffer or temporary file)
client (may contain unsafe characters)
headers (e.g. content-type)
HeaderDict(headers)
HeaderDict()
HeaderProperty('Content-Type')
HeaderProperty('Content-Length', reader=int, default=-1)
filename(self)
isinstance(fname, unicode)
fname.decode('utf8', 'ignore')
normalize('NFKD', fname)
encode('ASCII', 'ignore')
decode('ASCII')
os.path.basename(fname.replace('\\', os.path.sep)
re.sub(r'[^a-zA-Z0-9-_.\s]', '', fname)
strip()
re.sub(r'[-\s]+', '-', fname)
strip('.-')
_copy_file(self, fp, chunk_size=2**16)
self.file.tell()
read(chunk_size)
write(buf)
self.file.seek(offset)
save(self, destination, overwrite=False, chunk_size=2**16)
file(-like)
default (IOError)
file(-like)
files. (default: False)
time. (default: 64kb)
isinstance(destination, basestring)
os.path.isdir(destination)
os.path.join(destination, self.filename)
os.path.exists(destination)
IOError('File exists.')
open(destination, 'wb')
self._copy_file(fp, chunk_size)
self._copy_file(destination, chunk_size)
abort(code=500, text='Unknown Error.')
HTTPError(code, text)
redirect(url, code=None)
request.get('SERVER_PROTOCOL')
response.copy(cls=HTTPResponse)
res.set_header('Location', urljoin(request.url, url)
_file_iter_range(fp, offset, bytes, maxread=1024*1024)
fp.seek(offset)
fp.read(min(bytes, maxread)
len(part)
static_file(filename, root, mimetype='auto', download=False, charset='UTF-8')
used (default: False)
type. (default: UTF-8)
os.path.abspath(root)
os.path.abspath(os.path.join(root, filename.strip('/\\')
dict()
filename.startswith(root)
HTTPError(403, "Access denied.")
os.path.exists(filename)
os.path.isfile(filename)
HTTPError(404, "File does not exist.")
os.access(filename, os.R_OK)
HTTPError(403, "You do not have permission to access this file.")
mimetypes.guess_type(filename)
os.path.basename(filename if download == True else download)
os.stat(filename)
time.strftime("%a, %d %b %Y %H:%M:%S GMT", time.gmtime(stats.st_mtime)
request.environ.get('HTTP_IF_MODIFIED_SINCE')
parse_date(ims.split(";")
strip()
int(stats.st_mtime)
time.strftime("%a, %d %b %Y %H:%M:%S GMT", time.gmtime()
HTTPResponse(status=304, **headers)
open(filename, 'rb')
request.environ.get('HTTP_RANGE')
list(parse_range_header(request.environ['HTTP_RANGE'], clen)
HTTPError(416, "Requested Range Not Satisfiable")
str(end-offset)
_file_iter_range(body, offset, end-offset)