File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change 22"""pdoc's CLI interface and helper functions."""
33
44import argparse
5+ import ast
56import importlib
67import inspect
78import os
@@ -370,12 +371,19 @@ def main(_args=None):
370371 _warn_deprecated ('--overwrite' , '--force' )
371372 args .force = args .overwrite
372373
373- try :
374- template_config = {opt .split ('=' , 1 )[0 ]: eval (opt .split ('=' , 1 )[1 ], {})
375- for opt in args .config }
376- except Exception as e :
377- raise RuntimeError ('Error evaluating config values {}: {}\n '
378- 'Make sure string values are quoted?' .format (args .config , e ))
374+ template_config = {}
375+ for config_str in args .config :
376+ try :
377+ key , value = config_str .split ('=' , 1 )
378+ value = ast .literal_eval (value )
379+ template_config [key ] = value
380+ except Exception :
381+ raise ValueError (
382+ 'Error evaluating --config statement "{}". '
383+ 'Make sure string values are quoted?'
384+ .format (config_str )
385+ )
386+
379387 if args .html_no_source :
380388 _warn_deprecated ('--html-no-source' , '-c show_source_code=False' , True )
381389 template_config ['show_source_code' ] = False
You can’t perform that action at this time.
0 commit comments