name_to_name_index

lsst.ts.salobj.name_to_name_index(name: str) Tuple[str, int]

Parse a SAL component name of the form name[:index].

Parameters
namestr

Component name of the form name or name:index. The default index is 0.

Returns
name_inttuple

A tuple containing the component name (str) and index (int). The index is 0 if the input did not specify.

Raises
ValueError

If the name cannot be parsed.

Notes

Examples:

  • "Script" -> ("Script", 0)

  • "Script:0" -> ("Script", 0)

  • "Script:15" -> ("Script", 15)

  • " Script:15" -> raise ValueError (leading space)

  • "Script:15 " -> raise ValueError (trailing space)

  • "Script:" -> raise ValueError (colon with no index)

  • "Script:zero" -> raise ValueError (index not an integer)