From 06543710dd92b0a0d5c804d7a45bb1de52d3375d Mon Sep 17 00:00:00 2001 From: dgw Date: Thu, 25 Mar 2021 19:10:20 -0700 Subject: [PATCH] config.types: add deprecation warnings for ValidatedAttribute with bool The boolean helper functions seem to be the best place for marking this special case of ValidatedAttribute as deprecated, since they are ONLY called when the special logic gets invoked. --- sopel/config/types.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sopel/config/types.py b/sopel/config/types.py index 2abb5fda6c..3d4ed33f3d 100644 --- a/sopel/config/types.py +++ b/sopel/config/types.py @@ -31,7 +31,7 @@ import re import sys -from sopel.tools import get_input +from sopel.tools import deprecated, get_input if sys.version_info.major >= 3: unicode = str @@ -264,6 +264,11 @@ def __delete__(self, instance): instance._parser.remove_option(instance._section_name, self.name) +@deprecated( + reason="Use BooleanAttribute instead of ValidatedAttribute with bool as parser", + version='7.1', + removed_in='9.0', +) def _parse_boolean(value): if value is True or value == 1: return value @@ -272,6 +277,11 @@ def _parse_boolean(value): return bool(value) +@deprecated( + reason="Use BooleanAttribute instead of ValidatedAttribute with bool as parser", + version='7.1', + removed_in='9.0', +) def _serialize_boolean(value): return 'true' if _parse_boolean(value) else 'false'