mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-28 08:14:59 +00:00
aider is AI pair programming in your terminal
https://aider.chat/
![]() # Context: USER: move get_input into utils. pass in history_file and fnames as params rather than referencing them with self. ASSISTANT: To move the `get_input` function into `utils.py`, we will remove it from the `Coder` class in `coder.py` and add it to `utils.py`. We will also update the function to accept `history_file` and `fnames` as parameters. ```python coder.py <<<<<<< ORIGINAL def get_input(self): inp = "" multiline_input = False style = Style.from_dict({'': 'green'}) while True: completer_instance = FileContentCompleter(self.fnames) if multiline_input: show = ". " else: show = "> " try: line = prompt( show, completer=completer_instance, history=FileHistory(self.history_file), style=style, ) except EOFError: return if line.strip() == "{" and not multiline_input: multiline_input = True continue elif line.strip() == "}" and multiline_input: break elif multiline_input: inp += line + "\n" else: inp = line break print() return inp ======= >>>>>>> UPDATED ``` ```python utils.py <<<<<<< ORIGINAL ======= def get_input(history_file, fnames): inp = "" multiline_input = False style = Style.from_dict({'': 'green'}) while True: completer_instance = FileContentCompleter(fnames) if multiline_input: show = ". " else: show = "> " try: line = prompt( show, completer=completer_instance, history=FileHistory(history_file), style=style, ) except EOFError: return if line.strip() == "{" and not multiline_input: multiline_input = True continue elif line.strip() == "}" and multiline_input: break elif multiline_input: inp += line + "\n" else: inp = line break print() return inp >>>>>>> UPDATED ``` Now, update the call to `get_input` in `coder.py` to use the new `utils.get_input` function: ```python coder.py <<<<<<< ORIGINAL inp = self.get_input() ======= inp = utils.get_input(self.history_file, self.fnames) >>>>>>> UPDATED ``` |
||
---|---|---|
.flake8 | ||
.pre-commit-config.yaml | ||
coder.py | ||
dump.py | ||
main.py | ||
prompts.py | ||
test_utils.py | ||
utils.py |