MCPcopy Index your code
hub / github.com/fluentpython/example-code-2e / _file_iter_range

Function _file_iter_range

21-async/mojifinder/bottle.py:2443–2450  ·  view source on GitHub ↗

Yield chunks from a range in a file. No chunk is bigger than maxread.

(fp, offset, bytes, maxread=1024*1024)

Source from the content-addressed store, hash-verified

2441
2442
2443def _file_iter_range(fp, offset, bytes, maxread=1024*1024):
2444 ''' Yield chunks from a range in a file. No chunk is bigger than maxread.'''
2445 fp.seek(offset)
2446 while bytes > 0:
2447 part = fp.read(min(bytes, maxread))
2448 if not part: break
2449 bytes -= len(part)
2450 yield part
2451
2452
2453def static_file(filename, root, mimetype='auto', download=False, charset='UTF-8'):

Callers 1

static_fileFunction · 0.85

Calls 1

readMethod · 0.80

Tested by

no test coverage detected