def add_event(self, name):
        """Adds an event variable to be set by the driver.

        name: string
            Name of the event variable the driver should set during execution.
        """
        if name in self._events:
            self.parent.raise_exception("Trying to add event '%s' to driver, "
                                        "but it's already there" % name,
                                        AttributeError)
        # this is the easiest way to check for existence of an Event.
        # if the named event trait doesn't exist, the call to get_metadata will
        # raise an exception
        try:
            typ = self.parent.parent.get_metadata(name, 'type')
        except AttributeError:
            self.parent.raise_exception("Can't add event '%s' because it "
                                        "doesn't exist" % (name), AttributeError)
        if typ != 'event':
            self.parent.raise_exception(name % "'%s' is not an event", TypeError)

        self._events.append(name)
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/hasevents.py/HasEvents.add_event/swapped operands of `%`