def main() -> None: """Set up logging and call the reschedule function.""" args: Dict[str, str] = docopt(__doc__, version=__version__) # Set up logging log_level = args["--log-level"] try: logging.basicConfig(format="\n%(levelname)s: %(message)s", level=log_level.upper()) except ValueError: logging.critical( '"{}"is not a valid logging level. Possible values are debug, info, warning, and error.' .format(log_level)) sys.exit(1) try: with open(args["ASSESSMENT_FILE"]) as json_file: json_data = json.load(json_file) except EnvironmentError: logging.critical(f"JSON file not found: {args['ASSESSMENT_FILE']}") logging.critical("Please run command from the location with the file.") # Bandit complains about the input() function, but it is safe to # use in Python 3, which is required by this project. input("Press any key to close...") # nosec assessment = Assessment.parse(json_data) assessment = reschedule(assessment) with open(f"{assessment.id}-reschedule.json", "w") as fp: json.dump(assessment.as_dict(), fp, indent=4) logging.info(f"Assessment JSON ready: {assessment.id}-reschedule.json") # Stop logging and clean up logging.shutdown()