(self, obj)
return value
Encodes a top level object to be executed server-side.

    Args:
      obj: The object to encode.

    Returns:
      An encoded object ready for JSON serialization.
Encodes a top level object to be executed server-side.
Encodes a top level object to be executed server - side .
def _encode(self, obj):
    """Encodes a top level object to be executed server-side.

    Args:
      obj: The object to encode.

    Returns:
      An encoded object ready for JSON serialization.
    """
    if self._for_cloud_api:
      return self._encode_for_cloud_api(obj)
    value = self._encode_value(obj)
    if self._is_compound:
      if (isinstance(value, dict) and value['type'] == 'ValueRef' and
          len(self._scope) == 1):
        # Just one value. No need for complex structure.
        value = self._scope[0][1]
      else:
        # Wrap the scopes and final value with a CompoundValue.
        value = {'type': 'CompoundValue', 'scope': self._scope, 'value': value}
      # Clear state in case of future encoding.
      self._scope = []
      self._encoded = {}
      self._hashcache = {}
    return value
def _encode ( self , obj ) : if self . _for_cloud_api : return self . _encode_for_cloud_api ( obj ) value = self . _encode_value ( obj ) if self . _is_compound : if ( isinstance ( value , dict ) and value [ 'type' ] == 'ValueRef' and len ( self . _scope ) == 1 ) : # Just one value. No need for complex structure. value = self . _scope [ 0 ] [ 1 ] else : # Wrap the scopes and final value with a CompoundValue. value = { 'type' : 'CompoundValue' , 'scope' : self . _scope , 'value' : value } # Clear state in case of future encoding. self . _scope = [ ] self . _encoded = { } self . _hashcache = { } return value