File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 88import inspect
99import argparse
1010import re
11+ import json
1112
1213# We need this Iterable type, which is the type origin of types.Iterable
1314try :
@@ -218,9 +219,9 @@ def to_static_json(self) -> StaticArg:
218219 "option" : self .arg .option ,
219220 "short" : self .arg .short ,
220221 "orig_help" : self .arg .help ,
221- "default" : str ( self . default )
222- if self .default not in ( False , None )
223- else self .default ,
222+ "default" : DEFAULT_PLACEHOLDER
223+ if self .default == DEFAULT_PLACEHOLDER
224+ else json . dumps ( self .default ) ,
224225 "help" : self .help ,
225226 "action" : str (self .action ) if self .action else None ,
226227 "choices" : list (c .value if isinstance (c , Enum ) else c for c in self .choices )
@@ -245,7 +246,7 @@ def from_static_json(
245246 orig_type = data ["orig_type" ],
246247 default = DEFAULT_PLACEHOLDER
247248 if data ["default" ] == DEFAULT_PLACEHOLDER
248- else data ["default" ],
249+ else json . loads ( data ["default" ]) ,
249250 help = data ["help" ],
250251 action = data ["action" ],
251252 choices = data ["choices" ],
You can’t perform that action at this time.
0 commit comments