ResSimpy.Nexus.nexus_file_operations.get_expected_token_value

ResSimpy.Nexus.nexus_file_operations.get_expected_token_value(token: str, token_line: str, file_list: list[str], ignore_values: list[str] | None = None, replace_with: str | VariableEntry | None = None, custom_message: str | None = None) str[source]

Function that returns the result of get_token_value if a value is found, otherwise it raises a ValueError.

Parameters:
  • token (str) – the token being searched for.

  • token_line (str) – string value of the line that the token was found in.

  • file_list (list[str]) – a list of strings containing each line of the file as a new entry

  • ignore_values (list[str], optional) – a list of values that should be ignored if found. Defaults to None.

  • replace_with (Union[str, VariableEntry, None], optional) – a value to replace the existing value with. Defaults to None.

  • Optional[str] (custom_message) – A custom error message if no value is found.

Returns:

str – The value following the supplied token, if it is present.

Raises:

ValueError if a value is not found