diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-12-02 14:20:31 +0100 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-12-03 08:08:00 +0100 |
| commit | 79ec52558acc48b0c368738bf1fcc5195921cafb (patch) | |
| tree | 6808fc9edf073b04bff3218925aa6e877320952b /sources/pyside6/doc/inheritance_diagram.py | |
| parent | c834958a9dcacdde3e45adf3a72b3c26ecef9b14 (diff) | |
inheritance_diagram.py: Complete migration to f-strings
Amends d9f344fcef6bec04a787f9ea9f4ea94f15eaa26c.
Task-number: PYSIDE-1725
Pick-to: 6.2
Change-Id: If4758a422d211a90ebf0a300502a730b61030ef7
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/pyside6/doc/inheritance_diagram.py')
| -rw-r--r-- | sources/pyside6/doc/inheritance_diagram.py | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/sources/pyside6/doc/inheritance_diagram.py b/sources/pyside6/doc/inheritance_diagram.py index 5889abb6f..f7541086c 100644 --- a/sources/pyside6/doc/inheritance_diagram.py +++ b/sources/pyside6/doc/inheritance_diagram.py @@ -207,7 +207,7 @@ class InheritanceGraph(object): } def _format_node_attrs(self, attrs): - return ','.join(['%s=%s' % x for x in attrs.items()]) + return ','.join([f'{x[0]}={x[1]}' for x in attrs.items()]) def _format_graph_attrs(self, attrs): return ''.join([f"{x[0]}={x[1]};\n" for x in attrs.items()]) @@ -237,7 +237,7 @@ class InheritanceGraph(object): e_attrs.update(env.config.inheritance_edge_attrs) res = [] - res.append('digraph %s {\n' % name) + res.append(f'digraph {name} {{\n') res.append(self._format_graph_attrs(g_attrs)) for name, fullname, bases in self.class_info: @@ -245,15 +245,14 @@ class InheritanceGraph(object): this_node_attrs = n_attrs.copy() url = urls.get(fullname) if url is not None: - this_node_attrs['URL'] = '"%s"' % url - res.append(' "%s" [%s];\n' % - (name, self._format_node_attrs(this_node_attrs))) + this_node_attrs['URL'] = f'"{url}"' + attribute = self._format_node_attrs(this_node_attrs) + res.append(f' "{name}" [{attribute}];\n') # Write the edges for base_name in bases: - res.append(' "%s" -> "%s" [%s];\n' % - (base_name, name, - self._format_node_attrs(e_attrs))) + attribute = self._format_node_attrs(e_attrs) + res.append(f' "{base_name}" -> "{name}" [{attribute}];\n') res.append('}\n') return ''.join(res) @@ -301,8 +300,8 @@ class InheritanceDiagram(Directive): # references to real URLs later. These nodes will eventually be # removed from the doctree after we're done with them. for name in graph.get_all_class_names(): - refnodes, x = class_role( - 'class', ':class:`%s`' % name, name, 0, self.state) + refnodes, x = class_role('class', f':class:`{name}`', name, + 0, self.state) node.extend(refnodes) # Store the graph object so we can use it to generate the # dot file later @@ -323,7 +322,7 @@ def html_visit_inheritance_diagram(self, node): graph = node['graph'] graph_hash = get_graph_hash(node) - name = 'inheritance%s' % graph_hash + name = f'inheritance{graph_hash}' # Create a mapping from fully-qualified class names to URLs. urls = {} @@ -346,7 +345,7 @@ def latex_visit_inheritance_diagram(self, node): graph = node['graph'] graph_hash = get_graph_hash(node) - name = 'inheritance%s' % graph_hash + name = f'inheritance{graph_hash}' dotcode = graph.generate_dot(name, env=self.builder.env, graph_attrs={'size': '"6.0,6.0"'}) |
