changeset 42702:e9592e113c31

byteify-strings: handle triple quoted strings if they are not docstrings As with anything in this script, this is a best effort approach. Most of the time, when a triple quoted string is assigned to something, it's not a docstring.
author Raphaël Gomès <rgomes@octobus.net>
date Fri, 02 Aug 2019 09:48:13 +0200
parents 70bd1965bd07
children b9a200477edf
files contrib/byteify-strings.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/byteify-strings.py	Fri Aug 02 09:44:11 2019 +0200
+++ b/contrib/byteify-strings.py	Fri Aug 02 09:48:13 2019 +0200
@@ -139,8 +139,10 @@
             # components touching docstrings need to handle unicode,
             # unfortunately.
             if s[0:3] in ("'''", '"""'):
-                yield adjusttokenpos(t, coloffset)
-                continue
+                # If it's assigned to something, it's not a docstring
+                if not _isop(i - 1, '='):
+                    yield adjusttokenpos(t, coloffset)
+                    continue
 
             # If the first character isn't a quote, it is likely a string
             # prefixing character (such as 'b', 'u', or 'r'. Ignore.