Skip to content

Commit 59e38d5

Browse files
committed
remove print statements
1 parent 55c50f5 commit 59e38d5

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

laser_prynter/pbar.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,8 @@ def update(self, n: int) -> None:
134134
'update the progress bar by n steps'
135135

136136
target_pos = self._pbar_terminal_x_at(self.i + n) + 1
137-
print(f'{target_pos=}, {self.x_pos=}, {self.i=}, {n=}')
138137

139138
for pos in range(self.x_pos, target_pos):
140-
print(f'{pos=}')
141139
colour = self._pbar_colour_at(pos)
142140
self._print_bar_char(f'\x1b[48;2;{colour.r};{colour.g};{colour.b}m ', pos)
143141

@@ -161,6 +159,7 @@ def __enter__(self) -> PBar:
161159
return self
162160

163161
def __exit__(self, _exc_type: type, _exc_val: BaseException, _exc_tb: type) -> None:
162+
self.update(1)
164163
_print_to_terminal(
165164
f'\x1b[0;{self.h}r' # reset margins
166165
f'\x1b[{self.h};1000H' # move to bottom line
@@ -173,5 +172,5 @@ def __exit__(self, _exc_type: type, _exc_val: BaseException, _exc_tb: type) -> N
173172
with PBar(100, *PBar.randgrad()) as pbar:
174173
for i in range(100):
175174
time.sleep(randint(int(0.01 * 100), int(0.1 * 100)) / 100)
176-
print(f'-> {i}')
175+
print(f'-> {i}', flush=True)
177176
pbar.update(1)

0 commit comments

Comments
 (0)