MCPcopy
hub / github.com/pallets/click / format_bar

Method format_bar

src/click/_termui_impl.py:210–227  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

208 return f"{int(self.pct * 100): 4}%"[1:]
209
210 def format_bar(self) -> str:
211 if self.length is not None:
212 bar_length = int(self.pct * self.width)
213 bar = self.fill_char * bar_length
214 bar += self.empty_char * (self.width - bar_length)
215 elif self.finished:
216 bar = self.fill_char * self.width
217 else:
218 chars = list(self.empty_char * (self.width or 1))
219 if self.time_per_iteration != 0:
220 chars[
221 int(
222 (math.cos(self.pos * self.time_per_iteration) / 2.0 + 0.5)
223 * self.width
224 )
225 ] = self.fill_char
226 bar = "".join(chars)
227 return bar
228
229 def format_progress_line(self) -> str:
230 show_percent = self.show_percent

Callers 2

format_progress_lineMethod · 0.95

Calls

no outgoing calls

Tested by 1