Added support for reading Deck data

This commit is contained in:
Jens Gåsemyr Magnus
2017-09-07 14:38:31 +02:00
parent 56f326eec8
commit 2cfdfc8b98
4 changed files with 143 additions and 8 deletions

View File

@@ -13,12 +13,8 @@ def _parse_context(actions):
# this might be a single tuple, in which case we unpack it and repack it
# into a list. If it's not a tuple we assume it's an iterable and just
# carry on
try:
key, action = actions
except ValueError:
pass
else:
actions = [(key, action)]
if not isinstance(actions, list):
actions = [actions]
for key, action in actions:
ctx.update(key, action)
@@ -54,5 +50,7 @@ def parse_deck(deck, **kwargs):
if 'actions' in kwargs:
args.append(_parse_context(kwargs['actions']))
else:
args.append(lib.ParseContext())
return lib.parse_deck(*args)