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

Method __init__

src/click/_termui_impl.py:58–127  ·  view source on GitHub ↗
(
        self,
        iterable: cabc.Iterable[V] | None,
        length: int | None = None,
        fill_char: str = "#",
        empty_char: str = " ",
        bar_template: str = "%(bar)s",
        info_sep: str = "  ",
        hidden: bool = False,
        show_eta: bool = True,
        show_percent: bool | None = None,
        show_pos: bool = False,
        item_show_func: t.Callable[[V | None], str | None] | None = None,
        label: str | None = None,
        file: t.TextIO | None = None,
        color: bool | None = None,
        update_min_steps: int = 1,
        width: int = 30,
    )

Source from the content-addressed store, hash-verified

56
57class ProgressBar(t.Generic[V]):
58 def __init__(
59 self,
60 iterable: cabc.Iterable[V] | None,
61 length: int | None = None,
62 fill_char: str = "#",
63 empty_char: str = " ",
64 bar_template: str = "%(bar)s",
65 info_sep: str = " ",
66 hidden: bool = False,
67 show_eta: bool = True,
68 show_percent: bool | None = None,
69 show_pos: bool = False,
70 item_show_func: t.Callable[[V | None], str | None] | None = None,
71 label: str | None = None,
72 file: t.TextIO | None = None,
73 color: bool | None = None,
74 update_min_steps: int = 1,
75 width: int = 30,
76 ) -> None:
77 self.fill_char = fill_char
78 self.empty_char = empty_char
79 self.bar_template = bar_template
80 self.info_sep = info_sep
81 self.hidden = hidden
82 self.show_eta = show_eta
83 self.show_percent = show_percent
84 self.show_pos = show_pos
85 self.item_show_func = item_show_func
86 self.label: str = label or ""
87
88 if file is None:
89 file = _default_text_stdout()
90
91 # There are no standard streams attached to write to. For example,
92 # pythonw on Windows.
93 if file is None:
94 file = StringIO()
95
96 self.file = file
97 self.color = color
98 self.update_min_steps = update_min_steps
99 self._completed_intervals = 0
100 self.width: int = width
101 self.autowidth: bool = width == 0
102
103 if length is None:
104 from operator import length_hint
105
106 length = length_hint(iterable, -1)
107
108 if length == -1:
109 length = None
110 if iterable is None:
111 if length is None:
112 raise TypeError("iterable or length is required")
113 iterable = t.cast("cabc.Iterable[V]", range(length))
114 self.iter: cabc.Iterable[V] = iter(iterable)
115 self.length = length

Callers

nothing calls this directly

Calls 2

isattyFunction · 0.85
timeMethod · 0.80

Tested by

no test coverage detected