Skip to content

Commit

Permalink
Make PointerIO non-seekable
Browse files Browse the repository at this point in the history
Fixes #9
  • Loading branch information
allanlei committed Sep 29, 2015
1 parent 8dd11bb commit 4bfb670
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions zipstream/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,16 @@ def flush(self):
def next(self):
raise NotImplementedError()

def seek(self, offset, whence=None):
if whence == SEEK_SET:
if offset < 0:
raise ValueError('negative seek value -1')
self.data_pointer = offset
elif whence == SEEK_CUR:
self.data_pointer = max(0, self.data_pointer + offset)
elif whence == SEEK_END:
self.data_pointer = max(0, offset)
return self.data_pointer
# def seek(self, offset, whence=None):
# if whence == SEEK_SET:
# if offset < 0:
# raise ValueError('negative seek value -1')
# self.data_pointer = offset
# elif whence == SEEK_CUR:
# self.data_pointer = max(0, self.data_pointer + offset)
# elif whence == SEEK_END:
# self.data_pointer = max(0, offset)
# return self.data_pointer

def tell(self):
return self.data_pointer
Expand Down

0 comments on commit 4bfb670

Please sign in to comment.