Skip to content

Commit decc733

Browse files
committed
import os; not just the SEEK* constants
1 parent a278ade commit decc733

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

sc2reader/utils.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
from cStringIO import StringIO
2-
from os import SEEK_CUR, SEEK_END, SEEK_SET
1+
import cStringIO
2+
import os
33
import struct
4+
45
from itertools import groupby
56

67
LITTLE_ENDIAN,BIG_ENDIAN = '<','>'
@@ -50,12 +51,12 @@ class ReplayBuffer(object):
5051
def __init__(self, file):
5152
#Accept file like objects and string objects
5253
if hasattr(file,'read'):
53-
self.io = StringIO(file.read())
54+
self.io = cStringIO.StringIO(file.read())
5455
else:
55-
self.io = StringIO(file)
56+
self.io = cStringIO.StringIO(file)
5657

5758
# get length of stream
58-
self.io.seek(0, SEEK_END)
59+
self.io.seek(0, os.SEEK_END)
5960
self.length = self.io.tell()
6061
self.io.seek(0)
6162

@@ -85,18 +86,18 @@ def cursor(self): return self.io.tell()
8586
Stream manipulation functions
8687
'''
8788
def tell(self): return self.io.tell()
88-
def skip(self, amount): self.seek(amount, SEEK_CUR)
89+
def skip(self, amount): self.seek(amount, os.SEEK_CUR)
8990
def reset(self): self.io.seek(0); self.bit_shift = 0
9091
def align(self): self.bit_shift=0
91-
def seek(self, position, mode=SEEK_SET):
92+
def seek(self, position, mode=os.SEEK_SET):
9293
self.io.seek(position, mode)
9394
if self.io.tell()!=0 and self.bit_shift!=0:
94-
self.io.seek(-1, SEEK_CUR)
95+
self.io.seek(-1, os.SEEK_CUR)
9596
self.last_byte = ord(self.read_basic(1))
9697

9798
def peek(self, length):
9899
start,last,ret = self.cursor,self.last_byte,self.read_hex(length)
99-
self.seek(start, SEEK_SET)
100+
self.seek(start, os.SEEK_SET)
100101
self.last_byte = last
101102
return ret
102103

0 commit comments

Comments
 (0)