MilesCranmer commited on
Commit
7dd54ff
1 Parent(s): 81d46f1

Pass terminal size through to julia for progress bar

Browse files
Files changed (1) hide show
  1. pysr/sr.py +8 -2
pysr/sr.py CHANGED
@@ -347,7 +347,12 @@ def _cmd_runner(command, **kwargs):
347
  while True:
348
  line = process.stdout.readline()
349
  if not line: break
350
- print(line.decode('utf-8').replace('\n', ''))
 
 
 
 
 
351
 
352
  process.stdout.close()
353
  process.wait()
@@ -477,7 +482,8 @@ ncyclesperiteration={ncyclesperiteration:d},
477
  fractionReplaced={fractionReplaced:f}f0,
478
  topn={topn:d},
479
  verbosity=round(Int32, {verbosity:f}),
480
- progress={'true' if progress else 'false'}
 
481
  """
482
 
483
  def_hyperparams += '\n)'
 
347
  while True:
348
  line = process.stdout.readline()
349
  if not line: break
350
+ decoded_line = (line.decode('utf-8')
351
+ .replace('\\033[K', '\033[K')
352
+ .replace('\\033[1A', '\033[1A')
353
+ .replace('\\r', '\r'))
354
+ print(decoded_line, end='')
355
+
356
 
357
  process.stdout.close()
358
  process.wait()
 
482
  fractionReplaced={fractionReplaced:f}f0,
483
  topn={topn:d},
484
  verbosity=round(Int32, {verbosity:f}),
485
+ progress={'true' if progress else 'false'},
486
+ terminal_width={os.get_terminal_size().columns:d}
487
  """
488
 
489
  def_hyperparams += '\n)'