Skip to content
This repository was archived by the owner on Dec 17, 2019. It is now read-only.

Commit 9abd79b

Browse files
committed
PendingDeprecationWarning (v2.5) => DeprecationWarning (v2.6)
1 parent 49fa23a commit 9abd79b

File tree

3 files changed

+35
-41
lines changed

3 files changed

+35
-41
lines changed

markdown/__init__.py

Lines changed: 25 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,9 @@ def __init__(self, *args, **kwargs):
121121
# ignore any additional args
122122
break
123123
if len(args):
124-
warnings.warn('Positional arguments are pending depreacted in '
125-
'Markdown and will be deprecated in version 2.6. '
124+
warnings.warn('Positional arguments are depreacted in Markdown'
126125
'Use keyword arguments only.',
127-
PendingDeprecationWarning)
126+
DeprecationWarning)
128127

129128
# Loop through kwargs and assign defaults
130129
for option, default in self.option_defaults.items():
@@ -136,19 +135,17 @@ def __init__(self, *args, **kwargs):
136135
self.enable_attributes = False
137136

138137
if 'safe_mode' in kwargs:
139-
warnings.warn('"safe_mode" is pending deprecation in '
140-
'Python-Markdown and will be deprecated in '
141-
'version 2.6. Use an HTML sanitizer (like '
138+
warnings.warn('"safe_mode" is deprecated in Python-Markdown'
139+
'Use an HTML sanitizer (like '
142140
'Bleach http://bleach.readthedocs.org/) '
143141
'if you are parsing untrusted markdown text. '
144-
'See the 2.5 release notes for more info',
145-
PendingDeprecationWarning)
142+
'See the 2.6 release notes for more info',
143+
DeprecationWarning)
146144

147145
if 'html_replacement_text' in kwargs:
148-
warnings.warn('The "html_replacement_text" keyword is pending '
149-
'deprecation in Python-Markdown and will be '
150-
'deprecated in version 2.6 along with "safe_mode".',
151-
PendingDeprecationWarning)
146+
warnings.warn('The "html_replacement_text" keyword is '
147+
'deprecated along with "safe_mode".',
148+
DeprecationWarning)
152149

153150
self.registeredExtensions = []
154151
self.docType = ""
@@ -217,13 +214,12 @@ def build_extension(self, ext_name, configs):
217214
pairs = [x.split("=") for x in ext_args.split(",")]
218215
configs.update([(x.strip(), y.strip()) for (x, y) in pairs])
219216
warnings.warn('Setting configs in the Named Extension string is '
220-
'pending deprecation. It is recommended that you '
217+
'deprecated. It is recommended that you '
221218
'pass an instance of the extension class to '
222219
'Markdown or use the "extension_configs" keyword. '
223-
'The current behavior will be deprecated in '
224-
'version 2.6 and raise an error in version 2.7. '
220+
'The current behavior will raise an error in version 2.7. '
225221
'See the Release Notes for Python-Markdown version '
226-
'2.5 for more info.', PendingDeprecationWarning)
222+
'2.6 for more info.', DeprecationWarning)
227223

228224
# Get class name (if provided): `path.to.module:ClassName`
229225
ext_name, class_name = ext_name.split(':', 1) \
@@ -253,15 +249,14 @@ def build_extension(self, ext_name, configs):
253249
module_name
254250
)
255251
warnings.warn('Using short names for Markdown\'s builtin '
256-
'extensions is pending deprecation. Use the '
252+
'extensions is deprecated. Use the '
257253
'full path to the extension with Python\'s dot '
258254
'notation (eg: "%s" instead of "%s"). The '
259-
'current behavior will be deprecated in '
260-
'version 2.6 and raise an error in version '
255+
'current behavior will raise an error in version '
261256
'2.7. See the Release Notes for '
262-
'Python-Markdown version 2.5 for more info.' %
257+
'Python-Markdown version 2.6 for more info.' %
263258
(module_name, ext_name),
264-
PendingDeprecationWarning)
259+
DeprecationWarning)
265260
except ImportError:
266261
# Preppend `mdx_` to name
267262
module_name_old_style = '_'.join(['mdx', ext_name])
@@ -270,17 +265,16 @@ def build_extension(self, ext_name, configs):
270265
logger.debug(
271266
'Successfuly imported extension module "%s".' %
272267
module_name_old_style)
273-
warnings.warn('Markdown\'s behavuor of appending "mdx_" '
274-
'to an extension name is pending '
275-
'deprecation. Use the full path to the '
268+
warnings.warn('Markdown\'s behavior of prepending "mdx_" '
269+
'to an extension name is deprecated. '
270+
'Use the full path to the '
276271
'extension with Python\'s dot notation '
277272
'(eg: "%s" instead of "%s"). The current '
278-
'behavior will be deprecated in version '
279-
'2.6 and raise an error in version 2.7. '
273+
'behavior will raise an error in version 2.7. '
280274
'See the Release Notes for Python-Markdown '
281-
'version 2.5 for more info.' %
275+
'version 2.6 for more info.' %
282276
(module_name_old_style, ext_name),
283-
PendingDeprecationWarning)
277+
DeprecationWarning)
284278
except ImportError as e:
285279
message = "Failed loading extension '%s' from '%s', '%s' " \
286280
"or '%s'" % (ext_name, ext_name, module_name,
@@ -524,10 +518,10 @@ def markdownFromFile(*args, **kwargs):
524518
if c == len(pos):
525519
break
526520
if len(args):
527-
warnings.warn('Positional arguments are pending depreacted in '
528-
'Markdown and will be deprecated in version 2.6. '
521+
warnings.warn('Positional arguments are depreacted in '
522+
'Markdown and will raise an error in version 2.7. '
529523
'Use keyword arguments only.',
530-
PendingDeprecationWarning)
524+
DeprecationWarning)
531525

532526
md = Markdown(**kwargs)
533527
md.convertFile(kwargs.get('input', None),

markdown/extensions/toc.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def order_toc_list(toc_list):
8888
class TocTreeprocessor(Treeprocessor):
8989
def __init__(self, md, config):
9090
super(TocTreeprocessor, self).__init__(md)
91-
91+
9292
self.marker = config["marker"]
9393
self.title = config["title"]
9494
self.slugify = config["slugify"]
@@ -104,7 +104,7 @@ def iterparent(self, root):
104104
for parent in root.iter():
105105
for child in parent:
106106
yield parent, child
107-
107+
108108
def replace_marker(self, root, elem):
109109
''' Replace marker with elem. '''
110110
for (p, c) in self.iterparent(root):
@@ -177,12 +177,12 @@ def run(self, doc):
177177
div = etree.Element("div")
178178
div.attrib["class"] = "toc"
179179
self.replace_marker(doc, div)
180-
180+
181181
toc_list = []
182182
for el in doc.iter():
183183
if self.header_rgx.match(el.tag):
184184
text = ''.join(itertext(el)).strip()
185-
185+
186186
# Do not override pre-existing ids
187187
if "id" not in el.attrib:
188188
elem_id = stashedHTML2text(text, self.markdown)

tests/test_apis.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -371,24 +371,24 @@ def testBaseExtention(self):
371371
)
372372

373373
def testMdxExtention(self):
374-
""" Test that appending mdx_ raises a PendingDeprecationWarning. """
374+
""" Test that prepending mdx_ raises a DeprecationWarning. """
375375
_create_fake_extension(name='fake', use_old_style=True)
376376
self.assertRaises(
377-
PendingDeprecationWarning,
377+
DeprecationWarning,
378378
markdown.Markdown, extensions=['fake']
379379
)
380380

381381
def testShortNameExtention(self):
382-
""" Test that using a short name raises a PendingDeprecationWarning. """
382+
""" Test that using a short name raises a DeprecationWarning. """
383383
self.assertRaises(
384-
PendingDeprecationWarning,
384+
DeprecationWarning,
385385
markdown.Markdown, extensions=['footnotes']
386386
)
387387

388388
def testStringConfigExtention(self):
389-
""" Test that passing configs to an Extension in the name raises a PendingDeprecationWarning. """
389+
""" Test that passing configs to an Extension in the name raises a DeprecationWarning. """
390390
self.assertRaises(
391-
PendingDeprecationWarning,
391+
DeprecationWarning,
392392
markdown.Markdown, extensions=['markdown.extension.footnotes(PLACE_MARKER=FOO)']
393393
)
394394

0 commit comments

Comments
 (0)