We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 562d58d commit b893a6bCopy full SHA for b893a6b
src/emd/models/utils/serialize_utils.py
@@ -2,14 +2,15 @@
2
import argparse
3
4
JSON_DOUBLE_QUOTE_REPLACE = '<!>'
5
+JSON_SINGLE_QUOTE_REPLACE = '<*>'
6
7
8
def load_extra_params(string):
- string = string.replace(JSON_DOUBLE_QUOTE_REPLACE,'"')
9
+ string = string.replace(JSON_DOUBLE_QUOTE_REPLACE,'"').replace(JSON_SINGLE_QUOTE_REPLACE,"'")
10
try:
11
return json.loads(string)
12
except json.JSONDecodeError:
13
raise argparse.ArgumentTypeError(f"Invalid dictionary format: {string}")
14
15
def dump_extra_params(d:dict):
- return json.dumps(d).replace('"', JSON_DOUBLE_QUOTE_REPLACE)
16
+ return json.dumps(d).replace("'", JSON_SINGLE_QUOTE_REPLACE).replace('"', JSON_DOUBLE_QUOTE_REPLACE)
0 commit comments