diff --git a/sphinx/builders/html/__init__.py b/sphinx/builders/html/__init__.py
index 34c162b88..77ba37d6e 100644
--- a/sphinx/builders/html/__init__.py
+++ b/sphinx/builders/html/__init__.py
@@ -888,7 +888,7 @@ class StandaloneHTMLBuilder(Builder):
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
diff --git a/sphinx/domains/c.py b/sphinx/domains/c.py
index 4977c67a0..7325cc008 100644
--- a/sphinx/domains/c.py
+++ b/sphinx/domains/c.py
@@ -2240,8 +2240,8 @@ class DefinitionParser(BaseParser):
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])
diff --git a/sphinx/domains/cpp.py b/sphinx/domains/cpp.py
index 80c3eddc1..1e0472019 100644
--- a/sphinx/domains/cpp.py
+++ b/sphinx/domains/cpp.py
@@ -5301,8 +5301,8 @@ class DefinitionParser(BaseParser):
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])
diff --git a/sphinx/ext/imgmath.py b/sphinx/ext/imgmath.py
index a402ce518..b397f0ac1 100644
--- a/sphinx/ext/imgmath.py
+++ b/sphinx/ext/imgmath.py
@@ -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)
@@ -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')
diff --git a/sphinx/pycode/ast.py b/sphinx/pycode/ast.py
index e5914ccb5..afb786386 100644
--- a/sphinx/pycode/ast.py
+++ b/sphinx/pycode/ast.py
@@ -115,7 +115,7 @@ class _UnparseVisitor(ast.NodeVisitor):
# 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)
diff --git a/sphinx/util/inspect.py b/sphinx/util/inspect.py
index 7d7fbb8c7..218f4abca 100644
--- a/sphinx/util/inspect.py
+++ b/sphinx/util/inspect.py
@@ -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__')
)
diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py
index 89b349aee..43a090592 100644
--- a/sphinx/writers/latex.py
+++ b/sphinx/writers/latex.py
@@ -2122,13 +2122,13 @@ class LaTeXTranslator(SphinxTranslator):
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: