INNER CODE UNIT · Python

submit_next

yurijmikhalevich/rclip · rclip/main.py:139

    def submit_next() -> None:
      item = next(items_iter, None)
      if item is not None:
        path, meta = item
        in_flight.append((path, meta, executor.submit(_read_and_preprocess, path)))

    for _ in range(max_in_flight):
      submit_next()

    while in_flight:
      path, meta, future = in_flight.popleft()
      submit_next()  # refill so the window stays full while the consumer is busy
      try:
        _, file_hash, preprocessed = future.result()
        yield path, meta, file_hash, preprocessed
      except helpers.ImageTooLargeError as ex:
        print(_too_large_message(path, ex.pixels, ex.limit), file=sys.stderr)
      except (PIL.Image.DecompressionBombError, PIL.Image.DecompressionBombWarning) as ex:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…