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