diff options
author | Tibor Frank <tifrank@cisco.com> | 2022-09-23 12:57:37 +0200 |
---|---|---|
committer | Tibor Frank <tifrank@cisco.com> | 2022-09-26 07:22:41 +0000 |
commit | 446b9efe60eb8a528dc58e237ec9a33486566d69 (patch) | |
tree | 8dcb82d5629d04a5903af463801d754086f2c101 /resources/tools/presentation/pal.py | |
parent | 3e70381fb8c08682786fbb16ef542c3893033647 (diff) |
Report: configure sphinx
Signed-off-by: Tibor Frank <tifrank@cisco.com>
Change-Id: I844b15562c31beaf79d5094ed0e33b026bbb01f5
Diffstat (limited to 'resources/tools/presentation/pal.py')
-rw-r--r-- | resources/tools/presentation/pal.py | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/resources/tools/presentation/pal.py b/resources/tools/presentation/pal.py index 4f9b24fedc..06f1eeda59 100644 --- a/resources/tools/presentation/pal.py +++ b/resources/tools/presentation/pal.py @@ -32,7 +32,7 @@ from generator_alerts import Alerting, AlertingError from convert_xml_json import convert_xml_to_json -OUTPUTS = (u"none", u"report", u"trending", u"convert-xml-to-json") +OUTPUTS = ("none", "report", "trending", "convert-xml-to-json") def parse_args(): @@ -47,60 +47,60 @@ def parse_args(): formatter_class=argparse.RawDescriptionHelpFormatter ) parser.add_argument( - u"-s", u"--specification", + "-s", "--specification", required=True, type=str, - help=u"Specification YAML file." + help="Specification YAML file." ) parser.add_argument( - u"-r", u"--release", - default=u"master", + "-r", "--release", + default="master", type=str, - help=u"Release string of the product." + help="Release string of the product." ) parser.add_argument( - u"-w", u"--week", - default=u"1", + "-w", "--week", + default="1", type=str, - help=u"Calendar week when the report is published." + help="Calendar week when the report is published." ) parser.add_argument( - u"-l", u"--logging", + "-l", "--logging", choices=[ - u"NOTSET", u"DEBUG", u"INFO", u"WARNING", u"ERROR", u"CRITICAL" + "NOTSET", "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL" ], - default=u"ERROR", - help=u"Logging level." + default="ERROR", + help="Logging level." ) parser.add_argument( - u"-f", u"--force", - action=u"store_true", - help=u"Force removing the old build(s) if present." + "-f", "--force", + action="store_true", + help="Force removing the old build(s) if present." ) parser.add_argument( - u"-o", u"--print-all-oper-data", - action=u"store_true", - help=u"Print all operational data to console. Be careful, the output " - u"can be really long." + "-o", "--print-all-oper-data", + action="store_true", + help="Print all operational data to console. Be careful, the output " + "can be really long." ) parser.add_argument( - u"-i", u"--input-file", + "-i", "--input-file", type=str, - default=u"", - help=u"XML file generated by RobotFramework which will be processed " - u"instead of downloading the data from Nexus and/or Jenkins. In " - u"this case, the section 'input' in the specification file is " - u"ignored." + default="", + help="XML file generated by RobotFramework which will be processed " + "instead of downloading the data from Nexus and/or Jenkins. In " + "this case, the section 'input' in the specification file is " + "ignored." ) parser.add_argument( - u"-d", u"--input-directory", + "-d", "--input-directory", type=str, - default=u"", - help=u"Directory with XML file(s) generated by RobotFramework or with " - u"sub-directories with XML file(s) which will be processed " - u"instead of downloading the data from Nexus and/or Jenkins. In " - u"this case, the section 'input' in the specification file is " - u"ignored." + default="", + help="Directory with XML file(s) generated by RobotFramework or with " + "sub-directories with XML file(s) which will be processed " + "instead of downloading the data from Nexus and/or Jenkins. In " + "this case, the section 'input' in the specification file is " + "ignored." ) return parser.parse_args() @@ -110,32 +110,32 @@ def main(): """Main function.""" log_levels = { - u"NOTSET": logging.NOTSET, - u"DEBUG": logging.DEBUG, - u"INFO": logging.INFO, - u"WARNING": logging.WARNING, - u"ERROR": logging.ERROR, - u"CRITICAL": logging.CRITICAL + "NOTSET": logging.NOTSET, + "DEBUG": logging.DEBUG, + "INFO": logging.INFO, + "WARNING": logging.WARNING, + "ERROR": logging.ERROR, + "CRITICAL": logging.CRITICAL } args = parse_args() logging.basicConfig( - format=u"%(asctime)s: %(levelname)s: %(message)s", - datefmt=u"%Y/%m/%d %H:%M:%S", + format="%(asctime)s: %(levelname)s: %(message)s", + datefmt="%Y/%m/%d %H:%M:%S", level=log_levels[args.logging] ) - logging.info(u"Application started.") + logging.info("Application started.") try: spec = Specification(args.specification) spec.read_specification() except PresentationError as err: - logging.critical(u"Finished with error.") + logging.critical("Finished with error.") logging.critical(repr(err)) return 1 - if spec.output[u"output"] not in OUTPUTS: + if spec.output["output"] not in OUTPUTS: logging.critical( f"The output {spec.output[u'output']} is not supported." ) @@ -148,7 +148,7 @@ def main(): prepare_static_content(spec) - data = InputData(spec, spec.output[u"output"]) + data = InputData(spec, spec.output["output"]) if args.input_file: data.process_local_file(args.input_file) elif args.input_directory: @@ -163,21 +163,21 @@ def main(): generate_plots(spec, data) generate_files(spec, data) - if spec.output[u"output"] == u"report": + if spec.output["output"] == "report": generate_report(args.release, spec, args.week) - elif spec.output[u"output"] == u"trending": + elif spec.output["output"] == "trending": sys.stdout.write(generate_cpta(spec, data)) try: alert = Alerting(spec) alert.generate_alerts() except AlertingError as err: logging.warning(repr(err)) - elif spec.output[u"output"] == u"convert-xml-to-json": + elif spec.output["output"] == "convert-xml-to-json": convert_xml_to_json(spec, data) else: logging.info("No output will be generated.") - logging.info(u"Successfully finished.") + logging.info("Successfully finished.") return_code = 0 except AlertingError as err: @@ -192,5 +192,5 @@ def main(): return return_code -if __name__ == u"__main__": +if __name__ == "__main__": sys.exit(main()) |