pint.utils.split_prefixed_name

pint.utils.split_prefixed_name(name)[source]

Split a prefixed name.

Parameters:

name (str) – Prefixed name

Returns:

  • prefixPart (str) – The prefix part of the name

  • indexPart (str) – The index part from the name

  • indexValue (int) – The absolute index value

Example

>>> split_prefixed_name("DMX_0123")
('DMX_', '0123', 123)
>>> split_prefixed_name("T2EFAC17")
('T2EFAC', '17', 17)
>>> split_prefixed_name("F12")
('F', '12', 12)
>>> split_prefixed_name("DMXR1_2")
('DMXR1_', '2', 2)
>>> split_prefixed_name("PEPOCH")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pint/utils.py", line 406, in split_prefixed_name
    raise PrefixError("Unrecognized prefix name pattern '%s'." % name)
pint.utils.PrefixError: Unrecognized prefix name pattern 'PEPOCH'.