Skip to content

Commit 714bec4

Browse files
committed
Few naming corrections
1 parent 090fe46 commit 714bec4

File tree

5 files changed

+14
-9
lines changed

5 files changed

+14
-9
lines changed

sc2reader/eventparsers.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ def load(self, event, bytes):
112112
for i in range(0, totalUnits):
113113
unit_id, use_count = bytes.get_big_int(2), bytes.get_big_int(2)
114114
else:
115-
#We're not byte aligned, so need do so some bit shifting
116-
#This seems like 1000% wrong to me, but its what the people
115+
#We're not byte aligned, so need do so some bit shifting
116+
#This seems like 1000% wrong to me, but its what the people
117117
#at phpsc2replay think it is so I'll deal for now
118118
tail_mask = 0xFF >> (8-extras)
119119
head_mask = ~tail_mask & 0xFF
@@ -185,11 +185,11 @@ def load(self, event, bytes):
185185

186186
#Because we went bit by bit the mask is different so we
187187
#take the deselect bits used on the last_byte, add the two
188-
#bits left bits we've carried down, we need a mask that long
188+
#bits left bits we've carried down, we need a mask that long
189189
else:
190190
mask = (1 << (deselect_count+2)) - 1
191191

192-
#deselect by byte, I think (deselect_type & 3 == 3) is deselect all
192+
#deselect by byte,I think (deselect_type & 3 == 3) is deselect all
193193
#and as such probably has a deselect_count always == 0, not sure though
194194
else:
195195
#use the 6 left bits on top and the 2 right bits on bottom
@@ -228,7 +228,7 @@ def load(self, event, bytes):
228228
#Build the unit_type_id over the next 3 bytes
229229
byte_list = list()
230230
for i in range(0, 3):
231-
#Swap the bytes, grab another, and combine w/ the mask
231+
#Swap the bytes, grab another, and combine w/ the mask
232232
last_byte, next_byte = next_byte, bytes.get_big_int(1)
233233
byte_list.append( combine(last_byte, next_byte) )
234234
unit_type_id = byte_list[0] << 16 | byte_list[1] << 8 | byte_list[2]

sc2reader/parsers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def load(self, replay, filecontents):
9191
if player.type == "Computer":
9292
player.recorder = False
9393

94-
class attribute_parser_17326(attribute_parser):
94+
class AttributeParser_17326(attribute_parser):
9595
def load_header(self, replay, bytes):
9696
bytes.skip(5, byte_code=True) #Always start with 4 nulls
9797
self.count = bytes.get_little_int(4) #get total attribute count

sc2reader/replay.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,12 @@ def __init__(self, replay, partial_parse=True, full_parse=True):
3131
self.frames = None # Integer representing FPS
3232

3333
# TODO: Change to something better
34+
# http://en.wikipedia.org/wiki/Epoch_(reference_date)
35+
# Notice that Windows and Mac have different EPOCHs, I wonder whether
36+
# this is different depending on the OS on which the replay was played.
3437
self.date = "" # Date when the game was played
38+
39+
3540
# TODO: hide this?
3641
self.files = dict() # From the mpq lib
3742
# TODO: investigate where this gets set
@@ -79,8 +84,8 @@ def _parse_header(self):
7984
#Assign all the relevant information to the replay object
8085
self.build = data[1][4]
8186
self.versions = (data[1][1], data[1][2], data[1][3], self.build)
82-
self.releaseString = "%s.%s.%s.%s" % self.versions
83-
self.frames,self.seconds = (data[3], data[3]/16)
87+
self.release_string = "%s.%s.%s.%s" % self.versions
88+
self.frames, self.seconds = (data[3], data[3]/16)
8489
self.length = (self.seconds/60, self.seconds%60)
8590

8691
def _parse_details(self):

sc2reader/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def get_little(self, number, byte_code=False):
4747
return result, byte_string
4848
return result
4949

50-
def getString(self, length, byte_code=False):
50+
def get_string(self, length, byte_code=False):
5151
string, bytes = self.get_big(length, byte_code=True)
5252
if byte_code:
5353
return string.decode("hex"), bytes

test_replays/.DS_Store

6 KB
Binary file not shown.

0 commit comments

Comments
 (0)