1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- import termcolor
- from dataclasses import *
- from abc import *
- from typing import *
- from sccd.util.duration import *
- # An event that can cause transitions to happen.
- # Input events are internal events too.
- @dataclass
- class InternalEvent:
- __slots__ = ["id", "name", "params"]
- id: int
- name: str # solely used for pretty printing
- params: List[Any]
- def __str__(self):
- s = "Event("+self.name
- if self.params:
- s += str(self.params)
- s += ")"
- return termcolor.colored(s, 'yellow')
- __repr__ = __str__
-
- @dataclass
- class OutputEvent:
- __slots__ = ["port", "name", "params"]
- port: str
- name: str
- params: List[Any]
- # Compare by value
- def __eq__(self, other):
- return self.port == other.port and self.name == other.name and self.params == other.params
- def __str__(self):
- s = "OutputEvent("+self.port+"."+self.name
- if self.params:
- s += str(self.params)
- s += ")"
- return termcolor.colored(s, 'yellow')
- __repr__ = __str__
|