Commit cdfc739
Add @ sanitization to string_utils for sympy compatibility (#5070)
Summary:
Pull Request resolved: #5070
The recent migration of ScalarizedObjective to expression-based
Objective.__init__() introduced sympy parsing of metric names. Metric
names containing @ (e.g. metric@USCA) cause sympify() to interpret @
as Python's matrix multiplication operator (PEP 465), raising:
TypeError: unsupported operand type(s) for @: 'Mul' and 'Symbol'
Add @ -> __at__ sanitization to sanitize_name() and the corresponding
reverse in unsanitize_name(), following the same pattern already used
for `:, ., /, |, ~, -, ()`.
Reviewed By: saitcakmak, Balandat
Differential Revision: D97242521
fbshipit-source-id: 4b19b75ca8659cb209341322ebe886c3a344d7fa1 parent c2d8610 commit cdfc739
2 files changed
+26
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
127 | 128 | | |
128 | 129 | | |
129 | 130 | | |
130 | | - | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
131 | 141 | | |
132 | 142 | | |
133 | 143 | | |
| |||
158 | 168 | | |
159 | 169 | | |
160 | 170 | | |
161 | | - | |
| 171 | + | |
| 172 | + | |
162 | 173 | | |
163 | 174 | | |
164 | 175 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
107 | 118 | | |
108 | 119 | | |
109 | 120 | | |
110 | 121 | | |
111 | 122 | | |
112 | 123 | | |
113 | 124 | | |
| 125 | + | |
| 126 | + | |
114 | 127 | | |
115 | 128 | | |
116 | 129 | | |
| |||
0 commit comments