Creates an EE object representing the application of `func` to `args`.
(func: Any, args: dict[str, Any])
| 135 | |
| 136 | |
| 137 | def _invocation(func: Any, args: dict[str, Any]) -> Any: |
| 138 | """Creates an EE object representing the application of `func` to `args`.""" |
| 139 | if isinstance(func, function.Function): |
| 140 | return func.apply(args) |
| 141 | elif isinstance(func, computedobject.ComputedObject): |
| 142 | # We have to allow ComputedObjects for cases where invocations return a |
| 143 | # function, e.g., Image.parseExpression(). These need to get turned back |
| 144 | # into some kind of Function, for which we need a signature. Type |
| 145 | # information has been lost at this point, so we just use ComputedObject. |
| 146 | signature = { |
| 147 | 'name': '', |
| 148 | 'args': [{'name': name, 'type': 'ComputedObject', 'optional': False} |
| 149 | for name in args], |
| 150 | 'returns': 'ComputedObject' |
| 151 | } |
| 152 | return function.SecondOrderFunction(func, signature).apply(args) |
| 153 | raise ee_exception.EEException(f'Invalid function value: {func}') |
| 154 | |
| 155 | |
| 156 | def fromCloudApiJSON(json_obj: str | bytes) -> Any: # pylint: disable=g-bad-name |
no test coverage detected