Resolve lint warnings reported by Ruff (#11719)

This commit is contained in:
James Addison 2023-12-28 06:51:32 +00:00 committed by GitHub
parent 64e7ba5e3f
commit 246312287e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 8 additions and 6 deletions

View File

@ -44,6 +44,7 @@ if _in_development:
['git', 'rev-parse', '--short', 'HEAD'],
cwd=package_dir,
capture_output=True,
check=False,
encoding='ascii',
errors='surrogateescape',
).stdout:

View File

@ -211,7 +211,8 @@ def if_graphviz_found(app: SphinxTestApp) -> None: # NoQA: PT004
graphviz_dot = getattr(app.config, 'graphviz_dot', '')
try:
if graphviz_dot:
subprocess.run([graphviz_dot, '-V'], capture_output=True) # show version
# print the graphviz_dot version, to check that the binary is available
subprocess.run([graphviz_dot, '-V'], capture_output=True, check=False)
return
except OSError: # No such file or directory
pass

View File

@ -150,7 +150,7 @@ class path(str):
os.utime(self, arg)
def open(self, mode: str = 'r', **kwargs: Any) -> IO:
return open(self, mode, **kwargs) # noqa: SIM115
return open(self, mode, **kwargs) # NoQA: SIM115
def write_text(self, text: str, encoding: str = 'utf-8', **kwargs: Any) -> None:
"""

View File

@ -430,7 +430,7 @@ class TexinfoTranslator(SphinxTranslator):
entries = self.node_menus[name]
if not entries:
return
self.body.append(f'\n{self.escape(self.node_names[name], )}\n\n')
self.body.append(f'\n{self.escape(self.node_names[name])}\n\n')
self.add_menu_entries(entries)
for subentry in entries:
_add_detailed_menu(subentry)

View File

@ -10,7 +10,8 @@ def _if_converter_found(app):
image_converter = getattr(app.config, 'image_converter', '')
try:
if image_converter:
subprocess.run([image_converter, '-version'], capture_output=True) # show version
# print the image_converter version, to check that the command is available
subprocess.run([image_converter, '-version'], capture_output=True, check=False)
return
except OSError: # No such file or directory
pass

View File

@ -18,7 +18,7 @@ from sphinx.pycode.ast import unparse as ast_unparse
("a and b and c", "a and b and c"), # BoolOp
("b'bytes'", "b'bytes'"), # Bytes
("object()", "object()"), # Call
("1234", "1234"), # Constant
("1234", "1234"), # Constant, Num
("{'key1': 'value1', 'key2': 'value2'}",
"{'key1': 'value1', 'key2': 'value2'}"), # Dict
("a / b", "a / b"), # Div
@ -34,7 +34,6 @@ from sphinx.pycode.ast import unparse as ast_unparse
("a % b", "a % b"), # Mod
("a * b", "a * b"), # Mult
("sys", "sys"), # Name, NameConstant
("1234", "1234"), # Num
("not a", "not a"), # Not
("a or b", "a or b"), # Or
("a**b", "a**b"), # Pow