(self, encoder)
Encodes the object in a format compatible with Serializer.
Encodes the object in a format compatible with Serializer.
Encodes the object in a format compatible with Serializer .
def encode(self, encoder):
    """Encodes the object in a format compatible with Serializer."""
    if self.isVariable():
      return {
          'type': 'ArgumentRef',
          'value': self.varName
      }
    else:
      # Encode the function that we're calling.
      func = encoder(self.func)
      # Built-in functions are encoded as strings under a different key.
      key = 'functionName' if isinstance(func, six.string_types) else 'function'

      # Encode all arguments recursively.
      encoded_args = {}
      for name, value in self.args.items():
        if value is not None:
          encoded_args[name] = encoder(value)

      return {
          'type': 'Invocation',
          'arguments': encoded_args,
          key: func
      }
def encode ( self , encoder ) : if self . isVariable ( ) : return { 'type' : 'ArgumentRef' , 'value' : self . varName } else : # Encode the function that we're calling. func = encoder ( self . func ) # Built-in functions are encoded as strings under a different key. key = 'functionName' if isinstance ( func , six . string_types ) else 'function' # Encode all arguments recursively. encoded_args = { } for name , value in self . args . items ( ) : if value is not None : encoded_args [ name ] = encoder ( value ) return { 'type' : 'Invocation' , 'arguments' : encoded_args , key : func }