MCPcopy Create free account
hub / github.com/anthropics/anthropic-sdk-python / Spinner

Class Spinner

examples/memory/basic.py:44–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42
43
44class Spinner:
45 def __init__(self, message: str = "Thinking"):
46 self.message = message
47 self.spinning = False
48 self.thread = None
49
50 def start(self):
51 self.spinning = True
52 self.thread = threading.Thread(target=self._spin)
53 self.thread.start()
54
55 def stop(self):
56 self.spinning = False
57 if self.thread:
58 self.thread.join()
59 print("\r" + " " * (len(self.message) + 10) + "\r", end="", flush=True)
60
61 def _spin(self):
62 chars = "⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏"
63 i = 0
64 while self.spinning:
65 print(f"\r{self.message} {chars[i % len(chars)]}", end="", flush=True)
66 i += 1
67 time.sleep(0.1)
68
69
70def conversation_loop():

Callers 1

conversation_loopFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected