Make global functions wrapping each compute function. Note that some of the automatically-generated wrappers may be overridden by custom versions below.
()
| 312 | |
| 313 | |
| 314 | def _make_global_functions(): |
| 315 | """ |
| 316 | Make global functions wrapping each compute function. |
| 317 | |
| 318 | Note that some of the automatically-generated wrappers may be overridden |
| 319 | by custom versions below. |
| 320 | """ |
| 321 | g = globals() |
| 322 | reg = function_registry() |
| 323 | |
| 324 | # Avoid clashes with Python keywords |
| 325 | rewrites = {'and': 'and_', |
| 326 | 'or': 'or_'} |
| 327 | |
| 328 | for cpp_name in reg.list_functions(): |
| 329 | name = rewrites.get(cpp_name, cpp_name) |
| 330 | func = reg.get_function(cpp_name) |
| 331 | if func.kind == "hash_aggregate": |
| 332 | # Hash aggregate functions are not callable, |
| 333 | # so let's not expose them at module level. |
| 334 | continue |
| 335 | if func.kind == "scalar_aggregate" and func.arity == 0: |
| 336 | # Nullary scalar aggregate functions are not callable |
| 337 | # directly so let's not expose them at module level. |
| 338 | continue |
| 339 | assert name not in g, name |
| 340 | g[cpp_name] = g[name] = _wrap_function(name, func) |
| 341 | |
| 342 | |
| 343 | _make_global_functions() |
no test coverage detected