@classmethod
  def from_string(cls, pid):
    """Parse a PID from its string representation.

    PIDs may be represented as name@ip:port, e.g.

    .. code-block:: python

        pid = PID.from_string('master(1)@192.168.33.2:5051')

    :param pid: A string representation of a pid.
    :type pid: ``str``
    :return: The parsed pid.
    :rtype: :class:`PID`
    :raises: ``ValueError`` should the string not be of the correct syntax.
    """
    try:
      id_, ip_port = pid.split('@')
      ip, port = ip_port.split(':')
      port = int(port)
    except ValueError:
      raise ValueError(pid % 'Invalid PID: %s')
    return cls(ip, port, id_)
dataset/ETHPy150Open wickman/compactor/compactor/pid.py/PID.from_string/swapped operands of `%`