Merge pull request #28 from BlockScience/fix/mechsteps_ordering

support list of mechsteps instead of dict
This commit is contained in:
Markus Buhatem Koch 2019-02-11 09:44:49 -02:00 committed by GitHub
commit ef7b42a39a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -10,8 +10,13 @@ def print_pipe(x):
def flatten(l):
return [item for sublist in l for item in sublist]
import warnings
def key_filter(l, keyname):
if (type(l)==list):
return [v[keyname] for v in l]
# Keeping support to dictionaries for backwards compatibility
# Should be removed in the future
warnings.warn("The use of a dictionary to describe Partial State Update Blocks will be deprecated. Use a list instead.", FutureWarning)
return [v[keyname] for k, v in l.items()]