Add parse_bits to utils.
authorSimon Cross <hodgestar@gmail.com>
Sat, 17 May 2014 17:46:59 +0000 (19:46 +0200)
committerSimon Cross <hodgestar@gmail.com>
Sat, 17 May 2014 17:48:56 +0000 (19:48 +0200)
naja/utils.py

index b15302a1bb01effb9e2a991b843654ea91c8aee0..d5d17cc6067276a8649369c625893872388760fe 100644 (file)
@@ -27,6 +27,11 @@ def move_glyph(move_name):
     }.get(move_name, move_name.lower())
 
 
+def parse_bits(bit_list):
+    # Convert names to numbers if applicable.
+    return frozenset(BITS.get(bit, bit) for bit in bit_list)
+
+
 def warp_to_game_state(game_state):
     from naja.events import LoadGameEvent, SceneChangeEvent
     from naja.scenes.game import GameScene