juergbi commented on code in PR #1979:
URL: https://github.com/apache/buildstream/pull/1979#discussion_r1920408451


##########
contrib/bst-graph:
##########
@@ -55,6 +56,10 @@ def parse_args():
     return parser.parse_args()
 
 
+def escape(s):
+    return urllib.parse.quote_plus(s.encode())

Review Comment:
   I see. What confused me is that graphviz doesn't actually expect 
URI/percent-encoded strings. As far as I can tell, this is using URI 
percent-encoding simply as a convenient way to generate unique identifiers that 
don't contain colons or backslashes. As labels are used, the identifiers don't 
really matter. (A cryptographic hash could be used instead but that would make 
the graphviz file less readable).
   
   Can you please add a small comment that URI percent-encoding is used to 
generate unique identifiers that don't contain colons or backslashes?
   
   Also, is the `.encode()` part actually necessary? 
`urllib.parse.quote_plus()` accepts strings and the default encoding is 
`utf-8`, so it seems to me that `.encode()` is redundant, or am I missing 
something?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to