mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 01:35:00 +00:00
fix: update spinner every 0.1 sec at most
This commit is contained in:
parent
b76434f5e0
commit
54a481813a
1 changed files with 9 additions and 1 deletions
10
aider/io.py
10
aider/io.py
|
@ -1,6 +1,7 @@
|
|||
import base64
|
||||
import itertools
|
||||
import os
|
||||
import time
|
||||
from collections import defaultdict
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
|
@ -26,9 +27,16 @@ class Spinner:
|
|||
def __init__(self, io, text):
|
||||
self.io = io
|
||||
self.text = text
|
||||
print(f" {self.text} {next(self.io.spinner_chars)}", end="\r", flush=True)
|
||||
self.last_update = 0
|
||||
self._step()
|
||||
|
||||
def step(self):
|
||||
current_time = time.time()
|
||||
if current_time - self.last_update >= 0.1:
|
||||
self._step()
|
||||
self.last_update = current_time
|
||||
|
||||
def _step(self):
|
||||
print(f" {self.text} {next(self.io.spinner_chars)}", end="\r", flush=True)
|
||||
|
||||
def end(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue