def get_fallback_predictions(sources):
  """Return List of fallback predictions or List of `None` if not provided."""
  if FLAGS.fallback_predictions:
    fallback_predictions = []
    with tf.io.gfile.GFile(FLAGS.fallback_predictions, "r") as predictions_file:
      for line in predictions_file:
        fallback_predictions.append(line.rstrip())
    if len(sources) != len(fallback_predictions):
      raise ValueError(
          "Number of inputs != number of fallback predictions: %s vs. %s." %
          (len(sources), len(fallback_predictions)))
    return fallback_predictions
  else:
    return [None] * len(sources)
Return List of fallback predictions or List of `None` if not provided.
language/compgen/nqg/model/parser/inference/generate_predictions.py