aider is AI pair programming in your terminal https://aider.chat/
Find a file
Paul Gauthier 6419e6c390 Move get_input function into utils.py and update the call to get_input in coder.py to use the new utils.get_input function.
# 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
```
2023-05-09 10:09:42 -07:00
.flake8 debug 2023-05-08 22:55:55 -07:00
.pre-commit-config.yaml added flake8 2023-05-07 22:13:57 -07:00
coder.py Move get_input function into utils.py and update the call to get_input in coder.py to use the new utils.get_input function. 2023-05-09 10:09:42 -07:00
dump.py init 2023-04-19 09:03:23 -07:00
main.py WIP: Refactor CLI help messages to use $ prefix for environment variables. 2023-05-09 00:38:10 -07:00
prompts.py prompts 2023-05-09 00:38:55 -07:00
test_utils.py Add tests for strip_quoted_wrapping function in test_utils.py. 2023-05-09 08:44:35 -07:00
utils.py Move get_input function into utils.py and update the call to get_input in coder.py to use the new utils.get_input function. 2023-05-09 10:09:42 -07:00