|
From: <mi...@us...> - 2025-04-09 08:56:12
|
Revision: 10077
http://sourceforge.net/p/docutils/code/10077
Author: milde
Date: 2025-04-09 08:55:54 +0000 (Wed, 09 Apr 2025)
Log Message:
-----------
Use `PendingDeprecationWarning` and postpone removal when replacement is in 0.22.
Adam Turner noted DeprecationWarnings for some features where the replacement
functionality is introduced in Docutils 0.22.
As backwards compatibility with 0.21 should not imply DeprecationWarnings,
this commit postpones the removal to Docutils 2.0 and changes the
DeprecationWarnings to PendingDeprecationWarnings.
Modified Paths:
--------------
trunk/docutils/HISTORY.rst
trunk/docutils/RELEASE-NOTES.rst
trunk/docutils/docutils/parsers/rst/roles.py
trunk/docutils/docutils/readers/__init__.py
trunk/docutils/test/test_publisher.py
trunk/docutils/test/test_readers/test__init__.py
Modified: trunk/docutils/HISTORY.rst
===================================================================
--- trunk/docutils/HISTORY.rst 2025-04-08 10:27:44 UTC (rev 10076)
+++ trunk/docutils/HISTORY.rst 2025-04-09 08:55:54 UTC (rev 10077)
@@ -687,7 +687,8 @@
* docutils/parsers/rst/directives/__init__.py
- - `parser_name()` keeps details if converting `ImportError` to `ValueError`.
+ - `parser_name()` keeps details when converting `ImportError`
+ to `ValueError`.
* docutils/parsers/rst/roles.py
Modified: trunk/docutils/RELEASE-NOTES.rst
===================================================================
--- trunk/docutils/RELEASE-NOTES.rst 2025-04-08 10:27:44 UTC (rev 10076)
+++ trunk/docutils/RELEASE-NOTES.rst 2025-04-09 08:55:54 UTC (rev 10077)
@@ -142,6 +142,10 @@
Use `parsers.rst.directives.CSS3_LENGTH_UNITS`. Mind that this
is a tuple, not a list.
+* Remove the "name" argument from
+ `writers.latex2e.LaTeXTranslator.visit_docinfo_item()`
+ (ignored since Docutils 0.22) in Docutils 0.24.
+
* Remove `parsers.rst.directives.CSVTable.HeaderDialect`
in Docutils 1.0.
@@ -158,14 +162,12 @@
* Remove the input encoding auto-detection code in Docutils 1.0.
* Remove `parsers.rst.roles.set_classes()` and
- `parsers.rst.roles.normalized_role_options()` in Docutils 1.0.
+ `parsers.rst.roles.normalized_role_options()`
+ (obsoleted by `parsers.rst.roles.normalize_options()`) in Docutils 2.0.
* Remove the "rawsource" argument from `nodes.Text.__init__()`
in Docutils 2.0.
-* Remove the "name" argument from
- `writers.latex2e.LaTeXTranslator.visit_docinfo_item()` in Docutils 0.24
-
* Remove attributes `nodes.Element.known_attributes`,
`nodes.Element.basic_attributes`, and `nodes.Element.local_attributes`,
in Docutils 2.0.
@@ -178,8 +180,9 @@
* Remove the "reader_name", "parser_name", and "writer_name" arguments of
`core.Publisher.__init__()` and the `core.publish_*()` convenience
- functions in Docutils 2.0. Since Docutils 0.22, you may use "reader",
- "parser", and "writer" arguments for component names as well as instances.
+ functions as well as the "parser_name" argument of `Reader.__init__()`
+ in Docutils 2.0. Since Docutils 0.22, you may use "reader", "parser",
+ and "writer" arguments for component names as well as instances.
Misc
----
Modified: trunk/docutils/docutils/parsers/rst/roles.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/roles.py 2025-04-08 10:27:44 UTC (rev 10076)
+++ trunk/docutils/docutils/parsers/rst/roles.py 2025-04-09 08:55:54 UTC (rev 10077)
@@ -417,7 +417,7 @@
"""Deprecated. Obsoleted by ``normalize_options()``."""
warnings.warn('The auxiliary function roles.set_classes() is obsoleted'
' by roles.normalize_options() and will be removed'
- ' in Docutils 1.0', DeprecationWarning, stacklevel=2)
+ ' in Docutils 2.0', PendingDeprecationWarning, stacklevel=2)
if options and 'class' in options:
assert 'classes' not in options
options['classes'] = options['class']
@@ -427,7 +427,7 @@
def normalized_role_options(options):
warnings.warn('The auxiliary function roles.normalized_role_options() is '
'obsoleted by roles.normalize_options() and will be removed'
- ' in Docutils 1.0', DeprecationWarning, stacklevel=2)
+ ' in Docutils 2.0', PendingDeprecationWarning, stacklevel=2)
return normalize_options(options)
Modified: trunk/docutils/docutils/readers/__init__.py
===================================================================
--- trunk/docutils/docutils/readers/__init__.py 2025-04-08 10:27:44 UTC (rev 10076)
+++ trunk/docutils/docutils/readers/__init__.py 2025-04-09 08:55:54 UTC (rev 10077)
@@ -70,7 +70,7 @@
warnings.warn('Argument "parser_name" will be removed '
'in Docutils 2.0.\n'
' Specify parser name in the "parser" argument.',
- DeprecationWarning, stacklevel=2)
+ PendingDeprecationWarning, stacklevel=2)
if self.parser is None:
self.set_parser(parser_name)
Modified: trunk/docutils/test/test_publisher.py
===================================================================
--- trunk/docutils/test/test_publisher.py 2025-04-08 10:27:44 UTC (rev 10076)
+++ trunk/docutils/test/test_publisher.py 2025-04-09 08:55:54 UTC (rev 10077)
@@ -101,13 +101,13 @@
# synchronize parser attributes of publisher and reader:
self.assertEqual(publisher.reader.parser, publisher.parser)
# the "parser_name" argument is deprecated;
- with self.assertWarnsRegex(DeprecationWarning,
+ with self.assertWarnsRegex(PendingDeprecationWarning,
'Argument "parser_name" will be removed'):
publisher.set_reader('standalone', parser=None, parser_name='rst')
self.assertTrue(isinstance(publisher.parser, parsers.rst.Parser))
self.assertEqual(publisher.reader.parser, publisher.parser)
# "parser" takes precedence
- with self.assertWarns(DeprecationWarning):
+ with self.assertWarns(PendingDeprecationWarning):
publisher.set_reader('standalone', parser, parser_name='rst')
self.assertEqual(publisher.parser, parser)
self.assertEqual(publisher.reader.parser, publisher.parser)
Modified: trunk/docutils/test/test_readers/test__init__.py
===================================================================
--- trunk/docutils/test/test_readers/test__init__.py 2025-04-08 10:27:44 UTC (rev 10076)
+++ trunk/docutils/test/test_readers/test__init__.py 2025-04-09 08:55:54 UTC (rev 10077)
@@ -38,12 +38,12 @@
self.assertEqual(reader.parser, parser)
# # the second argument `parser_name` is deprecated
with self.assertWarnsRegex(
- DeprecationWarning,
+ PendingDeprecationWarning,
'Specify parser name in the "parser" argument.'):
reader = readers.Reader(parser_name='rst')
self.assertTrue(isinstance(reader.parser, parsers.rst.Parser))
# if both arguments are specified, `parser` has precedence:
- with self.assertWarns(DeprecationWarning):
+ with self.assertWarns(PendingDeprecationWarning):
reader = readers.Reader(parser, parser_name='null')
self.assertEqual(reader.parser, parser)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|