MCPcopy
hub / github.com/Nuitka/Nuitka / __init__

Method __init__

nuitka/Progress.py:152–255  ·  view source on GitHub ↗
(self, iterable, stage, total, min_total, unit)

Source from the content-addressed store, hash-verified

150
151class NuitkaProgressBarRich(object):
152 def __init__(self, iterable, stage, total, min_total, unit):
153 self.iterable = iterable or ()
154
155 if total is None and hasattr(iterable, "__len__"):
156 self.total = len(iterable)
157 else:
158 self.total = total
159
160 self.min_total = min_total
161 self.item = None
162
163 class TextColumnCropped(_rich_progress.TextColumn):
164 def __init__(
165 self,
166 text_format,
167 style="none",
168 justify="left",
169 markup=True,
170 highlighter=None,
171 table_column=None,
172 ):
173 # False alarm, pylint: disable=non-parent-init-called
174 _rich_progress.TextColumn.__init__(
175 self,
176 text_format=text_format,
177 style=style,
178 justify=justify,
179 markup=markup,
180 highlighter=highlighter,
181 table_column=table_column,
182 )
183
184 def render(self, task):
185 _text = self.text_format.format(task=task)
186 if self.markup:
187 text = _rich_progress.Text.from_markup(
188 _text, style=self.style, justify=self.justify, overflow="crop"
189 )
190 else:
191 text = _rich_progress.Text(
192 _text, style=self.style, justify=self.justify, overflow="crop"
193 )
194 if self.highlighter:
195 self.highlighter.highlight(text)
196 return text
197
198 # Unwrap our own redirection for Scons.
199 rich_file = sys.stdout
200 if hasattr(rich_file, "original_stream"):
201 rich_file = rich_file.original_stream
202
203 # This is for "rich" to not use the "SconsStreamRedirector" that we install
204 # for Scons, but instead use the one that really goes to the terminal.
205 console = _rich_console.Console(file=rich_file)
206
207 self.rich_progress = _rich_progress.Progress(
208 _rich_progress.TextColumn(
209 wrapWithStyles("{task.description}", styles=_progress_info_style),

Callers

nothing calls this directly

Calls 5

setCurrentMethod · 0.95
lenFunction · 0.85
TextColumnCroppedClass · 0.85
wrapWithStylesFunction · 0.70
startMethod · 0.45

Tested by

no test coverage detected