Skip to content

Commit f1de329

Browse files
committed
Remove trailing whitespaces from previous commits.
1 parent 45e9286 commit f1de329

File tree

2 files changed

+38
-38
lines changed

2 files changed

+38
-38
lines changed

sc2reader/resources.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ class GameSummary(Resource):
508508
'SB',
509509
'SRC',
510510
]
511-
511+
512512
#: Game speed
513513
game_speed = str()
514514

@@ -520,7 +520,7 @@ class GameSummary(Resource):
520520

521521
#: Lobby properties
522522
lobby_properties = dict()
523-
523+
524524
#: Lobby player properties
525525
lobby_player_properties = dict()
526526

@@ -544,7 +544,7 @@ class GameSummary(Resource):
544544

545545
#: Map localization urls
546546
localization_urls = dict()
547-
547+
548548
def __init__(self, summary_file, filename=None, **options):
549549
super(GameSummary, self).__init__(summary_file, filename,**options)
550550

@@ -571,7 +571,7 @@ def __init__(self, summary_file, filename=None, **options):
571571
# { 0: 11987, 1: 283385849, 2: 1334719793L}
572572
# 0, 1 might be an adjustment of some sort
573573
self.unknown_time = self.parts[0][2][2]
574-
574+
575575
# this one is alone
576576
self.time = self.parts[0][8]
577577

@@ -591,9 +591,9 @@ def __init__(self, summary_file, filename=None, **options):
591591

592592
player = PlayerSummary(player_struct[0][0])
593593
player.race = RACE_CODES[''.join(reversed(player_struct[2]))]
594-
594+
595595
# TODO: Grab team id from lobby_player_properties
596-
player.teamid = 0
596+
player.teamid = 0
597597

598598
player.is_winner = (player_struct[1][0] == 0)
599599
if player.is_winner:
@@ -604,7 +604,7 @@ def __init__(self, summary_file, filename=None, **options):
604604
player.is_ai = True
605605
else:
606606
player.is_ai = False
607-
607+
608608
player.bnetid = player_struct[0][1][0][3]
609609
player.subregion = player_struct[0][1][0][2]
610610

@@ -614,12 +614,12 @@ def __init__(self, summary_file, filename=None, **options):
614614
# Example:
615615
# { 0: 3405691582L, 1: 11402158793782460416L}
616616
player.unknown2 = player_struct[0][1][1]
617-
617+
618618
self.players[player.pid] = player
619619
if not player.teamid in self.teams:
620620
self.teams[player.teamid] = list()
621621
self.teams[player.teamid].append(player.pid)
622-
622+
623623
# Parse graph and stats stucts, for each player
624624
for pid in self.players:
625625
p = self.players[pid]
@@ -629,15 +629,15 @@ def __init__(self, summary_file, filename=None, **options):
629629

630630
xy = [(o[2], o[0]) for o in self.parts[4][0][1][1][p.pid]]
631631
p.income_graph = Graph([], [], xy_list=xy)
632-
632+
633633
# Stats stuff
634634
stats_struct = self.parts[3][0]
635635
# The first group of stats is located in parts[3][0]
636636
for i in range(len(stats_struct)):
637637
p.stats[self.stats_keys[i]] = stats_struct[i][1][p.pid][0][0]
638638
# The last piece of stats is in parts[4][0][0][1]
639639
p.stats[self.stats_keys[len(stats_struct)]] = self.parts[4][0][0][1][p.pid][0][0]
640-
640+
641641
# Parse map localization data
642642
for l in self.parts[0][6][8]:
643643
lang = l[0]
@@ -647,15 +647,15 @@ def __init__(self, summary_file, filename=None, **options):
647647
if parsed_hash['server'] == '\x00\x00':
648648
continue
649649
urls.append(self.base_url_template.format(parsed_hash['server'], parsed_hash['hash'], parsed_hash['type']))
650-
650+
651651
self.localization_urls[lang] = urls
652652

653653
# Parse map images
654654
for hash in self.parts[0][6][7]:
655655
parsed_hash = utils.parse_hash(hash)
656656
self.image_urls.append(self.base_url_template.format(parsed_hash['server'], parsed_hash['hash'], parsed_hash['type']))
657657

658-
# Parse build orders
658+
# Parse build orders
659659
bo_structs = [x[0] for x in self.parts[5:]]
660660
bo_structs.append(self.parts[4][0][3:])
661661

@@ -665,14 +665,14 @@ def __init__(self, summary_file, filename=None, **options):
665665
bo = list()
666666
for bo_struct in bo_structs:
667667
for order in bo_struct:
668-
668+
669669
if order[0][1] >> 24 == 0x01:
670670
# unit
671671
parsed_order = utils.get_unit(order[0][1])
672672
elif order[0][1] >> 24 == 0x02:
673673
# research
674674
parsed_order = utils.get_research(order[0][1])
675-
675+
676676
for entry in order[1][p.pid]:
677677
bo.append({
678678
'supply' : entry[0],
@@ -683,7 +683,7 @@ def __init__(self, summary_file, filename=None, **options):
683683
})
684684
bo.sort(key=lambda x: x['build_index'])
685685
self.build_orders[p.pid] = bo
686-
686+
687687

688688
def __str__(self):
689689
return "{} - {:0>2}:{:0>2}:{:0>2} {}".format(time.ctime(self.time),
@@ -692,7 +692,7 @@ def __str__(self):
692692
(int(self.game_length)%3600)%60,
693693
'v'.join(''.join(self.players[p].race[0] for p in self.teams[tid]) for tid in self.teams))
694694

695-
695+
696696

697697
class MapInfo(Resource):
698698
url_template = 'http://{0}.depot.battle.net:1119/{1}.s2mi'
@@ -734,7 +734,7 @@ class MapHeader(Resource):
734734

735735
#: Link to the map file
736736
map_url = str()
737-
737+
738738
#: Hash of the map image
739739
image_hash = str()
740740

@@ -756,17 +756,17 @@ def __init__(self, header_file, filename=None, **options):
756756

757757
# Blizzard
758758
self.blizzard = (self.data[0][11] == 'BLIZ')
759-
759+
760760
# Parse image hash
761761
parsed_hash = utils.parse_hash(self.data[0][1])
762762
self.image_hash = parsed_hash['hash']
763763
self.image_url = self.image_url_template.format(parsed_hash['server'], parsed_hash['hash'])
764-
764+
765765
# Parse map hash
766766
parsed_hash = utils.parse_hash(self.data[0][2])
767767
self.map_hash = parsed_hash['hash']
768768
self.map_url = self.base_url_template.format(parsed_hash['server'], parsed_hash['hash'], parsed_hash['type'])
769-
769+
770770
# Parse localization hashes
771771
l18n_struct = self.data[0][4][8]
772772
for l in l18n_struct:

sc2reader/utils.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -739,13 +739,13 @@ def get_unit(type_int):
739739
except:
740740
#Nope, create
741741
data_obj = Data()
742-
742+
743743
# Try to parse a unit
744744
try:
745745
unit = data_obj.type(((type_int & 0xff) << 8) | 0x01)
746746
except:
747747
unit = None
748-
748+
749749
return {
750750
'name': unit.name if unit else "Unknown unit ({})".format(hex(type_int)) ,
751751
'type_int':hex(type_int)
@@ -772,7 +772,7 @@ def parse_hash(hash_string):
772772
server = hash_string[6:8]
773773
hash = hash_string[8:]
774774
return {
775-
'server': server,
775+
'server': server,
776776
'hash' : ''.join([('%02x' % ord(x)) for x in hash]),
777777
'type' : hash_string[0:4]
778778
}
@@ -826,24 +826,24 @@ def __str__(self):
826826
def get_lobby_properties(data):
827827
###
828828
# The definition of each lobby property is in data[0][5] with the structure
829-
#
830-
# id = def[0][1] # The unique property id
829+
#
830+
# id = def[0][1] # The unique property id
831831
# vals = def[1] # A list with the values the property can be
832832
# reqs = def[3] # A list of requirements the property has
833833
# dflt = def[8] # The default value(s) of the property
834834
# this is a single entry for a global property
835835
# and a list() of entries for a player property
836-
836+
837837
# The def-values is structured like this
838838
#
839839
# id = `the index in the vals list`
840840
# name = v[0] # The name of the value
841-
841+
842842
# The requirement structure looks like this
843-
#
843+
#
844844
# id = r[0][1][1] # The property id of this requirement
845845
# vals = r[1] # A list of names of valid values for this requirement
846-
846+
847847
###
848848
# The values of each property is in data[0][6][6] with the structure
849849
#
@@ -856,7 +856,7 @@ def get_lobby_properties(data):
856856
# A value-entry looks like this
857857
#
858858
# index = v[0] # The index in the def.vals array representing the value
859-
# unknown = v[1]
859+
# unknown = v[1]
860860

861861
# First get the definitions in data[0][5]
862862
defs = dict()
@@ -867,7 +867,7 @@ def get_lobby_properties(data):
867867
'vals':d[1],
868868
'reqs':d[3],
869869
'dflt':d[8],
870-
'lobby_prop':type(d[8]) == type(dict())
870+
'lobby_prop':type(d[8]) == type(dict())
871871
}
872872
vals = dict()
873873

@@ -878,14 +878,14 @@ def get_lobby_properties(data):
878878
'id':k,
879879
'vals':v[1]
880880
}
881-
881+
882882
lobby_ids = [k for k in defs if defs[k]['lobby_prop']]
883883
lobby_ids.sort()
884884
player_ids = [k for k in defs if not defs[k]['lobby_prop']]
885885
player_ids.sort()
886886

887887
left_lobby = deque([k for k in defs if defs[k]['lobby_prop']])
888-
888+
889889
lobby_props = dict()
890890
# We cycle through all property values 'til we're done
891891
while len(left_lobby) > 0:
@@ -900,7 +900,7 @@ def get_lobby_properties(data):
900900
break
901901
# Is this requirement fullfilled?
902902
active = active and (lobby_props[req[0][1][1]] in req[1])
903-
903+
904904
if not can_be_parsed:
905905
# Try parse this later
906906
left_lobby.append(propid)
@@ -916,7 +916,7 @@ def get_lobby_properties(data):
916916
for pid in range(16):
917917
left_players = deque([a for a in player_ids])
918918
player = dict()
919-
919+
920920
# Use this to avoid an infinite loop
921921
last_success = 0
922922
max = len(left_players)
@@ -935,7 +935,7 @@ def get_lobby_properties(data):
935935
if not can_be_parsed:
936936
break
937937
active = active and (player[req[0][1][1]] in req[1])
938-
938+
939939
if not can_be_parsed:
940940
left_players.append(propid)
941941
continue
@@ -946,4 +946,4 @@ def get_lobby_properties(data):
946946

947947
player_props[pid] = player
948948

949-
return (lobby_props, player_props)
949+
return (lobby_props, player_props)

0 commit comments

Comments
 (0)