diff options
author | Lars Wirzenius <liw@liw.fi> | 2017-07-29 18:36:49 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2017-07-29 18:36:49 +0300 |
commit | 386e2658e83dc4bc27fa921499b4445bb8ac3d60 (patch) | |
tree | 041e62b3fb31d6846236d2a7fdc3fd266b9b82ca /yarns/lib.py | |
parent | d78a6f594e824dfddedda6d2695fdb62dc11b620 (diff) | |
download | ick2-386e2658e83dc4bc27fa921499b4445bb8ac3d60.tar.gz |
Add: scenario for concurrent building of projects
Diffstat (limited to 'yarns/lib.py')
-rw-r--r-- | yarns/lib.py | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/yarns/lib.py b/yarns/lib.py index 9040bb7..fc4acfc 100644 --- a/yarns/lib.py +++ b/yarns/lib.py @@ -68,7 +68,28 @@ def request(method, url, body=None): def parse_json(text): - return json.loads(text) + return json.loads(text, object_pairs_hook=dictify) + + + +def dictify(pairs): + return { + stringify(key): stringify(value) + for key, value in pairs + } + + +def stringify(x): + if isinstance(x, unicode): + return str(x) + if isinstance(x, list): + return [stringify(y) for y in x] + if isinstance(x, dict): + return { + stringify(key): stringify(value) + for key, value in pairs + } + return x def parse_yaml(text): |