White space clean up and simplification of get_os_friendly_name.

This commit is contained in:
Heiko Joerg Schick
2023-09-05 20:43:08 +02:00
parent dece99ba87
commit 1567fb40ea
+7 -7
View File
@@ -116,12 +116,10 @@ def get_os_friendly_name():
os_name = platform.system() os_name = platform.system()
if os_name == "Linux": if os_name == "Linux":
return "Linux/"+distro.name(pretty=True) os_name = "Linux/" + distro.name(pretty=True)
elif os_name == "Windows":
return os_name
elif os_name == "Darwin": elif os_name == "Darwin":
return "Darwin/macOS" os_name = "Darwin/macOS"
else:
return os_name return os_name
def call_open_ai(config, shell, query): def call_open_ai(config, shell, query):
@@ -166,7 +164,9 @@ def check_for_markdown(response):
Odd corner case, sometimes ChatCompletion returns markdown Odd corner case, sometimes ChatCompletion returns markdown
""" """
if response.count("```",2): if response.count("```",2):
print(colored("The proposed command contains markdown, so I did not execute the response directly: \n", 'red')+response) print(colored(
"The proposed command contains markdown, response not executed directly: \n", 'red'
) + response)
sys.exit(-1) sys.exit(-1)
def missing_posix_display(): def missing_posix_display():
@@ -243,7 +243,7 @@ def main():
config = read_yaml_config() config = read_yaml_config()
set_openai_api_key(config) set_openai_api_key(config)
if (args.config): if args.config:
print_config(config) print_config(config)
# Unix based SHELL (/bin/bash, /bin/zsh), otherwise assuming it's Windows # Unix based SHELL (/bin/bash, /bin/zsh), otherwise assuming it's Windows