From 419a8c531db92cbca4fc68b9b028180f8c7f03e6 Mon Sep 17 00:00:00 2001 From: Steve Penrod Date: Thu, 28 Feb 2019 13:11:07 -0600 Subject: [PATCH 1/2] Hide deprecated warning in certain cases The deprecation warning was firing off at the load of every skill when the decorators are being iterated through by internal code (which includes the self.config with an @property). Add check for these special cases to not show a warning. --- mycroft/skills/core.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mycroft/skills/core.py b/mycroft/skills/core.py index 1d686355a84d..5e0a0a341136 100644 --- a/mycroft/skills/core.py +++ b/mycroft/skills/core.py @@ -500,8 +500,12 @@ def config(self): """ Provide deprecation warning when accessing config. TODO: Remove in 19.08 """ - self.log.warning('self.config is deprecated. Switch to using ' - 'self.setting["whatever"] within your skill.') + stack = simple_trace(traceback.format_stack()) + if (not " _register_decorated" in stack and + not "register_resting_screen" in stack): + LOG.warning('self.config is deprecated. Switch to using ' + 'self.setting["whatever"] within your skill.') + LOG.warning(stack) return self._config @property From f5025f5eaf050f488f46eeeb799249fd3c024828 Mon Sep 17 00:00:00 2001 From: Steve Penrod Date: Thu, 28 Feb 2019 13:15:03 -0600 Subject: [PATCH 2/2] Fix PEP8 --- mycroft/skills/core.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mycroft/skills/core.py b/mycroft/skills/core.py index 5e0a0a341136..f62f781e6cb4 100644 --- a/mycroft/skills/core.py +++ b/mycroft/skills/core.py @@ -501,11 +501,11 @@ def config(self): TODO: Remove in 19.08 """ stack = simple_trace(traceback.format_stack()) - if (not " _register_decorated" in stack and - not "register_resting_screen" in stack): - LOG.warning('self.config is deprecated. Switch to using ' - 'self.setting["whatever"] within your skill.') - LOG.warning(stack) + if (" _register_decorated" not in stack and + "register_resting_screen" not in stack): + LOG.warning('self.config is deprecated. Switch to using ' + 'self.setting["whatever"] within your skill.') + LOG.warning(stack) return self._config @property