SF.net SVN: docutils:[10363 ] trunk/docutils

milde--- via Docutils-checkins <[email protected]> Thu, 18 Jun 2026 07:56:50 +0000
Newsgroups gmane.text.docutils.cvs
Message-ID <[email protected]>
Revision: 10363
          http://sourceforge.net/p/docutils/code/10363
Author:   milde
Date:     2026-06-18 07:56:49 +0000 (Thu, 18 Jun 2026)
Log Message:
-----------
Small fixes.

Remove redundant lines from test scripts.

"Unblack" code formatting.

Use `True` instead of 1 for boolean true.

Fix typos.

Modified Paths:
--------------
    trunk/docutils/RELEASE-NOTES.rst
    trunk/docutils/docutils/io.py
    trunk/docutils/docutils/parsers/rst/states.py
    trunk/docutils/test/test_functional.py
    trunk/docutils/test/test_parsers/test_rst/test_directives/test_include.py
    trunk/docutils/test/test_utils/test_math/test_tex2mathml_extern.py

Modified: trunk/docutils/RELEASE-NOTES.rst
===================================================================
--- trunk/docutils/RELEASE-NOTES.rst	2026-06-17 10:17:10 UTC (rev 10362)
+++ trunk/docutils/RELEASE-NOTES.rst	2026-06-18 07:56:49 UTC (rev 10363)
@@ -319,7 +319,7 @@
 
 HTML5 writer:
   - If a section has several IDs, use the last one (from the first
-    preceding `explicit target`__) as self-link_.
+    preceding `explicit target`__) as section_self_link_.
 
     __ docs/ref/rst/restructuredtext.html#explicit-hyperlink-targets
 
@@ -370,7 +370,7 @@
 Release 0.22.3 (2025-11-06)
 ===========================
 
-Rst parser:
+rST parser:
   - Ignore combining characters when parsing the grid table structure.
 
   - Allow for auxiliary elements like `sphinx.addnodes.only`
@@ -386,7 +386,7 @@
 Release 0.22.1 (2025-09-17)
 ===========================
 
-Rst parser:
+rST parser:
   - Relax "section title" system messages from SEVERE to ERROR.
   - New attribute `parsers.rst.states.NestedStateMachine.parent_state_machine`.
 
@@ -1663,7 +1663,7 @@
 .. _parser: docs/user/config.html#parser
 .. _reference_label: docs/user/config.html#reference-label
 .. _root_prefix: docs/user/config.html#root-prefix
-.. _self-link: docs/user/config.html#section-self-link
+.. _section_self_link: docs/user/config.html#section-self-link
 .. _SmartQuotes: docs/user/config.html#smart-quotes
 .. _sources: docs/user/config.html#sources
 .. _use_latex_citations: docs/user/config.html#use-latex-citations

Modified: trunk/docutils/docutils/io.py
===================================================================
--- trunk/docutils/docutils/io.py	2026-06-17 10:17:10 UTC (rev 10362)
+++ trunk/docutils/docutils/io.py	2026-06-18 07:56:49 UTC (rev 10363)
@@ -90,13 +90,12 @@
 
     default_source_path: ClassVar[str | None] = None
 
-    def __init__(
-        self,
-        source: str | TextIO | nodes.document | None = None,
-        source_path: StrPath | None = None,
-        encoding: str | None = 'utf-8',
-        error_handler: str | None = 'strict',
-    ) -> None:
+    def __init__(self,
+                 source: str | TextIO | nodes.document | None = None,
+                 source_path: StrPath | None = None,
+                 encoding: str | None = 'utf-8',
+                 error_handler: str | None = 'strict',
+                 ) -> None:
         self.encoding = encoding
         """Text encoding for the input source."""
 
@@ -154,13 +153,12 @@
 
     default_destination_path: ClassVar[str | None] = None
 
-    def __init__(
-        self,
-        destination: TextIO | str | bytes | None = None,
-        destination_path: StrPath | None = None,
-        encoding: str | None = None,
-        error_handler: str | None = 'strict',
-    ) -> None:
+    def __init__(self,
+                 destination: TextIO | str | bytes | None = None,
+                 destination_path: StrPath | None = None,
+                 encoding: str | None = None,
+                 error_handler: str | None = 'strict',
+                 ) -> None:
         self.encoding: str | None = encoding
         """Text encoding for the output destination."""
 
@@ -211,13 +209,12 @@
     failsafe de- and encoding of `str`, `bytes`, and `Exception` instances.
     """
 
-    def __init__(
-        self,
-        destination: TextIO | BinaryIO | str | Literal[False] | None = None,
-        encoding: str | None = None,
-        encoding_errors: str = 'backslashreplace',
-        decoding_errors: str = 'replace',
-    ) -> None:
+    def __init__(self,
+                 destination: TextIO|BinaryIO|str|Literal[False]|None = None,
+                 encoding: str | None = None,
+                 encoding_errors: str = 'backslashreplace',
+                 decoding_errors: str = 'replace',
+                 ) -> None:
         """
         :Parameters:
             - `destination`: a file-like object,
@@ -238,12 +235,10 @@
         self.destination: TextIO | BinaryIO | Literal[False] = destination
         """Where warning output is sent."""
 
-        self.encoding: str = (
-            encoding
-            or getattr(destination, 'encoding', None)
-            or _locale_encoding
-            or 'ascii'
-        )
+        self.encoding: str = (encoding
+                              or getattr(destination, 'encoding', None)
+                              or _locale_encoding
+                              or 'ascii')
         """The output character encoding."""
 
         self.encoding_errors: str = encoding_errors
@@ -311,15 +306,14 @@
     """
     Input for single, simple file-like objects.
     """
-    def __init__(
-        self,
-        source: TextIO | None = None,
-        source_path: StrPath | None = None,
-        encoding: str | Literal['unicode'] | None = 'utf-8',
-        error_handler: str | None = 'strict',
-        autoclose: bool = True,
-        mode: Literal['r', 'rb', 'br'] = 'r'
-    ) -> None:
+    def __init__(self,
+                 source: TextIO | None = None,
+                 source_path: StrPath | None = None,
+                 encoding: str | Literal['unicode'] | None = 'utf-8',
+                 error_handler: str | None = 'strict',
+                 autoclose: bool = True,
+                 mode: Literal['r', 'rb', 'br'] = 'r'
+                 ) -> None:
         """
         :Parameters:
             - `source`: either a file-like object (with `read()` and `close()`
@@ -543,7 +537,7 @@
 
     default_destination_path: Final = '<string>'
 
-    def write(self, data: str | bytes) -> str | bytes:
+    def write(self, data: str|bytes) -> str | bytes:
         """Store `data` in `self.destination`, and return it.
 
         If `self.encoding` is set to the pseudo encoding name "unicode",

Modified: trunk/docutils/docutils/parsers/rst/states.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/states.py	2026-06-17 10:17:10 UTC (rev 10362)
+++ trunk/docutils/docutils/parsers/rst/states.py	2026-06-18 07:56:49 UTC (rev 10363)
@@ -937,7 +937,7 @@
                 if alias.endswith(r'\_'):
                     alias = alias[:-2] + '_'
                 target = nodes.target(match.group(1), refuri=alias)
-                target.referenced = 1
+                target.referenced = True
             if not aliastext:
                 raise ApplicationError('problem with embedded link: %r'
                                        % aliastext)

Modified: trunk/docutils/test/test_functional.py
===================================================================
--- trunk/docutils/test/test_functional.py	2026-06-17 10:17:10 UTC (rev 10362)
+++ trunk/docutils/test/test_functional.py	2026-06-18 07:56:49 UTC (rev 10363)
@@ -62,7 +62,6 @@
     '_disable_config': True,
     'halt_level': 5,
     'warning_stream': '',
-    'input_encoding': 'utf-8',  # skip auto-detection
     'embed_stylesheet': False,
     'syntax_highlight': 'none'  # avoid "Pygments not found" warning
     }

Modified: trunk/docutils/test/test_parsers/test_rst/test_directives/test_include.py
===================================================================
--- trunk/docutils/test/test_parsers/test_rst/test_directives/test_include.py	2026-06-17 10:17:10 UTC (rev 10362)
+++ trunk/docutils/test/test_parsers/test_rst/test_directives/test_include.py	2026-06-18 07:56:49 UTC (rev 10363)
@@ -108,7 +108,6 @@
 include_md = mydir('include.md')
 include_xml = mydir('includes/include.xml')
 include = TEST_ROOT/'data/include.rst'
-latin2 = TEST_ROOT/'data/latin2.rst'
 utf_16_file = TEST_ROOT/'data/utf-16-le-sig.rst'
 utf_16_error_str = ("UnicodeDecodeError: 'ascii' codec can't decode byte 0xff "
                     "in position 0: ordinal not in range(128)")

Modified: trunk/docutils/test/test_utils/test_math/test_tex2mathml_extern.py
===================================================================
--- trunk/docutils/test/test_utils/test_math/test_tex2mathml_extern.py	2026-06-17 10:17:10 UTC (rev 10362)
+++ trunk/docutils/test/test_utils/test_math/test_tex2mathml_extern.py	2026-06-18 07:56:49 UTC (rev 10363)
@@ -90,7 +90,6 @@
     which is open to change without warning.
     """
     settings = {'_disable_config': True,
-                'input_encoding': 'utf-8',  # skip auto-detection
                 'embed_stylesheet': False,
                 'warning_stream': '',
                 'report_level': 2,  # warning

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.