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/plugins/link.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'dotbot/plugins/link.py') diff --git a/dotbot/plugins/link.py b/dotbot/plugins/link.py index 4112fe5..1064bb6 100644 --- a/dotbot/plugins/link.py +++ b/dotbot/plugins/link.py @@ -13,15 +13,7 @@ class Link(dotbot.Plugin): _directive = 'link' - def can_handle(self, directive): - return directive == self._directive - - def handle(self, directive, data): - if directive != self._directive: - raise ValueError('Link cannot handle directive %s' % directive) - return self._process_links(data) - - def _process_links(self, links): + def handle(self, directive, links): success = True defaults = self._context.defaults().get('link', {}) for destination, source in links.items(): -- cgit v1.2.3