original_docstring: 
      Foward fill a list of values with the last valid one.
      
docstring: Foward fill a list of values with the last valid one.
docstring_tokens: Foward fill a list of values with the last valid one .
code: def forward_fill(arr, cond_value):
      """
      Foward fill a list of values with the last valid one.
      """
      valid_val = None
      for i in range(len(arr)):
          if arr[i] != cond_value:
              valid_val = arr[i]
          else:
              j = i
              while valid_val is None and j < len(arr):
                  j += 1
                  try:
                      if arr[j] != cond_value:
                          valid_val = arr[j]
                          break
                  except IndexError as e:
                      msg = (
                          "Unexpected read of the optimization results, "
                          "please check that your simulations have not all been crashing"
                      )
                      raise exceptions.OptimisationResultsError(msg)
  
              if valid_val is not None:
                  arr[i] = valid_val
              else:
                  msg = (
                      "All simulations crashed, nothing to display. "
                      "Please check the setup and settings of your optimization run."
                  )
                  raise exceptions.OptimisationResultsError(msg)
  
      return arr
code_tokens: def forward_fill ( arr , cond_value ) : valid_val = None for i in range ( len ( arr ) ) : if arr [ i ] != cond_value : valid_val = arr [ i ] else : j = i while valid_val is None and j < len ( arr ) : j += 1 try : if arr [ j ] != cond_value : valid_val = arr [ j ] break except IndexError as e : msg = ( "Unexpected read of the optimization results, " "please check that your simulations have not all been crashing" ) raise exceptions . OptimisationResultsError ( msg ) if valid_val is not None : arr [ i ] = valid_val else : msg = ( "All simulations crashed, nothing to display. " "Please check the setup and settings of your optimization run." ) raise exceptions . OptimisationResultsError ( msg ) return arr
short_docstring: Foward fill a list of values with the last valid one.
short_docstring_tokens: Foward fill a list of values with the last valid one .
comment: """
      Foward fill a list of values with the last valid one.
      """