SF.net SVN: docutils:[9784 ] trunk

aa-turner--- via Docutils-checkins <[email protected]>
Newsgroups gmane.text.docutils.cvs
Message-ID <[email protected]>
Revision: 9784
          http://sourceforge.net/p/docutils/code/9784
Author:   aa-turner
Date:     2024-07-30 23:52:51 +0000 (Tue, 30 Jul 2024)
Log Message:
-----------
Fix flake8 failures

Also update the configuration file to enable using
flake8 version 6 and later, which prohibits inline comments.

Modified Paths:
--------------
    trunk/.flake8
    trunk/docutils/.flake8
    trunk/docutils/docutils/writers/latex2e/__init__.py
    trunk/docutils/docutils/writers/manpage.py

Modified: trunk/.flake8
===================================================================
--- trunk/.flake8	2024-07-29 12:37:21 UTC (rev 9783)
+++ trunk/.flake8	2024-07-30 23:52:51 UTC (rev 9784)
@@ -1,27 +1,34 @@
 [flake8]
 # Problems that are either not fixed yet or allowed by PEP8:
 ignore =
-  E123, # closing bracket does not match indentation of opening bracket's line
+  E123,
+  # E123: "closing bracket does not match indentation of opening bracket's line"
   # PEP8 "may either line up under the first […] character of the last line …"
 
-  E125, # continuation line with same indent as next logical line
+  E125,
+  # E125: "continuation line with same indent as next logical line"
   # allowed by PEP8 cf. https://github.com/PyCQA/pycodestyle/issues/126
 
-  E126, # continuation line over-indented for hanging indent
+  E126,
+  # E126: "continuation line over-indented for hanging indent"
   # some cases are mandated by PEP8 to distinguish hanging indent from nesting.
   # Other cases improve readability.
 
-  E129, # visually indented line with same indent as next logical line
+  E129,
+  # E129: "visually indented line with same indent as next logical line"
   # allowed by PEP8
 
-  E226, # missing whitespace around arithmetic operator
-  E228, # missing whitespace around modulo operator
+  E226,
+  E228,
+  # E226: "missing whitespace around arithmetic operator"
+  # E228: "missing whitespace around modulo operator"
   # not generally frowned on by PEP8:
   # "If operators with different priorities are used, consider adding
   # whitespace around the operators with the lowest priority(ies).
   # Use your own judgment; …"
 
-  W503, # line break before binary operator
+  W503,
+  # W503: "line break before binary operator"
   # this is the recommended style (changed on April 16th, 2016)
 
 # Allow exceptions for specific files (requires flake8 >= 3.7.0)

Modified: trunk/docutils/.flake8
===================================================================
--- trunk/docutils/.flake8	2024-07-29 12:37:21 UTC (rev 9783)
+++ trunk/docutils/.flake8	2024-07-30 23:52:51 UTC (rev 9784)
@@ -1,27 +1,34 @@
 [flake8]
 # Problems that are either not fixed yet or allowed by PEP8:
 ignore =
-  E123, # closing bracket does not match indentation of opening bracket's line
+  E123,
+  # E123: "closing bracket does not match indentation of opening bracket's line"
   # PEP8 "may either line up under the first […] character of the last line …"
 
-  E125, # continuation line with same indent as next logical line
+  E125,
+  # E125: "continuation line with same indent as next logical line"
   # allowed by PEP8 cf. https://github.com/PyCQA/pycodestyle/issues/126
 
-  E126, # continuation line over-indented for hanging indent
+  E126,
+  # E126: "continuation line over-indented for hanging indent"
   # some cases are mandated by PEP8 to distinguish hanging indent from nesting.
   # Other cases improve readability.
 
-  E129, # visually indented line with same indent as next logical line
+  E129,
+  # E129: "visually indented line with same indent as next logical line"
   # allowed by PEP8
 
-  E226, # missing whitespace around arithmetic operator
-  E228, # missing whitespace around modulo operator
+  E226,
+  E228,
+  # E226: "missing whitespace around arithmetic operator"
+  # E228: "missing whitespace around modulo operator"
   # not generally frowned on by PEP8:
   # "If operators with different priorities are used, consider adding
   # whitespace around the operators with the lowest priority(ies).
   # Use your own judgment; …"
 
-  W503, # line break before binary operator
+  W503,
+  # W503: "line break before binary operator"
   # this is the recommended style (changed on April 16th, 2016)
 
 # Allow exceptions for specific files (requires flake8 >= 3.7.0)

Modified: trunk/docutils/docutils/writers/latex2e/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/latex2e/__init__.py	2024-07-29 12:37:21 UTC (rev 9783)
+++ trunk/docutils/docutils/writers/latex2e/__init__.py	2024-07-30 23:52:51 UTC (rev 9784)
@@ -1815,7 +1815,7 @@
                 self.out.append(r'\cite{')
                 self.inside_citation_reference_label = True
             else:
-                assert self.out[-1] in (' ', '\n'),\
+                assert self.out[-1] in (' ', '\n'), \
                         'unexpected non-whitespace while in reference label'
                 del self.out[-1]
         else:

Modified: trunk/docutils/docutils/writers/manpage.py
===================================================================
--- trunk/docutils/docutils/writers/manpage.py	2024-07-29 12:37:21 UTC (rev 9783)
+++ trunk/docutils/docutils/writers/manpage.py	2024-07-30 23:52:51 UTC (rev 9784)
@@ -102,9 +102,10 @@
 # TODO before each dot or a series of
 NONBREAKING_INSERT_RE = re.compile(r'([/@?&#]+)(?=.)')
 
+
 def insert_URI_breakpoints(s):
     # TODO only for long URIs ?
-    return NONBREAKING_INSERT_RE.sub( r'\1'+NONPRINTING_BREAKPOINT, s)
+    return NONBREAKING_INSERT_RE.sub(r'\1' + NONPRINTING_BREAKPOINT, s)
 
 
 class Writer(writers.Writer):
@@ -132,7 +133,7 @@
 
 class Table:
     """
-    man package table handling. 
+    man package table handling.
     """
     def __init__(self):
         self._rows = []
@@ -188,13 +189,16 @@
 
 class Translator(nodes.NodeVisitor):
     """
-    Generate unixlike manual pages using the man macro package from a Docutils document tree.
+    Generate unix-like manual pages using the man macro package
+    from a Docutils document tree.
     """
 
     words_and_spaces = re.compile(r'\S+| +|\n')
     possibly_a_roff_command = re.compile(r'\.\w')
-    document_start = ( 'Man page generated from reStructuredText by manpage writer\n'
-                      f'from docutils {docutils.__version__}.' )
+    document_start = (
+        'Man page generated from reStructuredText by manpage writer\n'
+        f'from docutils {docutils.__version__}.'
+    )
 
     def __init__(self, document):
         nodes.NodeVisitor.__init__(self, document)
@@ -215,7 +219,7 @@
         # writing the header .TH and .SH Name is postboned after
         # docinfo.
         self._docinfo = {
-                "title": "", 
+                "title": "",
                 "subtitle": "",
                 "manual_section": "", "manual_group": "",
                 "author": [],
@@ -247,7 +251,7 @@
         #
         # \c   End a text line without inserting space or attempting a
         #      break. ...
-        #      The next line is interpreted as usual and can include a 
+        #      The next line is interpreted as usual and can include a
         #      macro call (contrast with \newline). ...
         #      useful when three font styles are needed in a single
         #      word, as in a command synopsis.
@@ -257,7 +261,7 @@
 
         # Requests start wit a dot ``.`` or the no-break control character,
         # a neutral apostrophe ``'`` suppresses the break implied by some
-        # requests. 
+        # requests.
 
         # central definition of simple processing rules
         # what to output on : visit, depart
@@ -1046,7 +1050,7 @@
             # if content has the "email" do not output "mailto:email"
             if node['refuri'].endswith(node.astext()):
                 self.body.append(" <")
-        #TODO elif 'refid' in node:
+        # TODO elif 'refid' in node:
 
     def depart_reference(self, node):
         if 'refuri' in node:
@@ -1055,7 +1059,7 @@
                 self.body.append("> ")
             else:
                 self.body.append(" <%s>\n" % node['refuri'])
-        #TODO elif 'refid' in node:
+        # TODO elif 'refid' in node:
 
     def visit_revision(self, node):
         self.visit_docinfo_item(node, 'revision')

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



_______________________________________________
Docutils-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/docutils-checkins
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.