Order.py 809 B

1234567891011121314151617181920212223242526272829303132
  1. class Order(object):
  2. """
  3. This Class is representing an Order which is raised by when an entry (Vocal/REST/ anything ...) is matching it.
  4. .. note:: Order are defined in the brain file for each synapse.
  5. """
  6. def __init__(self, sentence):
  7. self.sentence = sentence
  8. def __str__(self):
  9. return "%s: Sentence: %s" % (self.__class__.__name__, self.sentence)
  10. def serialize(self):
  11. """
  12. This method allows to serialize in a proper way this object
  13. :return: A dict of order
  14. :rtype: Dict
  15. """
  16. return {
  17. 'order': self.sentence
  18. }
  19. def __eq__(self, other):
  20. """
  21. This is used to compare 2 objects
  22. :param other:
  23. :return:
  24. """
  25. return self.__dict__ == other.__dict__