Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sphinx/builders/html/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ def post_process_images(self, doctree: Node) -> None:

if self.config.html_scaled_image_link and self.html_scaled_image_link:
for node in doctree.findall(nodes.image):
if not any((key in node) for key in ['scale', 'width', 'height']):
if not any((key in node) for key in ('scale', 'width', 'height')):
# resizing options are not given. scaled image link is available
# only for resized images.
continue
Expand Down
4 changes: 2 additions & 2 deletions sphinx/domains/c.py
Original file line number Diff line number Diff line change
Expand Up @@ -2240,8 +2240,8 @@ def _parse_literal(self) -> ASTLiteral | None:
if self.match(float_literal_re):
self.match(float_literal_suffix_re)
return ASTNumberLiteral(self.definition[pos:self.pos])
for regex in [binary_literal_re, hex_literal_re,
integer_literal_re, octal_literal_re]:
for regex in (binary_literal_re, hex_literal_re,
integer_literal_re, octal_literal_re):
if self.match(regex):
self.match(integers_literal_suffix_re)
return ASTNumberLiteral(self.definition[pos:self.pos])
Expand Down
4 changes: 2 additions & 2 deletions sphinx/domains/cpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -5301,8 +5301,8 @@ def _udl(literal: ASTLiteral) -> ASTLiteral:
return floatLit
else:
return _udl(floatLit)
for regex in [binary_literal_re, hex_literal_re,
integer_literal_re, octal_literal_re]:
for regex in (binary_literal_re, hex_literal_re,
integer_literal_re, octal_literal_re):
if self.match(regex):
hasSuffix = self.match(integers_literal_suffix_re)
intLit = ASTNumberLiteral(self.definition[pos:self.pos])
Expand Down
4 changes: 2 additions & 2 deletions sphinx/ext/imgmath.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def compile_math(latex: str, builder: Builder) -> str:
# --output-directory option, so we have to manually chdir to the
# temp dir to run it.
command = [builder.config.imgmath_latex]
if imgmath_latex_name not in ['tectonic']:
if imgmath_latex_name != 'tectonic':
command.append('--interaction=nonstopmode')
# add custom args from the config file
command.extend(builder.config.imgmath_latex_args)
Expand All @@ -149,7 +149,7 @@ def compile_math(latex: str, builder: Builder) -> str:
try:
subprocess.run(command, capture_output=True, cwd=tempdir, check=True,
encoding='ascii')
if imgmath_latex_name in ['xelatex', 'tectonic']:
if imgmath_latex_name in {'xelatex', 'tectonic'}:
return path.join(tempdir, 'math.xdv')
else:
return path.join(tempdir, 'math.dvi')
Expand Down
2 changes: 1 addition & 1 deletion sphinx/pycode/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def visit_BinOp(self, node: ast.BinOp) -> str:
# Special case ``**`` to not have surrounding spaces.
if isinstance(node.op, ast.Pow):
return "".join(map(self.visit, (node.left, node.op, node.right)))
return " ".join(self.visit(e) for e in [node.left, node.op, node.right])
return " ".join(map(self.visit, (node.left, node.op, node.right)))

def visit_BoolOp(self, node: ast.BoolOp) -> str:
op = " %s " % self.visit(node.op)
Expand Down
2 changes: 1 addition & 1 deletion sphinx/util/inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def isdescriptor(x: Any) -> bool:
"""Check if the object is some kind of descriptor."""
return any(
callable(safe_getattr(x, item, None))
for item in ['__get__', '__set__', '__delete__']
for item in ('__get__', '__set__', '__delete__')
)


Expand Down
6 changes: 3 additions & 3 deletions sphinx/writers/latex.py
Original file line number Diff line number Diff line change
Expand Up @@ -2122,13 +2122,13 @@ def depart_subscript(self, node: Element) -> None:

def visit_inline(self, node: Element) -> None:
classes = node.get('classes', [])
if classes in [['menuselection']]:
if classes == ['menuselection']:
self.body.append(r'\sphinxmenuselection{')
self.context.append('}')
elif classes in [['guilabel']]:
elif classes == ['guilabel']:
self.body.append(r'\sphinxguilabel{')
self.context.append('}')
elif classes in [['accelerator']]:
elif classes == ['accelerator']:
self.body.append(r'\sphinxaccelerator{')
self.context.append('}')
elif classes and not self.in_title:
Expand Down