From 11c0dd89d9022dce41cfc27450daa5aa1a44b5a4 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Wed, 17 May 2023 13:41:58 -0700 Subject: [PATCH] Renamed getinput -> io --- aider/{getinput.py => io.py} | 17 ++++++++--------- aider/main.py | 2 +- 2 files changed, 9 insertions(+), 10 deletions(-) rename aider/{getinput.py => io.py} (95%) diff --git a/aider/getinput.py b/aider/io.py similarity index 95% rename from aider/getinput.py rename to aider/io.py index d43e9f637..7abfecdc3 100644 --- a/aider/getinput.py +++ b/aider/io.py @@ -9,7 +9,6 @@ from prompt_toolkit.history import FileHistory from prompt_toolkit.shortcuts import CompleteStyle from rich.console import Console from rich.text import Text -import sys import time import random from pathlib import Path @@ -68,7 +67,7 @@ class InputOutput: self.console = Console(force_terminal=True, no_color=True) current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S") - self.append_chat_history(f'\n# Aider chat started at {current_time}\n\n') + self.append_chat_history(f"\n# Aider chat started at {current_time}\n\n") def canned_input(self, show_prompt): console = Console() @@ -105,7 +104,7 @@ class InputOutput: show += "\n" show += "> " - #if not sys.stdin.isatty(): + # if not sys.stdin.isatty(): # return self.canned_input(show) inp = "" @@ -146,7 +145,7 @@ class InputOutput: if inp: hist = inp.splitlines() else: - hist = [''] + hist = [""] hist = f" \n{prefix} ".join(hist) @@ -160,7 +159,7 @@ class InputOutput: # OUTPUT def ai_output(self, content): - hist = '\n' + content.strip() + '\n\n' + hist = "\n" + content.strip() + "\n\n" self.append_chat_history(hist) def confirm_ask(self, question, default="y"): @@ -178,7 +177,7 @@ class InputOutput: def prompt_ask(self, question, default=None): if self.yes: - res = 'yes' + res = "yes" else: res = prompt(question + " ", default=default) @@ -207,11 +206,11 @@ class InputOutput: def append_chat_history(self, text, linebreak=False, blockquote=False): if blockquote: text = text.strip() - text = '> ' + text + text = "> " + text if linebreak: text = text.rstrip() text = text + " \n" - if not text.endswith('\n'): - text += '\n' + if not text.endswith("\n"): + text += "\n" with self.chat_history_file.open("a") as f: f.write(text) diff --git a/aider/main.py b/aider/main.py index 0b91ad260..08c045dd6 100644 --- a/aider/main.py +++ b/aider/main.py @@ -3,7 +3,7 @@ import sys import argparse from dotenv import load_dotenv from aider.coder import Coder -from aider.getinput import InputOutput +from aider.io import InputOutput def main(args=None, input=None, output=None):