Skip to content

Commit b424940

Browse files
Move json_dumps to src/util.py.
1 parent 4b3ff57 commit b424940

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/metamodels/cgpm_metamodel.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
from bayeslite.stats import arithmetic_mean
6767
from bayeslite.util import casefold
6868
from bayeslite.util import cursor_value
69+
from bayeslite.util import json_dumps
6970

7071
import cgpm_schema.parse
7172

@@ -783,8 +784,3 @@ def _default_numerical(bdb, generator_id, var):
783784
'cyclic': _default_numerical, # XXX can't do cyclic yet
784785
'numerical': _default_numerical,
785786
}
786-
787-
# XXX Move these utilities elsewhere.
788-
789-
def json_dumps(obj):
790-
return json.dumps(obj, sort_keys=True)

src/util.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,7 @@ def cursor_value(cursor, nullok=None):
103103
if len(row) != 1:
104104
raise ValueError('Non-unit cursor')
105105
return row[0]
106+
107+
def json_dumps(obj):
108+
"""Return a JSON string of obj, compactly and deterministically."""
109+
return json.dumps(obj, sort_keys=True)

0 commit comments

Comments
 (0)