Encode the common request envelope
777672
def _encode_message_header(cls, client_id, correlation_id, request_key,
                               version=0):
        
        return struct.pack('>hhih%ds' % len(client_id),
                           request_key,          # ApiKey
                           version,              # ApiVersion
                           correlation_id,       # CorrelationId
                           len(client_id),       # ClientId size
                           client_id)
105936
function(params) {
    var encode = encodeURIComponent,
      p = [],
      key;
    for (key in params) p.push(encode(key) + '=' + encode(params[key]));

    return p.join('&');
  }
123265
function encodeURIParams(params, prefix) {
    let parts = [];
    for (const name in params) {
        if (Object.prototype.hasOwnProperty.call(params, name)) {
            const paramName = prefix ? (`${prefix}[${encodeURIComponent(name)}]`) : encodeURIComponent(name);
            if (typeof params[name] === 'object') {
                parts = Array.prototype.concat.apply(parts,
                    encodeURIParams(params[name], paramName));
            } else {
                parts.push(`${paramName}=${encodeURIComponent(params[name])}`);
            }
        }
    }
    return parts;
}
1147706
def _encode_request(self, request):
        """"""
        obj = request_to_dict(request, self.spider)
        return self.serializer.dumps(obj)
69798
function encodeQueryData(obj, prefix) {
          var str = [];
          for (var p in obj) {
            if (obj.hasOwnProperty(p)) {
              var k = prefix ? prefix + '[' + p + ']' : p, v = obj[p];
              str.push(typeof v === 'object' ? encodeQueryData(v, k) : encodeURIComponent(k) + '=' + encodeURIComponent(v));
            }
          }
          return str.join('&');
        }
3740
def _encode_message_header(cls, client_id, correlation_id, request_key,
                               api_version=0):
        
        return (struct.pack('>hhih',
                            request_key,          # ApiKey
                            api_version,          # ApiVersion
                            correlation_id,       # CorrelationId
                            len(client_id)) +     # ClientId size
                client_id)
1021350
def encode_metadata_request(cls, client_id, correlation_id, topics=None):
        
        topics = [] if topics is None else topics
        message = [
            cls._encode_message_header(client_id, correlation_id,
                                       KafkaCodec.METADATA_KEY),
            struct.pack('>i', len(topics)),
        ]
        for topic in topics:
            message.append(write_short_ascii(topic))
        return b''.join(message)
735816
function encodeAttachmentAssetIssue(buffer, offset, attachment_data) {
    offset = buffer.writeUInt32LE(attachment_data.status, offset);
    //Encode symbol
    offset += encodeString(buffer, attachment_data.symbol, offset);
    //Encode maximum supply
    offset = bufferutils.writeUInt64LE(buffer, attachment_data.max_supply, offset);
    //Encode precision
    offset = buffer.writeUInt8(attachment_data.precision, offset);
    //Encode secondary issue threshold
    offset = buffer.writeUInt8((attachment_data.secondaryissue_threshold) ? attachment_data.secondaryissue_threshold : 0, offset);
    offset += buffer.write("0000", offset, 2, 'hex');
    //Encode issuer
    offset += encodeString(buffer, attachment_data.issuer, offset);
    //Encode recipient address
    offset += encodeString(buffer, attachment_data.address, offset);
    //Encode description
    offset += encodeString(buffer, attachment_data.description, offset);
    return offset;
}
987841
def encode_http_params(**kw):
    '''
    
    '''
    try:
        _fo = lambda k, v: '{name}={value}'.format(
            name=k, value=to_basestring(quote(v)))
    except:
        _fo = lambda k, v: '%s=%s' % (k, to_basestring(quote(v)))

    _en = utf8

    return '&'.join([_fo(k, _en(v)) for k, v in kw.items() if not is_empty(v)])
700987
def encode(raw):
    """"""
    return raw \
        .replace(bytes([SLIP_ESC]), bytes([SLIP_ESC, SLIP_ESC_ESC])) \
        .replace(bytes([SLIP_END]), bytes([SLIP_ESC, SLIP_ESC_END]))
1090706
def _encode_query(item,itemtype,domain,apikey=nil)
			label = nil
			if itemtype == 'ip'
				label = item.split(/\./).reverse.join(".")
			elsif itemtype == 'domain'
				label = normalize(item)
			end
			lookup = "#{label}.#{domain}"
			if apikey
				lookup = "#{apikey}.#{lookup}"
			end
			txid = lookup.sum
			message = Resolv::DNS::Message.new(txid)
			message.rd = 1
			message.add_question(lookup,Resolv::DNS::Resource::IN::A)
			message.encode
		end
683517
def encode(self, envelope, session, aes_cipher=None, **kwargs):
		
		return WMessengerBytesEnvelope(aes_cipher.encrypt(envelope.message()), meta=envelope)
1372072
def encode(self, b64=False):
        """"""
        encoded_payload = b''
        for pkt in self.packets:
            encoded_packet = pkt.encode(b64=b64)
            packet_len = len(encoded_packet)
            if b64:
                encoded_payload += str(packet_len).encode('utf-8') + b':' + \
                    encoded_packet
            else:
                binary_len = b''
                while packet_len != 0:
                    binary_len = six.int2byte(packet_len % 10) + binary_len
                    packet_len = int(packet_len / 10)
                if not pkt.binary:
                    encoded_payload += b'\0'
                else:
                    encoded_payload += b'\1'
                encoded_payload += binary_len + b'\xff' + encoded_packet
        return encoded_payload
1343230
def encode_consumer_metadata_request(cls, client_id, correlation_id, payloads):
        
        message = []
        message.append(cls._encode_message_header(client_id, correlation_id,
                                                  KafkaProtocol.CONSUMER_METADATA_KEY))
        message.append(struct.pack('>h%ds' % len(payloads), len(payloads), payloads))

        msg = b''.join(message)
        return write_int_string(msg)
1306397
def encode_contents(self):
        

        if self.variable_size:
            resp_length = 1
        else:
            resp_length = self.fixed_response_size << 1

        header = struct.pack("<HBB", self.rpc_id, self.address, resp_length)
        return bytearray(header) + self.payload
578296
function encodeBuffer(buf, options, cb) {
  if(typeof options === 'function') {
    cb = options;
    options = {};
  }

  try {
    buf = bufferUtils.toArrayLike(buf);

    if(!options.hasOwnProperty('width') || !options.hasOwnProperty('height')) {
      return cb(new Error('Provide width & height of the buffer'));
    }

    if(hasWorker) {
      const wr = require('webworkify')(encodeWorker);

      wr.onmessage = ({ data: msg }) => {
        const err = msg.err ? new Error(msg.err) : undefined;
        cb(err, msg.result);
      };

      const msg = {
        buf: buf,
        options: options
      };

      if (options.transferable) {
        wr.postMessage(msg, [ buf ]);
      } else {
        wr.postMessage(msg);
      }
    } else {
      encode(buf, options, cb);
    }
  } catch(err) {
    cb(err);
  }
}
687725
@Deprecated
    public static String encodePostBody(Bundle parameters, String boundary) {
        if (parameters == null) return "";
        StringBuilder sb = new StringBuilder();

        for (String key : parameters.keySet()) {
            Object parameter = parameters.get(key);
            if (!(parameter instanceof String)) {
                continue;
            }

            sb.append("Content-Disposition: form-data; name=\"" + key +
                    "\"\r\n\r\n" + (String)parameter);
            sb.append("\r\n" + "--" + boundary + "\r\n");
        }

        return sb.toString();
    }