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:
- name
str
Component name of the form
name
orname:index
. The default index is 0.
- name
- Returns:
- name_int
tuple
A tuple containing the component name (str) and index (int). The index is 0 if the input did not specify.
- name_int
- 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)