-
-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pull event name transformation into engine.
- Loading branch information
1 parent
78df9c6
commit c63319e
Showing
10 changed files
with
93 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
class BadEventHandlerException(TypeError): | ||
|
||
def __init__(self, instance, method, event): | ||
object_type = type(instance) | ||
event_type = type(event) | ||
o_name = object_type.__name__ | ||
e_name = event_type.__name__ | ||
article = ['a', 'an'][int(e_name.lower()[0] in "aeiou")] | ||
|
||
message = f""" | ||
{o_name}.{method}() signature incorrect, it should accept {article} {e_name} object and a signal function. | ||
{e_name} is a dataclass that represents an event. Its attributes | ||
tell you about the event. | ||
The signal function is a function you can call that accepts an event instance | ||
as its only parameter. Call it to add an event to the queue. You don't have to | ||
use it, but it is a mandatory argument provided by ppb. | ||
It should look like this: | ||
def {method}({e_name.lower()}_event: {e_name}, signal_function): | ||
(Your code goes here.) | ||
""" | ||
super().__init__(message) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,4 @@ | ||
from ppb import eventlib | ||
|
||
|
||
class System(eventlib.EventMixin): | ||
class System: | ||
|
||
def __init__(self, **_): | ||
pass | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters