SF.net SVN: docutils:[9862] trunk

milde--- via Docutils-checkins <[email protected]>
Newsgroups gmane.text.docutils.cvs
Message-ID <[email protected]>
Revision: 9862
          http://sourceforge.net/p/docutils/code/9862
Author:   milde
Date:     2024-08-07 14:05:34 +0000 (Wed, 07 Aug 2024)
Log Message:
-----------
Small fixes for developer tool to generate punctuation character fiel.

Put flake8 exception directly in offending file.

... after learning how to place a "noqa" comment for a long line
in the middle of a multi-line string literal.

Normalize formatting, use comprehension instead of repeating code.

Modified Paths:
--------------
    trunk/.flake8
    trunk/docutils/.flake8
    trunk/docutils/tools/dev/generate_punctuation_chars.py

Modified: trunk/.flake8
===================================================================
--- trunk/.flake8	2024-08-07 14:05:25 UTC (rev 9861)
+++ trunk/.flake8	2024-08-07 14:05:34 UTC (rev 9862)
@@ -74,9 +74,6 @@
   # test output contains trailing whitespace, long lines, operator at end
   docutils/test/test_writers/test_manpage.py:E128,W291,E501,W504
 
-  # ignore long line in string templates
-  docutils/tools/dev/generate_punctuation_chars.py:E501
-
 exclude =
   .venv
   .tox

Modified: trunk/docutils/.flake8
===================================================================
--- trunk/docutils/.flake8	2024-08-07 14:05:25 UTC (rev 9861)
+++ trunk/docutils/.flake8	2024-08-07 14:05:34 UTC (rev 9862)
@@ -74,9 +74,6 @@
   # test output contains trailing whitespace, long lines, operator at end
   test/test_writers/test_manpage.py:E128,W291,E501,W504
 
-  # ignore long line in string templates
-  tools/dev/generate_punctuation_chars.py:E501
-
 exclude =
   .venv
   .tox

Modified: trunk/docutils/tools/dev/generate_punctuation_chars.py
===================================================================
--- trunk/docutils/tools/dev/generate_punctuation_chars.py	2024-08-07 14:05:25 UTC (rev 9861)
+++ trunk/docutils/tools/dev/generate_punctuation_chars.py	2024-08-07 14:05:34 UTC (rev 9862)
@@ -85,7 +85,7 @@
    .. _inline markup recognition rules:
       https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html
       #inline-markup-recognition-rules
-"""
+"""  # noqa: E501
 
 %(openers)s
 %(closers)s
@@ -153,11 +153,10 @@
 #
 # ::
 
-def unicode_charlists(
-    categories: Iterable[str],
-    cp_min: int = 0,
-    cp_max: int = sys.maxunicode,
-) -> dict[str, list[str]]:
+def unicode_charlists(categories: Iterable[str],
+                      cp_min: int = 0,
+                      cp_max: int = sys.maxunicode,
+                      ) -> dict[str, list[str]]:
     """Return dictionary of Unicode character lists.
 
     For each of the `catagories`, an item contains a list with all Unicode
@@ -257,12 +256,8 @@
     # non-matching, after markup
     closing_delimiters = [r'\\.,;!?']
 
-    return (
-        ''.join(openers),
-        ''.join(closers),
-        ''.join(delimiters),
-        ''.join(closing_delimiters),
-    )
+    return tuple(''.join(chs)
+                 for chs in (openers, closers, delimiters, closing_delimiters))
 
 
 def mark_intervals(s: str) -> str:

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.