aider: Remove unused variable _output in the run_cmd method in aider/linter.py.

# Aider chat conversation:

USER: I ran this command:

 pre-commit run --files aider/linter.py

And got this output:

isort....................................................................Failed
- hook id: isort
- files were modified by this hook

Fixing /Users/gauthier/Projects/aider/aider/linter.py

black....................................................................Failed
- hook id: black
- files were modified by this hook

reformatted aider/linter.py

All done!  🍰 
1 file reformatted.

flake8...................................................................Failed
- hook id: flake8
- exit code: 1

aider/linter.py:37:13: F841 local variable '_output' is assigned to but never used
            _output = subprocess.check_output(cmd, cwd=self.root).decode()
            ^

ASSISTANT: Please add `aider/linter.py` to the chat so I can make the necessary changes to fix the flake8 issue.

USER: I added these files to the chat: aider/linter.py

ASSISTANT: To fix the flake8 issue, we need to remove the unused variable `_output` in the `run_cmd` method. Here is the *SEARCH/REPLACE* block:

aider/linter.py
```python
<<<<<<< SEARCH
            _output = subprocess.check_output(cmd, cwd=self.root).decode()
            return  # zero exit status
=======
            subprocess.check_output(cmd, cwd=self.root).decode()
            return  # zero exit status
>>>>>>> REPLACE
```

This change will remove the assignment to the unused variable `_output` while keeping the call to `subprocess.check_output`.
This commit is contained in:
Paul Gauthier 2024-05-17 15:37:06 -07:00
parent 4f81971a13
commit c7196b8390

View file

@ -34,7 +34,7 @@ class Linter:
cmd += " " + rel_fname
cmd = cmd.split()
try:
_output = subprocess.check_output(cmd, cwd=self.root).decode()
subprocess.check_output(cmd, cwd=self.root).decode()
return # zero exit status
except subprocess.CalledProcessError as err:
return err.output.decode() # non-zero exit status