@@ -447,7 +447,7 @@ def get_ordered_troops(self, valid_troops):
447447 """
448448 troops_dict = {t .name : t for t in self .troops if t .name in set (valid_troops )}
449449 key_order = {k : v for v , k in enumerate (valid_troops )}
450- return OrderedDict (sorted (troops_dict .items (), key = lambda i : key_order .get (i [0 ])))
450+ return OrderedDict (sorted (troops_dict .items (), key = lambda i : key_order .get (i [0 ], 0 )))
451451
452452 @property
453453 def ordered_home_troops (self ):
@@ -456,7 +456,7 @@ def ordered_home_troops(self):
456456 This will return troops in the order found in both barracks and labatory in-game.
457457 """
458458 key_order = {k : v for v , k in enumerate (HOME_TROOP_ORDER )}
459- return OrderedDict (sorted (self .home_troops_dict .items (), key = lambda i : key_order .get (i [0 ])))
459+ return OrderedDict (sorted (self .home_troops_dict .items (), key = lambda i : key_order .get (i [0 ], 0 )))
460460
461461 @property
462462 def ordered_super_troops (self ):
@@ -465,7 +465,7 @@ def ordered_super_troops(self):
465465 This will return super troops in the order found in game.
466466 """
467467 key_order = {k : v for v , k in enumerate (SUPER_TROOP_ORDER )}
468- return OrderedDict (sorted (self .super_troops_dict .items (), key = lambda i : key_order .get (i [0 ])))
468+ return OrderedDict (sorted (self .super_troops_dict .items (), key = lambda i : key_order .get (i [0 ], 0 )))
469469
470470 @property
471471 def ordered_builder_troops (self ):
@@ -474,7 +474,7 @@ def ordered_builder_troops(self):
474474 This will return troops in the order found in both barracks and labatory in-game.
475475 """
476476 key_order = {k : v for v , k in enumerate (BUILDER_TROOPS_ORDER )}
477- return OrderedDict (sorted (self .builder_troops_dict .items (), key = lambda i : key_order .get (i [0 ])))
477+ return OrderedDict (sorted (self .builder_troops_dict .items (), key = lambda i : key_order .get (i [0 ], 0 )))
478478
479479 @property
480480 def ordered_siege_machines (self ):
@@ -483,7 +483,7 @@ def ordered_siege_machines(self):
483483 This will return siege machines in the order found in both barracks and labatory in-game.
484484 """
485485 key_order = {k : v for v , k in enumerate (SIEGE_MACHINE_ORDER )}
486- return OrderedDict (sorted (self .siege_machines_dict .items (), key = lambda i : key_order .get (i [0 ])))
486+ return OrderedDict (sorted (self .siege_machines_dict .items (), key = lambda i : key_order .get (i [0 ], 0 )))
487487
488488 @property
489489 def ordered_spells (self ):
@@ -492,7 +492,7 @@ def ordered_spells(self):
492492 This will return spells in the order found in both spell factory and labatory in-game.
493493 """
494494 key_order = {k : v for v , k in enumerate (SPELL_ORDER )}
495- return OrderedDict (sorted (self .spells_dict .items (), key = lambda i : key_order .get (i [0 ])))
495+ return OrderedDict (sorted (self .spells_dict .items (), key = lambda i : key_order .get (i [0 ], 0 )))
496496
497497 @property
498498 def ordered_heroes (self ):
@@ -501,7 +501,7 @@ def ordered_heroes(self):
501501 This will return heroes in the order found in the labatory in-game.
502502 """
503503 key_order = {k : v for v , k in enumerate (HERO_ORDER )}
504- return OrderedDict (sorted (self .heroes_dict .items (), key = lambda i : key_order .get (i [0 ])))
504+ return OrderedDict (sorted (self .heroes_dict .items (), key = lambda i : key_order .get (i [0 ], 0 )))
505505
506506
507507class LeaguePlayer (EqualityComparable ):
0 commit comments