Returns an AST matching the following: ("uniform" if (old_value) else "truncated_normal")
(old_value)
| 2172 | Returns: The new node |
| 2173 | """ |
| 2174 | def _get_distribution(old_value): |
| 2175 | """Returns an AST matching the following: |
| 2176 | ("uniform" if (old_value) else "truncated_normal") |
| 2177 | """ |
| 2178 | dist = pasta.parse("\"uniform\" if old_value else \"truncated_normal\"") |
| 2179 | ifexpr = dist.body[0].value |
| 2180 | pasta.ast_utils.replace_child(ifexpr, ifexpr.test, old_value) |
| 2181 | |
| 2182 | pasta.base.formatting.set(dist, "prefix", "(") |
| 2183 | pasta.base.formatting.set(dist, "suffix", ")") |
| 2184 | |
| 2185 | return dist |
| 2186 | |
| 2187 | found_distribution = False |
| 2188 | for keyword_arg in node.keywords: |
no test coverage detected