From bc1e997708c751ee793cef6a3d841b0f91802e7c Mon Sep 17 00:00:00 2001 From: Heiko Joerg Schick Date: Tue, 5 Sep 2023 21:11:23 +0200 Subject: [PATCH] Removed all pylint warnings --- yolo.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/yolo.py b/yolo.py index dcc5f72..671eeb3 100755 --- a/yolo.py +++ b/yolo.py @@ -181,7 +181,6 @@ def prompt_user_input(config, response): Todo """ print("Command: " + colored(response, 'blue')) - #print(config["safety"]) if config["safety"]: prompt_text = "Execute command? [Y]es [n]o [m]odify [c]opy to clipboard ==> " @@ -192,32 +191,31 @@ def prompt_user_input(config, response): print(prompt_text, end = '') user_input = input() + else: + user_input = "Y" - return user_input + return user_input - if not config["safety"]: - return "Y" - -def evaluate_input(user_input, command): +def evaluate_input(config, shell, user_input, command): """ Todo """ if user_input.upper() == "Y" or user_input == "": if shell == "powershell.exe": - subprocess.run([shell, "/c", command], shell=False) + subprocess.run([shell, "/c", command], shell=False, check=True) else: # Unix: /bin/bash /bin/zsh: uses -c both Ubuntu and macOS should work, others might not - subprocess.run([shell, "-c", command], shell=False) + subprocess.run([shell, "-c", command], shell=False, check=True) if user_input.upper() == "M": print("Modify prompt: ", end = '') modded_query = input() - modded_response = call_open_ai(modded_query) + modded_response = call_open_ai(config, shell, modded_query) check_for_issue(modded_response) check_for_markdown(modded_response) - modded_user_input = prompt_user_input(modded_response) + modded_user_input = prompt_user_input(config, modded_response) print() - evaluate_input(modded_user_input, modded_response) + evaluate_input(config, shell, modded_user_input, modded_response) if user_input.upper() == "C": if os.name == "posix" and missing_posix_display(): @@ -265,7 +263,7 @@ def main(): check_for_markdown(res_command) user_input = prompt_user_input(config, res_command) print() - evaluate_input(user_input, res_command) + evaluate_input(config, shell, user_input, res_command) if __name__ == "__main__": main()