style: Fix import order and formatting in editblock_coder.py

This commit is contained in:
Paul Gauthier (aider) 2024-08-20 19:25:13 -07:00
parent 4917054518
commit 0006d70a7c

View file

@ -1,5 +1,6 @@
import difflib import difflib
import math import math
import os
import re import re
import subprocess import subprocess
import sys import sys
@ -13,8 +14,6 @@ from .base_coder import Coder
from .editblock_prompts import EditBlockPrompts from .editblock_prompts import EditBlockPrompts
import os
class EditBlockCoder(Coder): class EditBlockCoder(Coder):
"""A coder that uses search/replace blocks for code modifications.""" """A coder that uses search/replace blocks for code modifications."""
@ -30,10 +29,11 @@ class EditBlockCoder(Coder):
return edits return edits
def run_interactive_subprocess(self, command): def run_interactive_subprocess(self, command):
if os.name == 'posix': # Unix-like systems (Linux, macOS) if os.name == "posix": # Unix-like systems (Linux, macOS)
import pty import pty
return pty.spawn(command) return pty.spawn(command)
elif os.name == 'nt': # Windows elif os.name == "nt": # Windows
return subprocess.run(command, shell=True) return subprocess.run(command, shell=True)
else: else:
raise OSError("Unsupported operating system") raise OSError("Unsupported operating system")