Fixed all pylint warnings

This commit is contained in:
2024-08-19 22:30:42 +02:00
parent 88167486ab
commit e0f88630e6
+6 -6
View File
@@ -30,7 +30,7 @@ import yaml
from termcolor import colored
from colorama import init
from ai_model import AIModel, GroqModel, OpenAIModel, OllamaModel, AnthropicModel, AzureOpenAIModel
from ai_model import AIModel
CONFIG_FILE = "yolo.yaml"
PROMPT_FILE = "yolo.prompt"
@@ -51,7 +51,7 @@ def read_yaml_config() -> any:
prompt_path = os.path.dirname(yolo_path)
config_file = os.path.join(prompt_path, CONFIG_FILE)
with open(config_file, 'r') as file:
with open(config_file, 'r', encoding='utf-8') as file:
return yaml.safe_load(file)
def set_openai_api_key(config):
@@ -168,7 +168,8 @@ def get_system_prompt(shell):
## Load the prompt and prep it
prompt_file = os.path.join(prompt_path, PROMPT_FILE)
system_prompt = open(prompt_file,"r").read()
with open(prompt_file, "r", encoding="utf-8") as file:
system_prompt = file.read()
system_prompt = system_prompt.replace("{shell}", shell)
system_prompt = system_prompt.replace("{os}", get_os_friendly_name())
@@ -300,9 +301,8 @@ def prompt_user_input(config, response):
if config["modify"]:
modify_text = " [m]modify"
# TODO: Copy to clipboard flag
prompt_text = "Execute command? [Y]es [n]o" + modify_text + ": "
prompt_text = "Execute command? [Y]es [n]o [c]opy to clipboard" + modify_text + ": "
if os.name == "posix" and missing_posix_display():
prompt_text = "Execute command? [Y]es [n]o" + modify_text + ": "