From 7637fb6c85ae753616046c1d4c9b23b56c8cdf57 Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Sat, 13 Jan 2018 16:13:07 -0500 Subject: Remove deprecated support for Extension args. In the past Markdown used to pass extension config settings to the Extension class via a positional argument named `config`. That was deprecated in 2.6 in favor of using keyword arguments (`**kwargs`). Support has been completely dropped. Only keyword arguments are accepted. --- markdown/extensions/__init__.py | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) (limited to 'markdown/extensions/__init__.py') diff --git a/markdown/extensions/__init__.py b/markdown/extensions/__init__.py index 6e7a08a..1e33a14 100644 --- a/markdown/extensions/__init__.py +++ b/markdown/extensions/__init__.py @@ -5,7 +5,6 @@ Extensions from __future__ import unicode_literals from ..util import parseBoolValue -import warnings class Extension(object): @@ -20,34 +19,8 @@ class Extension(object): # if a default is not set here. config = {} - def __init__(self, *args, **kwargs): + def __init__(self, **kwargs): """ Initiate Extension and set up configs. """ - - # check for configs arg for backward compat. - # (there only ever used to be one so we use arg[0]) - if len(args): - if args[0] is not None: - self.setConfigs(args[0]) - warnings.warn('Extension classes accepting positional args is ' - 'pending Deprecation. Each setting should be ' - 'passed into the Class as a keyword. Positional ' - 'args are deprecated and will raise ' - 'an error in version 2.7. See the Release Notes for ' - 'Python-Markdown version 2.6 for more info.', - DeprecationWarning) - # check for configs kwarg for backward compat. - if 'configs' in kwargs.keys(): - if kwargs['configs'] is not None: - self.setConfigs(kwargs.pop('configs', {})) - warnings.warn('Extension classes accepting a dict on the single ' - 'keyword "config" is pending Deprecation. Each ' - 'setting should be passed into the Class as a ' - 'keyword directly. The "config" keyword is ' - 'deprecated and raise an error in ' - 'version 2.7. See the Release Notes for ' - 'Python-Markdown version 2.6 for more info.', - DeprecationWarning) - # finally, use kwargs self.setConfigs(kwargs) def getConfig(self, key, default=''): -- cgit v1.2.3