MCPcopy
hub / github.com/google/earthengine-api / _invocation

Function _invocation

python/ee/deserializer.py:137–153  ·  view source on GitHub ↗

Creates an EE object representing the application of `func` to `args`.

(func: Any, args: dict[str, Any])

Source from the content-addressed store, hash-verified

135
136
137def _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
156def fromCloudApiJSON(json_obj: str | bytes) -> Any: # pylint: disable=g-bad-name

Callers 2

_decodeValueFunction · 0.85

Calls 1

applyMethod · 0.45

Tested by

no test coverage detected