MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / __iter__

Method __iter__

pager_lib/tqdm/std.py:1160–1196  ·  view source on GitHub ↗

Backward-compatibility to use: for x in tqdm(iterable)

(self)

Source from the content-addressed store, hash-verified

1158 return id(self)
1159
1160 def __iter__(self):
1161 """Backward-compatibility to use: for x in tqdm(iterable)"""
1162
1163 # Inlining instance variables as locals (speed optimisation)
1164 iterable = self.iterable
1165
1166 # If the bar is disabled, then just walk the iterable
1167 # (note: keep this check outside the loop for performance)
1168 if self.disable:
1169 for obj in iterable:
1170 yield obj
1171 return
1172
1173 mininterval = self.mininterval
1174 last_print_t = self.last_print_t
1175 last_print_n = self.last_print_n
1176 min_start_t = self.start_t + self.delay
1177 n = self.n
1178 time = self._time
1179
1180 try:
1181 for obj in iterable:
1182 yield obj
1183 # Update and possibly print the progressbar.
1184 # Note: does not call self.update(1) for speed optimisation.
1185 n += 1
1186
1187 if n - last_print_n >= self.miniters:
1188 cur_t = time()
1189 dt = cur_t - last_print_t
1190 if dt >= mininterval and cur_t >= min_start_t:
1191 self.update(n - last_print_n)
1192 last_print_n = self.last_print_n
1193 last_print_t = self.last_print_t
1194 finally:
1195 self.n = n
1196 self.close()
1197
1198 def update(self, n=1):
1199 """

Callers 2

__reversed__Method · 0.95
__contains__Method · 0.95

Calls 2

updateMethod · 0.95
closeMethod · 0.95

Tested by

no test coverage detected