MCPcopy Create free account
hub / github.com/ActiveState/code / patchstream

Function patchstream

recipes/Python/577518_Rsync_Algorithm/recipe-577518.py:140–151  ·  view source on GitHub ↗

Patches instream using the supplied delta and write the resultantant data to outstream.

(instream, outstream, delta)

Source from the content-addressed store, hash-verified

138
139
140def patchstream(instream, outstream, delta):
141 """
142 Patches instream using the supplied delta and write the resultantant
143 data to outstream.
144 """
145 blocksize = delta[0]
146
147 for element in delta[1:]:
148 if isinstance(element, int) and blocksize:
149 instream.seek(element * blocksize)
150 element = instream.read(blocksize)
151 outstream.write(element)
152
153
154def rollingchecksum(removed, new, a, b, blocksize=4096):

Callers

nothing calls this directly

Calls 3

seekMethod · 0.45
readMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected