aider is AI pair programming in your terminal https://aider.chat/
Find a file
Paul Gauthier 05c39b7329 Move strip_quoted_wrapping function from coder.py to utils.py and update its usage in coder.py.
# Context:
USER: move strip_quoted_wrapping into utils
ASSISTANT: To move the `strip_quoted_wrapping` function from `coder.py` to `utils.py`, you need to make the following changes:

In `coder.py`, remove the `strip_quoted_wrapping` function:

```python
coder.py
<<<<<<< ORIGINAL
    def strip_quoted_wrapping(self, res, fname=None):
        if not res:
            return res

        res = res.splitlines()

        if fname and res[0].strip().endswith(Path(fname).name):
            res = res[1:]

        if res[0].startswith("```") and res[-1].startswith("```"):
            res = res[1:-1]

        res = "\n".join(res)
        if res and res[-1] != "\n":
            res += "\n"

        return res
=======
>>>>>>> UPDATED
```

In `utils.py`, add the `strip_quoted_wrapping` function:

```python
utils.py
<<<<<<< ORIGINAL
=======
def strip_quoted_wrapping(res, fname=None):
    if not res:
        return res

    res = res.splitlines()

    if fname and res[0].strip().endswith(Path(fname).name):
        res = res[1:]

    if res[0].startswith("```") and res[-1].startswith("```"):
        res = res[1:-1]

    res = "\n".join(res)
    if res and res[-1] != "\n":
        res += "\n"

    return res
>>>>>>> UPDATED
```

Finally, update the usage of `strip_quoted_wrapping` in `coder.py` to use the function from `utils.py`:

```python
coder.py
<<<<<<< ORIGINAL
        before_text = self.strip_quoted_wrapping(before_text, fname)
        after_text = self.strip_quoted_wrapping(after_text, fname)
=======
        before_text = utils.strip_quoted_wrapping(before_text, fname)
        after_text = utils.strip_quoted_wrapping(after_text, fname)
>>>>>>> UPDATED
```
2023-05-08 23:54:58 -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 strip_quoted_wrapping function from coder.py to utils.py and update its usage in coder.py. 2023-05-08 23:54:58 -07:00
dump.py init 2023-04-19 09:03:23 -07:00
prompts.py rename 2023-05-08 23:49:14 -07:00
utils.py rename 2023-05-08 23:49:14 -07:00