MCPcopy Create free account
hub / github.com/davda54/sam / LoadingBar

Class LoadingBar

example/utility/loading_bar.py:1–9  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1class LoadingBar:
2 def __init__(self, length: int = 40):
3 self.length = length
4 self.symbols = ['┈', '░', '▒', '▓']
5
6 def __call__(self, progress: float) -> str:
7 p = int(progress * self.length*4 + 0.5)
8 d, r = p // 4, p % 4
9 return '┠┈' + d * '█' + ((self.symbols[r]) + max(0, self.length-1-d) * '┈' if p < self.length*4 else '') + "┈┨"

Callers 1

__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected