From 5c0a76908b1eb77a06e4a9d95e377110f20dc05c Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 15 Nov 2020 15:24:24 +0100 Subject: plugin: reduce code duplication Factor out supported directive checking, drop redundant checking in handle(). --- dotbot/plugin.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'dotbot/plugin.py') diff --git a/dotbot/plugin.py b/dotbot/plugin.py index 56d4da8..5e2c923 100644 --- a/dotbot/plugin.py +++ b/dotbot/plugin.py @@ -6,6 +6,8 @@ class Plugin(object): Abstract base class for commands that process directives. ''' + _directive = None + def __init__(self, context): self._context = context self._log = Messenger() @@ -14,7 +16,7 @@ class Plugin(object): ''' Returns true if the Plugin can handle the directive. ''' - raise NotImplementedError + return directive == self._directive def handle(self, directive, data): ''' -- cgit v1.2.3