parameters: (reduce)
return_statement: return iliad_wrapper
docstring: This decorator wraps around main procedure and switch input from
          web variables to properties or vice versa depending on web variables
          presence
docstring_summary: This decorator wraps around main procedure and switch input from
          web variables to properties or vice versa depending on web variables
          presence
docstring_tokens: This decorator wraps around main procedure and switch input from web variables to properties or vice versa depending on web variables presence
function: def iliad(reduce):
      """ This decorator wraps around main procedure and switch input from
          web variables to properties or vice versa depending on web variables
          presence
      """
  
      def iliad_wrapper(*args):
          # seq = inspect.stack()
          # output workspace name.
          try:
              name = funcinspect.lhs_info('names')
              out_ws_name = name[0]
          # no-exception-type(s) specified. Who knows what exception this internal procedure rises...
          # pylint: disable=W0702
          except:
              out_ws_name = None
  
          host = args[0]
          if len(args) > 1:
              input_file = args[1]
              if len(args) > 2:
                  output_directory = args[2]
              else:
                  output_directory = None
          else:
              input_file = None
              output_directory = None
          # add input file folder to data search directory if file has it
          if input_file and isinstance(input_file, str):
              data_path = os.path.dirname(input_file)
              if len(data_path) > 0:
                  try:
                      config.appendDataSearchDir(str(data_path))
                      args[1] = os.path.basename(input_file)
                  # pylint: disable=bare-except
                  except:  # if mantid is not available, this should ignore config
                      pass
          if output_directory:
              config['defaultsave.directory'] = str(output_directory)
  
          # pylint: disable=protected-access
          if host._run_from_web:
              # pylint: disable=protected-access
              web_vars = host._wvs.get_all_vars()
              host.reducer.prop_man.set_input_parameters(**web_vars)
          else:
              pass  # we should set already set up variables using
  
          custom_print_function = host.set_custom_output_filename()
          if custom_print_function is not None:
              PropertyManager.save_file_name.set_custom_print(custom_print_function)
          #
          rez = reduce(*args)
  
          # prohibit returning workspace to web services.
          # pylint: disable=protected-access
          if host._run_from_web and not isinstance(rez, str):
              rez = ""
          else:
              if isinstance(rez, list):
                  # multirep run, just return as it is
                  return rez
              if rez is not None and out_ws_name and rez.name() != out_ws_name:
                  # the function does not return None, pylint is wrong
                  # pylint: disable=W1111
                  rez = PropertyManager.sample_run.synchronize_ws(rez, out_ws_name)
          return rez
  
      return iliad_wrapper
function_tokens: def iliad ( reduce ) : def iliad_wrapper ( * args ) : # seq = inspect.stack() # output workspace name. try : name = funcinspect . lhs_info ( 'names' ) out_ws_name = name [ 0 ] # no-exception-type(s) specified. Who knows what exception this internal procedure rises... # pylint: disable=W0702 except : out_ws_name = None host = args [ 0 ] if len ( args ) > 1 : input_file = args [ 1 ] if len ( args ) > 2 : output_directory = args [ 2 ] else : output_directory = None else : input_file = None output_directory = None # add input file folder to data search directory if file has it if input_file and isinstance ( input_file , str ) : data_path = os . path . dirname ( input_file ) if len ( data_path ) > 0 : try : config . appendDataSearchDir ( str ( data_path ) ) args [ 1 ] = os . path . basename ( input_file ) # pylint: disable=bare-except except : # if mantid is not available, this should ignore config pass if output_directory : config [ 'defaultsave.directory' ] = str ( output_directory ) # pylint: disable=protected-access if host . _run_from_web : # pylint: disable=protected-access web_vars = host . _wvs . get_all_vars ( ) host . reducer . prop_man . set_input_parameters ( * * web_vars ) else : pass # we should set already set up variables using custom_print_function = host . set_custom_output_filename ( ) if custom_print_function is not None : PropertyManager . save_file_name . set_custom_print ( custom_print_function ) # rez = reduce ( * args ) # prohibit returning workspace to web services. # pylint: disable=protected-access if host . _run_from_web and not isinstance ( rez , str ) : rez = "" else : if isinstance ( rez , list ) : # multirep run, just return as it is return rez if rez is not None and out_ws_name and rez . name ( ) != out_ws_name : # the function does not return None, pylint is wrong # pylint: disable=W1111 rez = PropertyManager . sample_run . synchronize_ws ( rez , out_ws_name ) return rez return iliad_wrapper