-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/ghi-#6-plugin-api' into develop
- Loading branch information
Showing
1 changed file
with
30 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from .logging import Logger | ||
from .context import Context | ||
|
||
|
||
class Plugin(object): | ||
""" | ||
A abstract base class for plugins that process directives. | ||
""" | ||
def __init__(self, context): | ||
self._context = context | ||
self._log = Logger() | ||
|
||
def can_handle(self, directive): | ||
""" | ||
Checks if the plugin can handle the specified directive. | ||
:param directive: The directive to check | ||
:return: True if the specified directive can be handled, False otherwise | ||
""" | ||
raise NotImplementedError | ||
|
||
def handle(self, directive, data): | ||
""" | ||
Handles the data of the specified directive. | ||
:param directive: The directive to handle the data of | ||
:param data: The data to handle | ||
:return: True if the directive has been handled successfully | ||
""" | ||
raise NotImplementedError |