mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 00:35:00 +00:00
fix: Remove unused spinner method from InputOutput class
This commit is contained in:
parent
f8d161382e
commit
c67d10749c
3 changed files with 30 additions and 6 deletions
|
@ -414,8 +414,3 @@ class InputOutput:
|
|||
if self.chat_history_file is not None:
|
||||
with self.chat_history_file.open("a", encoding=self.encoding) as f:
|
||||
f.write(text)
|
||||
|
||||
def spinner(self, text):
|
||||
from aider.utils import Spinner
|
||||
|
||||
return Spinner(text)
|
||||
|
|
|
@ -402,7 +402,7 @@ class RepoMap:
|
|||
if not mentioned_idents:
|
||||
mentioned_idents = set()
|
||||
|
||||
spin = self.io.spinner("Preparing repo map")
|
||||
spin = Spinner("Preparing repo map")
|
||||
|
||||
ranked_tags = self.get_ranked_tags(
|
||||
chat_fnames,
|
||||
|
|
|
@ -239,6 +239,35 @@ def run_install(cmd):
|
|||
return False, output
|
||||
|
||||
|
||||
class Spinner:
|
||||
spinner_chars = itertools.cycle(["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"])
|
||||
|
||||
def __init__(self, text):
|
||||
self.text = text
|
||||
self.start_time = time.time()
|
||||
self.last_update = 0
|
||||
self.visible = False
|
||||
|
||||
def step(self):
|
||||
current_time = time.time()
|
||||
if not self.visible and current_time - self.start_time >= 0.5:
|
||||
self.visible = True
|
||||
self._step()
|
||||
elif self.visible and current_time - self.last_update >= 0.1:
|
||||
self._step()
|
||||
self.last_update = current_time
|
||||
|
||||
def _step(self):
|
||||
if not self.visible:
|
||||
return
|
||||
|
||||
print(f"\r{self.text} {next(self.spinner_chars)}\r{self.text} ", end="", flush=True)
|
||||
|
||||
def end(self):
|
||||
if self.visible:
|
||||
print("\r" + " " * (len(self.text) + 3))
|
||||
|
||||
|
||||
def check_pip_install_extra(io, module, prompt, pip_install_cmd):
|
||||
try:
|
||||
__import__(module)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue