SF.net SVN: docutils:[9830 ] trunk/docutils
aa-turner--- via Docutils-checkins <[email protected]>
| Newsgroups | gmane.text.docutils.cvs |
|---|---|
| Message-ID | <[email protected]> |
Revision: 9830
http://sourceforge.net/p/docutils/code/9830
Author: aa-turner
Date: 2024-08-01 20:51:58 +0000 (Thu, 01 Aug 2024)
Log Message:
-----------
Enable the flake8-pie linter in Ruff
Modified Paths:
--------------
trunk/docutils/.ruff.toml
trunk/docutils/docutils/io.py
trunk/docutils/docutils/parsers/recommonmark_wrapper.py
trunk/docutils/docutils/parsers/rst/states.py
trunk/docutils/docutils/statemachine.py
trunk/docutils/docutils/utils/math/math2html.py
trunk/docutils/docutils/utils/math/tex2mathml_extern.py
Modified: trunk/docutils/.ruff.toml
===================================================================
--- trunk/docutils/.ruff.toml 2024-08-01 20:47:11 UTC (rev 9829)
+++ trunk/docutils/.ruff.toml 2024-08-01 20:51:58 UTC (rev 9830)
@@ -15,6 +15,7 @@
"INT", # flake8-gettext
"LOG", # flake8-logging
"PGH", # pygrep-hooks
+ "PIE", # flake8-pie
"W", # pycodestyle
]
ignore = [
Modified: trunk/docutils/docutils/io.py
===================================================================
--- trunk/docutils/docutils/io.py 2024-08-01 20:47:11 UTC (rev 9829)
+++ trunk/docutils/docutils/io.py 2024-08-01 20:51:58 UTC (rev 9830)
@@ -686,7 +686,6 @@
def write(self, data: str | bytes) -> None:
"""Do nothing, return None."""
- pass
class DocTreeInput(Input):
Modified: trunk/docutils/docutils/parsers/recommonmark_wrapper.py
===================================================================
--- trunk/docutils/docutils/parsers/recommonmark_wrapper.py 2024-08-01 20:47:11 UTC (rev 9829)
+++ trunk/docutils/docutils/parsers/recommonmark_wrapper.py 2024-08-01 20:51:58 UTC (rev 9830)
@@ -163,7 +163,6 @@
cf. https://github.com/readthedocs/recommonmark/issues/177
"""
- pass
# Overwrite parent method with version that
# doesn't pass deprecated `rawsource` argument to nodes.Text:
Modified: trunk/docutils/docutils/parsers/rst/states.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/states.py 2024-08-01 20:47:11 UTC (rev 9829)
+++ trunk/docutils/docutils/parsers/rst/states.py 2024-08-01 20:51:58 UTC (rev 9830)
@@ -1409,8 +1409,7 @@
if result:
next_enumerator, auto_enumerator = result
try:
- if (next_line.startswith(next_enumerator)
- or next_line.startswith(auto_enumerator)):
+ if next_line.startswith((next_enumerator, auto_enumerator)):
return 1
except TypeError:
pass
Modified: trunk/docutils/docutils/statemachine.py
===================================================================
--- trunk/docutils/docutils/statemachine.py 2024-08-01 20:47:11 UTC (rev 9829)
+++ trunk/docutils/docutils/statemachine.py 2024-08-01 20:51:58 UTC (rev 9830)
@@ -620,7 +620,6 @@
Initialize this `State` before running the state machine; called from
`self.state_machine.run()`.
"""
- pass
def unlink(self) -> None:
"""Remove circular references to objects no longer required."""
@@ -1042,12 +1041,10 @@
class SearchStateMachine(_SearchOverride, StateMachine):
"""`StateMachine` which uses `re.search()` instead of `re.match()`."""
- pass
class SearchStateMachineWS(_SearchOverride, StateMachineWS):
"""`StateMachineWS` which uses `re.search()` instead of `re.match()`."""
- pass
class ViewList:
Modified: trunk/docutils/docutils/utils/math/math2html.py
===================================================================
--- trunk/docutils/docutils/utils/math/math2html.py 2024-08-01 20:47:11 UTC (rev 9829)
+++ trunk/docutils/docutils/utils/math/math2html.py 2024-08-01 20:51:58 UTC (rev 9830)
@@ -1320,7 +1320,6 @@
def process(self) -> None:
"Process contents"
- pass
def gethtml(self):
"Get the resulting HTML"
@@ -2132,7 +2131,7 @@
bit = self.parsewithcommand(command, pos)
if bit:
return bit
- if command.startswith('\\up') or command.startswith('\\Up'):
+ if command.startswith(('\\up', '\\Up')):
upgreek = self.parseupgreek(command, pos)
if upgreek:
return upgreek
Modified: trunk/docutils/docutils/utils/math/tex2mathml_extern.py
===================================================================
--- trunk/docutils/docutils/utils/math/tex2mathml_extern.py 2024-08-01 20:47:11 UTC (rev 9829)
+++ trunk/docutils/docutils/utils/math/tex2mathml_extern.py 2024-08-01 20:51:58 UTC (rev 9830)
@@ -107,10 +107,10 @@
result1 = subprocess.run(args1, input=math_code,
capture_output=True, text=True)
if result1.stderr:
- result1.stderr = '\n'.join(line for line in result1.stderr.splitlines()
- if line.startswith('Error:')
- or line.startswith('Warning:')
- or line.startswith('Fatal:'))
+ result1.stderr = '\n'.join(
+ line for line in result1.stderr.splitlines()
+ if line.startswith(('Error:', 'Warning:', 'Fatal:'))
+ )
_check_result(result1)
args2 = ['latexmlpost',
@@ -142,10 +142,10 @@
_msg_source = result2.stdout # latexmlpost reports errors in output
else:
_msg_source = result2.stderr # just in case
- result2.stderr = '\n'.join(line for line in _msg_source.splitlines()
- if line.startswith('Error:')
- or line.startswith('Warning:')
- or line.startswith('Fatal:'))
+ result2.stderr = '\n'.join(
+ line for line in _msg_source.splitlines()
+ if line.startswith(('Error:', 'Warning:', 'Fatal:'))
+ )
_check_result(result2)
return result2.stdout
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.