diff --git a/src/rougail/annotator/variable.py b/src/rougail/annotator/variable.py index a03b1ad42..5022a60f7 100644 --- a/src/rougail/annotator/variable.py +++ b/src/rougail/annotator/variable.py @@ -116,14 +116,20 @@ class Annotator(Walk): # pylint: disable=R0903 continue if variable.type in RENAME_TYPE: warning = f'the variable "{ variable.path }" has a depreciated type "{variable.type}", please use "{RENAME_TYPE[variable.type]}" instead in {display_xmlfiles(variable.xmlfiles)}' - warn(warning) + warn(warning, + DeprecationWarning, + ) variable.type = RENAME_TYPE[variable.type] if variable.type == 'cidr': warning = f'the variable "{ variable.path }" has a depreciated type "{variable.type}", please use type "ip" with attribute cidr=True instead in {display_xmlfiles(variable.xmlfiles)}' - warn(warning) + warn(warning, + DeprecationWarning, + ) if variable.type == 'network_cidr': warning = f'the variable "{ variable.path }" has a depreciated type "{variable.type}", please use type "network" with attribute cidr=True instead in {display_xmlfiles(variable.xmlfiles)}' - warn(warning) + warn(warning, + DeprecationWarning, + ) self.objectspace.informations.add( variable.path, "ymlfiles", variable.xmlfiles ) diff --git a/src/rougail/convert/convert.py b/src/rougail/convert/convert.py index ef3318904..509650b0c 100644 --- a/src/rougail/convert/convert.py +++ b/src/rougail/convert/convert.py @@ -585,7 +585,10 @@ class ParserVariable: del family["variable"] if self.version != "1.0": warning = f'"variable" attribute in dynamic family "{ path }" is depreciated in {filename}' - warn(warning) + warn(warning, + DeprecationWarning, + stacklevel=2, + ) if "variable" in family: raise Exception( f'dynamic family must not have "variable" attribute for "{family["path"]}" in {family["xmlfiles"]}' diff --git a/src/rougail/convert/object_model.py b/src/rougail/convert/object_model.py index 765a2f917..deadf3828 100644 --- a/src/rougail/convert/object_model.py +++ b/src/rougail/convert/object_model.py @@ -307,7 +307,10 @@ class JinjaCalculation(Calculation): objectspace.jinja[jinja_path] = self.jinja if return_type in RENAME_TYPE: warning = f'the variable "{ self.path }" has a depreciated return_type "{return_type}", please use "{RENAME_TYPE[return_type]}" instead in {display_xmlfiles(variable.xmlfiles)}' - warn(warning) + warn(warning, + DeprecationWarning, + stacklevel=2, + ) return_type = RENAME_TYPE[return_type] default = { "function": function, diff --git a/src/rougail/error.py b/src/rougail/error.py index f6661482f..04b165434 100644 --- a/src/rougail/error.py +++ b/src/rougail/error.py @@ -75,6 +75,10 @@ class ExtentionError(Exception): pass +class RougailWarning(UserWarning): + pass + + ## ---- specific exceptions ----