forked from Qiskit/rustworkx
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit fixes a regression introduced in Qiskit#1203. That PR was attempting to fix missing character escaping in some string fields but it was doing so too eagerly. This would result in invalid dot files being produced for users upgrading from rustworkx < 0.15.0 that were wrapping strings in quotes as needed previously. For example if you were setting `'color="#aaaaaa"'` previously before this would become `color="\"#aaaaaa\""` after Qiskit#1203. In order to quickly release a 0.15.1 this commit reverts the dot generation component of Qiskit#1203 but updates the code to wrap tooltip in addition to label which was what the original bug reported. In 0.16.0 we should investigate adding a flag to control the escaping behavior of the function to either decide to wrap values in quotes or not.
- Loading branch information
Showing
5 changed files
with
90 additions
and
20 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
releasenotes/notes/fix-graphviz-escaping-39a2d1cebb586eca.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
fixes: | ||
- | | ||
Fixed an issue in the :func:`~.graphviz_draw`, :meth:`.PyGraph.to_dot`, and | ||
:meth:`.PyDiGraph.to_dot` which was incorrectly escaping strings when | ||
upgrading to 0.15.0. In earlier versions of rustworkx if you manually | ||
placed quotes in a string for an attr callback get that to pass through to | ||
the output dot file this was incorrectly being converted in rustworkx 0.15.0 | ||
to duplicate the quotes and escape them. For example, if you defined a | ||
callback like:: | ||
def color_node(_node): | ||
return { | ||
"color": '"#422952"' | ||
} | ||
to set the color attribute in the output dot file with the string | ||
`"#422952"` (with the quotes) this was incorrectly being converted to | ||
`\"#422952\"`. This no longer occurs, in rustworkx 0.16.0 there will likely | ||
be additional options exposed in :func:`~.graphviz_draw`, | ||
:meth:`.PyGraph.to_dot`, and :meth:`.PyDiGraph.to_dot` to expose further | ||
options around this. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters