Show More
@@ -968,13 +968,15 b' class chunkbuffer(object):' | |||
|
968 | 968 | self.iter = splitbig(in_iter) |
|
969 | 969 | self._queue = deque() |
|
970 | 970 | |
|
971 | def read(self, l): | |
|
971 | def read(self, l=None): | |
|
972 | 972 | """Read L bytes of data from the iterator of chunks of data. |
|
973 |
Returns less than L bytes if the iterator runs dry. |
|
|
973 | Returns less than L bytes if the iterator runs dry. | |
|
974 | ||
|
975 | If size parameter is ommited, read everything""" | |
|
974 | 976 | left = l |
|
975 | 977 | buf = [] |
|
976 | 978 | queue = self._queue |
|
977 | while left > 0: | |
|
979 | while left is None or left > 0: | |
|
978 | 980 | # refill the queue |
|
979 | 981 | if not queue: |
|
980 | 982 | target = 2**18 |
@@ -987,8 +989,9 b' class chunkbuffer(object):' | |||
|
987 | 989 | break |
|
988 | 990 | |
|
989 | 991 | chunk = queue.popleft() |
|
992 | if left is not None: | |
|
990 | 993 | left -= len(chunk) |
|
991 | if left < 0: | |
|
994 | if left is not None and left < 0: | |
|
992 | 995 | queue.appendleft(chunk[left:]) |
|
993 | 996 | buf.append(chunk[:left]) |
|
994 | 997 | else: |
General Comments 0
You need to be logged in to leave comments.
Login now