All Samples(546) | Call(515) | Derive(0) | Import(31)
copy data from file-like object fsrc to file-like object fdst
def copyfileobj(fsrc, fdst, length=16*1024):
"""copy data from file-like object fsrc to file-like object fdst"""
while 1:
buf = fsrc.read(length)
if not buf:
break
fdst.write(buf)
def copyfile(self, source, outputfile):
shutil.copyfileobj(source, outputfile)
def guess_type(self, path):
base, ext = posixpath.splitext(path)
if ext in self.extensions_map:
return self.extensions_map[ext]
src/p/y/pyjamas-0.7/examples/flowplayer/server.py Pyjamas(Download)
def copyfile(self, source, outputfile):
shutil.copyfileobj(source, outputfile)
def guess_type(self, path):
base, ext = posixpath.splitext(path)
if ext in self.extensions_map:
return self.extensions_map[ext]
src/p/y/python-cookbook-HEAD/cb2_examples/cb2_13_12_sol_1.py python-cookbook(Download)
def copyfile(self, source, outputfile):
shutil.copyfileobj(source, outputfile)
def main(HandlerClass = MyHTTPRequestHandler,
ServerClass = BaseHTTPServer.HTTPServer):
BaseHTTPServer.test(HandlerClass, ServerClass)
if __name__ == '__main__':
main()
src/m/i/milkcrate-HEAD/MoinMoin/server/standalone.py milkcrate(Download)
shows that for the typical static files we serve, 8K buffer is
faster than the default 16K buffer.
"""
shutil.copyfileobj(source, outputfile, length=self.bufferSize)
def memoryProfileDecorator(func, profile):
src/p/y/python-ftputil-HEAD/ftp_sync.py python-ftputil(Download)
try:
target = self._target.open(target_file, "wb")
try:
shutil.copyfileobj(source, target, length=CHUNK_SIZE)
finally:
target.close()
finally:
src/z/a/zamboni-lib-HEAD/lib/python/werkzeug/datastructures.py zamboni-lib(Download)
the `length` parameter of
:func:`shutil.copyfileobj`.
"""
from shutil import copyfileobj
close_dst = False
if isinstance(dst, basestring):
dst = file(dst, 'wb')
close_dst = True
try:
copyfileobj(self.stream, dst, buffer_size)
src/u/l/uliweb-HEAD/uliweb/lib/werkzeug/utils.py uliweb(Download)
def save(self, dst, buffer_size=16384):
"""Save the file to a destination path or file object. If the
destination is a file object you have to close it yourself after the
call. The buffer size is the number of bytes held in the memory
during the copy process. It defaults to 16KB.
"""
from shutil import copyfileobj
close_dst = False
if isinstance(dst, basestring):
dst = file(dst, 'wb')
close_dst = True
try:
copyfileobj(self.stream, dst, buffer_size)
src/w/e/webnest-HEAD/env/lib/python2.6/site-packages/werkzeug/datastructures.py webnest(Download)
the `length` parameter of
:func:`shutil.copyfileobj`.
"""
from shutil import copyfileobj
close_dst = False
if isinstance(dst, basestring):
dst = file(dst, 'wb')
close_dst = True
try:
copyfileobj(self.stream, dst, buffer_size)
src/r/o/roundup-HEAD/roundup/trunk/roundup/install_util.py roundup(Download)
try:
fsrc = open(src, 'r')
fdst = DigestFile(dst)
shutil.copyfileobj(fsrc, fdst)
finally:
if fdst: fdst.close()
if fsrc: fsrc.close()
src/u/l/Uliweb-0.0.1a2/uliweb/lib/werkzeug/utils.py Uliweb(Download)
the `length` parameter of
:func:`shutil.copyfileobj`.
"""
from shutil import copyfileobj
close_dst = False
if isinstance(dst, basestring):
dst = file(dst, 'wb')
close_dst = True
try:
copyfileobj(self.stream, dst, buffer_size)
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next