Skip to content

Commit 2463122

Browse files
authored
Resolve lint warnings reported by Ruff (#11719)
1 parent 64e7ba5 commit 2463122

File tree

6 files changed

+8
-6
lines changed

6 files changed

+8
-6
lines changed

sphinx/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
['git', 'rev-parse', '--short', 'HEAD'],
4545
cwd=package_dir,
4646
capture_output=True,
47+
check=False,
4748
encoding='ascii',
4849
errors='surrogateescape',
4950
).stdout:

sphinx/testing/fixtures.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,8 @@ def if_graphviz_found(app: SphinxTestApp) -> None: # NoQA: PT004
211211
graphviz_dot = getattr(app.config, 'graphviz_dot', '')
212212
try:
213213
if graphviz_dot:
214-
subprocess.run([graphviz_dot, '-V'], capture_output=True) # show version
214+
# print the graphviz_dot version, to check that the binary is available
215+
subprocess.run([graphviz_dot, '-V'], capture_output=True, check=False)
215216
return
216217
except OSError: # No such file or directory
217218
pass

sphinx/testing/path.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def utime(self, arg: Any) -> None:
150150
os.utime(self, arg)
151151

152152
def open(self, mode: str = 'r', **kwargs: Any) -> IO:
153-
return open(self, mode, **kwargs) # noqa: SIM115
153+
return open(self, mode, **kwargs) # NoQA: SIM115
154154

155155
def write_text(self, text: str, encoding: str = 'utf-8', **kwargs: Any) -> None:
156156
"""

sphinx/writers/texinfo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ def _add_detailed_menu(name: str) -> None:
430430
entries = self.node_menus[name]
431431
if not entries:
432432
return
433-
self.body.append(f'\n{self.escape(self.node_names[name], )}\n\n')
433+
self.body.append(f'\n{self.escape(self.node_names[name])}\n\n')
434434
self.add_menu_entries(entries)
435435
for subentry in entries:
436436
_add_detailed_menu(subentry)

tests/test_ext_imgconverter.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ def _if_converter_found(app):
1010
image_converter = getattr(app.config, 'image_converter', '')
1111
try:
1212
if image_converter:
13-
subprocess.run([image_converter, '-version'], capture_output=True) # show version
13+
# print the image_converter version, to check that the command is available
14+
subprocess.run([image_converter, '-version'], capture_output=True, check=False)
1415
return
1516
except OSError: # No such file or directory
1617
pass

tests/test_pycode_ast.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
("a and b and c", "a and b and c"), # BoolOp
1919
("b'bytes'", "b'bytes'"), # Bytes
2020
("object()", "object()"), # Call
21-
("1234", "1234"), # Constant
21+
("1234", "1234"), # Constant, Num
2222
("{'key1': 'value1', 'key2': 'value2'}",
2323
"{'key1': 'value1', 'key2': 'value2'}"), # Dict
2424
("a / b", "a / b"), # Div
@@ -34,7 +34,6 @@
3434
("a % b", "a % b"), # Mod
3535
("a * b", "a * b"), # Mult
3636
("sys", "sys"), # Name, NameConstant
37-
("1234", "1234"), # Num
3837
("not a", "not a"), # Not
3938
("a or b", "a or b"), # Or
4039
("a**b", "a**b"), # Pow

0 commit comments

Comments
 (0)