Removed all pylint warnings
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user