From cca3000eb2c40e6436588a91ef7793a2954c94a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 11 Nov 2020 12:04:30 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5=20Remove=20deprecated=20plugin=20c?= =?UTF-8?q?ontrol=20properties?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit __plugin_init__ and __plugin_implementations__ (plural!) have been deprecated since 1.2.0.dev, time to nuke them. --- src/octoprint/plugin/core.py | 71 +----------------------------------- 1 file changed, 2 insertions(+), 69 deletions(-) diff --git a/src/octoprint/plugin/core.py b/src/octoprint/plugin/core.py index 3d5f35da1..395f6b9eb 100644 --- a/src/octoprint/plugin/core.py +++ b/src/octoprint/plugin/core.py @@ -207,35 +207,12 @@ class PluginInfo(object): attr_implementation = "__plugin_implementation__" """ Module attribute from which to retrieve the plugin's provided mixin implementation. """ - attr_implementations = "__plugin_implementations__" - """ - Module attribute from which to retrieve the plugin's provided implementations. - - This deprecated attribute will only be used if a plugin does not yet offer :attr:`attr_implementation`. Only the - first entry will be evaluated. - - .. deprecated:: 1.2.0-dev-694 - - Use :attr:`attr_implementation` instead. - """ - attr_helpers = "__plugin_helpers__" """ Module attribute from which to retrieve the plugin's provided helpers. """ attr_check = "__plugin_check__" """ Module attribute which to call to determine if the plugin can be loaded. """ - attr_init = "__plugin_init__" - """ - Module attribute which to call when loading the plugin. - - This deprecated attribute will only be used if a plugin does not yet offer :attr:`attr_load`. - - .. deprecated:: 1.2.0-dev-720 - - Use :attr:`attr_load` instead. - """ - attr_load = "__plugin_load__" """ Module attribute which to call when loading the plugin. """ @@ -331,54 +308,10 @@ class PluginInfo(object): ) elif phase == "before_load": - # if the plugin still uses __plugin_init__, log a deprecation warning and move it to __plugin_load__ - if hasattr(self.instance, self.__class__.attr_init): - if not hasattr(self.instance, self.__class__.attr_load): - # deprecation warning - import warnings - - warnings.warn( - "{name} uses deprecated control property __plugin_init__, use __plugin_load__ instead".format( - name=self.key - ), - DeprecationWarning, - ) - - # move it - init = getattr(self.instance, self.__class__.attr_init) - setattr(self.instance, self.__class__.attr_load, init) - - # delete __plugin_init__ - delattr(self.instance, self.__class__.attr_init) + pass elif phase == "after_load": - # if the plugin still uses __plugin_implementations__, log a deprecation warning and put the first - # item into __plugin_implementation__ - if hasattr(self.instance, self.__class__.attr_implementations): - if not hasattr(self.instance, self.__class__.attr_implementation): - # deprecation warning - import warnings - - warnings.warn( - "{name} uses deprecated control property __plugin_implementations__, use __plugin_implementation__ instead - only the first implementation of {name} will be recognized".format( - name=self.key - ), - DeprecationWarning, - ) - - # put first item into __plugin_implementation__ - implementations = getattr( - self.instance, self.__class__.attr_implementations - ) - if len(implementations) > 0: - setattr( - self.instance, - self.__class__.attr_implementation, - implementations[0], - ) - - # delete __plugin_implementations__ - delattr(self.instance, self.__class__.attr_implementations) + pass if additional_validators is not None: for validator in additional_validators: