def _prefix_thread(f, func):
  def run():
    while not f.closed:
      line = f.readline()
      if not line:
        break
      with printlock:
        print func(line)
    try:
      sys.stderr.write(f % "Closing fd %d\n")
      f.close() # idempotent, in case the f.closed broke out of the while loop
    except:
      # well, we tried
      pass
  t = threading.Thread(target=run)
  t.daemon = True
  t.start()
  return t
dataset/ETHPy150Open ucb-sts/sts/sts/util/procutils.py/_prefix_thread/swapped operands of `%`