Python 3.6 introduced a DeprecationWarning for invalid escape sequences. This is upgraded to a SyntaxWarning in Python 3.12, and will eventually be a syntax error. Fix these now to get ahead of it before it's an error.
Showing the changes to tools/perf/scripts/python/exported-sql-viewer.py (1 of 4 files). Show all
Unified · Split
| @@ -677,8 +677,8 @@ class CallGraphModelBase(TreeModel): · 676 unmodified lines | |||
| 677 | # sqlite supports GLOB (text only) which uses * and ? and is case sensitive | 677 | # sqlite supports GLOB (text only) which uses * and ? and is case sensitive |
| 678 | if not self.glb.dbref.is_sqlite3: | 678 | if not self.glb.dbref.is_sqlite3: |
| 679 | # Escape % and _ | 679 | # Escape % and _ |
| 680 | s = value.replace("%", "\%") | 680 | s = value.replace("%", "\\%") |
| 681 | s = s.replace("_", "\_") | 681 | s = s.replace("_", "\\_") |
| 682 | # Translate * and ? into SQL LIKE pattern characters % and _ | 682 | # Translate * and ? into SQL LIKE pattern characters % and _ |
| 683 | trans = string.maketrans("*?", "%_") | 683 | trans = string.maketrans("*?", "%_") |
| 684 | match = " LIKE '" + str(s).translate(trans) + "'" | 684 | match = " LIKE '" + str(s).translate(trans) + "'" |