cerberus.solvers.CodeInput

class cerberus.solvers.CodeInput(inputs, main_input_idx=0, link_input=False)

Bases: object

A class representing the input for a solver. Can include files and folders.

__init__(inputs, main_input_idx=0, link_input=False)

Creates a new CodeInput object.

Parameters:
  • inputs (List[Union[str, Path]]) – A list of input file and folder names that should be copied to the working folder of any solvers using this CodeInput.

  • main_input_idx (Optional[int], optional) – Which of the input file names should be given as a command line argument to the solver using this CodeInput. Defaults to 0 (i.e. first). For solvers that don’t need input filename as command line argument, try None.

  • link_input (Union[bool,List[bool]], optional) – Link input files or folders instead of copying. Single value applies to all input files/folders. A list should contain one value per element in “inputs” argument. Defaults to False.

Raises:
  • RuntimeError – If a list is given for link_input, but the length of that list differs from that of inputs.

  • RuntimeError – If the main_input_idx is invalid considering the list of inputs.

Methods

__init__(inputs[, main_input_idx, link_input])

Creates a new CodeInput object.

copy_inputs_to_dir(dst_dir)

Copies input files and folders of this CodeInput object to given location.

copy_inputs_to_dir(dst_dir)

Copies input files and folders of this CodeInput object to given location.

Parameters:

dst_dir (Union[str, Path]) – Destination location for the copied data.