Skip to content
Snippets Groups Projects
Commit 51c87882 authored by David Hendriks's avatar David Hendriks
Browse files

updated help all super function to combine the results of detailed_help to...

 updated help all super function to combine the results of detailed_help to the already present results
parent 88bc3001
No related branches found
Tags 0.21
No related merge requests found
......@@ -8,50 +8,56 @@ from binarycpython.utils.custom_logging_functions import (
)
def get_help_super(print_help=False, return_dict=True):
def get_help_super(print_help=False, return_dict=True, fail_silently=True):
"""
Function that first runs get_help_all, and then per argument also run the help function to get as much information as possible.
"""
# Get help_all information
help_all_dict = get_help_all(print_help=False, return_dict=True)
# print(help_all_dict)
# print(json.dumps(help_all_dict, indent=4))
help_all_super_dict = help_all_dict.copy()
# Loop over all sections and stuff
for section_name in help_all_dict.keys():
section = help_all_dict[section_name]
# print(section)
for parameter_name in section["parameters"].keys():
parameter = section["parameters"][parameter_name]
# Get detailed help info
detailed_help = get_help(
parameter_name, print_help=False, return_dict=True, fail_silently=True
parameter_name, print_help=False, return_dict=True, fail_silently=fail_silently
)
parameter["detailed_help"] = detailed_help
if detailed_help:
# check whether the descriptions of help_all and detailed help are the same
if not fail_silently:
if (
not parameter["description"]
== detailed_help["description"]
):
print(json.dumps(parameter, indent=4))
## put values into help all super dict
# input type
parameter["parameter_value_input_type"] = detailed_help["parameter_value_input_type"]
if parameter["detailed_help"]:
if (
not parameter["description"]
== parameter["detailed_help"]["description"]
):
print(json.dumps(parameter, indent=4))
# default
parameter["default"] = detailed_help["default"]
# print(parameter['description']==parameter['detailed_help']['description'])
# macros
if 'macros' in detailed_help.keys():
parameter["macros"] = detailed_help["macros"]
# print(parameter.keys())
if print_help:
# TODO: make a pretty print
print(json.dumps(help_all_super_dict, indent=4))
pass
if return_dict:
return
return help_all_super_dict
def get_help_all(print_help=True, return_dict=False):
......@@ -496,7 +502,4 @@ def load_logfile(logfile):
rel_r2_list.append(split_line[8])
event_list.append(" ".join(split_line[9:]))
print(event_list)
# load_logfile()
print(event_list)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment