diff --git a/.ruff.toml b/.ruff.toml index d0f9ec81f..cfb0294c9 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -48,7 +48,6 @@ ignore = [ "PLR0916", # Too many Boolean expressions ({expressions} > {max_expressions}) "PLR0917", # Too many positional arguments ({c_pos}/{max_pos}) "PLR1702", # Too many nested blocks ({nested_blocks} > {max_nested_blocks}) - "PLR1704", # Redefining argument with the local name `{name}` "PLR1714", # Consider merging multiple comparisons: `{expression}`. Use a `set` if the elements are hashable. "PLR2004", # Magic value used in comparison, consider replacing `{value}` with a constant variable "PLR5501", # Use `elif` instead of `else` then `if`, to reduce indentation diff --git a/sphinx/ext/inheritance_diagram.py b/sphinx/ext/inheritance_diagram.py index 21dda6fe6..319b60bce 100644 --- a/sphinx/ext/inheritance_diagram.py +++ b/sphinx/ext/inheritance_diagram.py @@ -312,19 +312,19 @@ class InheritanceGraph: self._format_graph_attrs(g_attrs), ] - for name, fullname, bases, tooltip in sorted(self.class_info): + for cls_name, fullname, bases, tooltip in sorted(self.class_info): # Write the node this_node_attrs = n_attrs.copy() if fullname in urls: - this_node_attrs["URL"] = '"%s"' % urls[fullname] + this_node_attrs["URL"] = f'"{urls[fullname]}"' this_node_attrs["target"] = '"_top"' if tooltip: this_node_attrs["tooltip"] = tooltip - res.append(' "%s" [%s];\n' % (name, self._format_node_attrs(this_node_attrs))) + res.append(f' "{cls_name}" [{self._format_node_attrs(this_node_attrs)}];\n') # Write the edges res.extend( - ' "%s" -> "%s" [%s];\n' % (base_name, name, self._format_node_attrs(e_attrs)) + f' "{base_name}" -> "{cls_name}" [{self._format_node_attrs(e_attrs)}];\n' for base_name in bases ) res.append("}\n")