def args_from_interpreter_flags():
"""Return a list of command-line arguments reproducing the current
settings in sys.flags."""
flag_opt_map = {
'bytes_warning': 'b',
'dont_write_bytecode': 'B',
'hash_randomization': 'R',
'ignore_environment': 'E',
'no_user_site': 's',
'no_site': 'S',
'optimize': 'O',
'verbose': 'v',
}
args = []
for flag, opt in flag_opt_map.items():
v = getattr(sys.flags, flag)
if v > 0:
args.append('-' + opt * v)
return args
#============================================================
# Support for assertions about logging.
#============================================================
评论列表
文章目录