Skip to content

Commit 57af106

Browse files
committed
Reorganizes files into data,object,and parser modules with the replay.py file as the entry point to the parser.
1 parent a17778d commit 57af106

File tree

12 files changed

+17
-16
lines changed

12 files changed

+17
-16
lines changed

data/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from abilities import abilities
2+
from units import units
File renamed without changes.
File renamed without changes.

objects/event.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from utils.abilities import abilities
1+
from data import abilities
22

33
class Event(object):
44
def __call__(self,elapsedTime,eventType,globalFlag,playerId,eventCode,bytes):

parsers/attributeParsers.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
from collections import defaultdict
22

33
from objects.attribute import Attribute
4-
5-
from utils.bytestream import ByteStream
4+
from objects.bytestream import ByteStream
65

76
class AttributeParser(object):
87
def load(self,replay,filecontents):

parsers/detailParsers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from time import ctime
22

33
from objects.player import Player
4-
from utils.bytestream import ByteStream
4+
from objects.bytestream import ByteStream
55

66

77
class DetailParser(object):

parsers/eventParsers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from objects.event import *
2-
from utils.bytestream import ByteStream
2+
from objects.bytestream import ByteStream
33

44

55
class EventParser(object):

parsers/messageParsers.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1+
from objects.bytestream import ByteStream
12
from objects.message import Message
2-
from utils.bytestream import ByteStream
3-
43

54
class MessageParser(object):
65
def load(self,replay,filecontents):

objects/replay.py renamed to replay.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from mpyq import MPQArchive
55

66
from parsers import parserLookup
7-
from utils.bytestream import ByteStream
7+
from objects.bytestream import ByteStream
88

99

1010
class Replay(object):
@@ -114,3 +114,12 @@ def processResults(self):
114114

115115
for player in self.players[1:]:
116116
player.result = self.results[player.team]
117+
118+
if __name__ == '__main__':
119+
from pprint import PrettyPrinter
120+
pprint = PrettyPrinter(indent=2).pprint
121+
122+
replay = Replay(r'C:\Users\graylinkim\Documents\StarCraft II\Accounts\55711209\1-S2-1-2358439\Replays\Unsaved\Arid Wastes.SC2Replay')
123+
print "%s on %s - played: %s" % (replay.type,replay.map,replay.date)
124+
for player in replay.players[1:]:
125+
print "%s: %s" % (player,player.result)

0 commit comments

Comments
 (0)