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

Method _encode_for_cloud_api

python/ee/serializer.py:95–107  ·  view source on GitHub ↗

Encodes an object as an Expression or quasi-Expression.

(self, obj: Any)

Source from the content-addressed store, hash-verified

93 return value
94
95 def _encode_for_cloud_api(self, obj: Any) -> Any:
96 """Encodes an object as an Expression or quasi-Expression."""
97 value = self._encode_cloud_object(obj)
98 if self._is_compound:
99 # Wrap the scopes and final value into an Expression.
100 value = _ExpressionOptimizer(value, self._scope).optimize()
101 # Clear state in case of future encoding.
102 self._scope = []
103 self._encoded = {}
104 self._hashcache = {}
105 else:
106 value = _ExpressionOptimizer(value).optimize()
107 return value
108
109 def _encode_value(self, obj: Any) -> Any:
110 """Encodes a subtree as a Value in the EE API v2 (DAG) format.

Callers 1

_encodeMethod · 0.95

Calls 3

_encode_cloud_objectMethod · 0.95
optimizeMethod · 0.45

Tested by

no test coverage detected