Function used to create the response for all infra node types
325854
def infra_nodes(info, meta, max_pod_cluster, label, key):
    
    nodes = meta.get(label, []) or []
    infos = info[info["machine_id"].isin(nodes)]
    if infos.empty:
        return
    return make_response(key, max_pod_cluster=max_pod_cluster, infos=infos,
                         GREEN=Fore.GREEN, RED=Fore.RED, YELLOW=Fore.YELLOW, NC=Style.RESET_ALL)
1166255
function HttpResponse(init) {
        if (init === void 0) { init = {}; }
        var _this = _super.call(this, init) || this;
        _this.type = HttpEventType.Response;
        _this.body = init.body !== undefined ? init.body : null;
        return _this;
    }
258081
def _build_response(self):
        
        responses = []
        self.event_urls = []

        for index, event in enumerate(self.events):
            self.py3.threshold_get_color(index + 1, "event")
            self.py3.threshold_get_color(index + 1, "time")

            event_dict = {}

            event_dict["summary"] = event.get("summary")
            event_dict["location"] = event.get("location")
            event_dict["description"] = event.get("description")
            self.event_urls.append(event["htmlLink"])

            if event["start"].get("date") is not None:
                start_dt = self._gstr_to_date(event["start"].get("date"))
                end_dt = self._gstr_to_date(event["end"].get("date"))
            else:
                start_dt = self._gstr_to_datetime(event["start"].get("dateTime"))
                end_dt = self._gstr_to_datetime(event["end"].get("dateTime"))

            if end_dt < datetime.datetime.now(tzlocal()):
                continue

            event_dict["start_time"] = self._datetime_to_str(start_dt, self.format_time)
            event_dict["end_time"] = self._datetime_to_str(end_dt, self.format_time)

            event_dict["start_date"] = self._datetime_to_str(start_dt, self.format_date)
            event_dict["end_date"] = self._datetime_to_str(end_dt, self.format_date)

            time_delta = self._delta_time(start_dt)
            if time_delta["days"] < 0:
                time_delta = self._delta_time(end_dt)
                is_current = True
            else:
                is_current = False

            event_dict["format_timer"] = self._format_timedelta(
                index, time_delta, is_current
            )

            if self.warn_threshold > 0:
                self._check_warn_threshold(time_delta, event_dict)

            event_formatted = self.py3.safe_format(
                self.format_event,
                {
                    "is_toggled": self.button_states[index],
                    "summary": event_dict["summary"],
                    "location": event_dict["location"],
                    "description": event_dict["description"],
                    "start_time": event_dict["start_time"],
                    "end_time": event_dict["end_time"],
                    "start_date": event_dict["start_date"],
                    "end_date": event_dict["end_date"],
                    "format_timer": event_dict["format_timer"],
                },
            )

            self.py3.composite_update(event_formatted, {"index": index})
            responses.append(event_formatted)

            self.no_update = False

        format_separator = self.py3.safe_format(self.format_separator)
        self.py3.composite_update(format_separator, {"index": "sep"})
        responses = self.py3.composite_join(format_separator, responses)

        return {"events": responses}
694296
function processData(res, data, options) {
  const handlers = Object.assign({}, deserializers, options.deserializers);
  const contentType = res.headers['content-type'];
  const types = typeof contentType === 'string' ? contentType.split(';') : [];

  // if there are no content types, return the data unmodified
  if (!types.length) {
    return data;
  }

  return types.reduce((d, type) => {
    try {
      const t = type.toLocaleLowerCase().trim();
      const handler = handlers[t];

      if (d instanceof Error || typeof handler !== 'function') {
        return d;
      }
      return handler(d);
    } catch (error) {
      return error;
    }
  }, data);
}
369485
def create_response(self, request, content, content_type):
        """"""

        return HttpResponse(content=content, content_type=content_type)
698965
function getResponse( clbk ) {
	if ( typeof clbk !== 'function' ) {
		throw new TypeError( 'getResponse()::invalid input argument. Callback must be a function.' );
	}
	/**
	* FUNCTION: onResponse( error, response, body )
	*	Response handler.
	*
	* @private
	* @param {Object} error - error object
	* @param {Object} response - response object
	* @param {String} body - response body
	*/
	return function onResponse( error, response, body ) {
		var data;
		if ( error ) {
			clbk({
				'status': 502,
				'message': 'Request error. Unable to obtain data.'
			});
			return;
		}
		if ( !body ) {
			clbk({
				'status': 404,
				'message': 'No data returned. Empty body. Ensure all query parameters are correct.'
			});
			return;
		}
		try {
			data = JSON.parse( body );
		} catch ( err ) {
			clbk({
				'status': 502,
				'message': 'Unsupported data format. Response body cannot be parsed as JSON.'
			});
			return;
		}
		if ( Array.isArray( data ) && !data.length ) {
			clbk({
				'status': 404,
				'message': 'No data returned. Empty data array. Ensure all query parameters are correct.'
			});
			return;
		}
		clbk( null, data );
	}; // end FUNCTION onResponse()
}
646320
def xml(func):
    
    if inspect.isclass(func):
        apply_function_to_members(func, xml)
        return func
    else:
        @functools.wraps(func)
        def decorated_view(*args, **kwargs):
            data = func(*args, **kwargs)
            return _build_response(data, dicttoxml)
        return decorated_view
1088372
function extendedCallback(res) {
        timeline.mark(`end:${id}`);
        // add full response data
        moduleData[id].response = getResDataObject(res);
        // flatten object for easy transformation/filtering later
        moduleData[id] = flatten(moduleData[id], { maxDepth: 5 });
        moduleData[id] = filterData(config, moduleData[id]);

        // if filter function returns falsey value, drop all data completely
        if (typeof moduleData[id] !== 'object') {
          timeline.data = timeline.data.filter(
            d => !new RegExp(id).test(d.name)
          );
          delete moduleData[id];
        }

        if (typeof originalCallback === 'function') {
          return originalCallback.apply(this, [res]);
        }
        return true;
      }
814109
function func(schema, defaults, options) {
  if (kindOf(schema) !== 'function') {
    if (process.env.NODE_ENV !== 'production') {
      throw new Error(
        `Function structs must be defined as a function, but you passed: ${schema}`
      )
    } else {
      throw new Error(`Invalid schema: ${schema}`)
    }
  }

  const name = 'function'
  const type = '<function>'
  const validate = (value = resolveDefaults(defaults), data) => {
    const result = schema(value, data)
    let failure = { path: [], reason: null }
    let isValid

    switch (kindOf(result)) {
      case 'boolean': {
        isValid = result
        break
      }
      case 'string': {
        isValid = false
        failure.reason = result
        break
      }
      case 'object': {
        isValid = false
        failure = { ...failure, ...result }
        break
      }
      default: {
        if (process.env.NODE_ENV !== 'production') {
          throw new Error(
            `Validator functions must return a boolean, an error reason string or an error reason object, but you passed: ${schema}`
          )
        } else {
          throw new Error(`Invalid result: ${result}`)
        }
      }
    }

    return isValid
      ? [undefined, value]
      : [{ type, value, data: value, ...failure }]
  }

  return new Kind(name, type, validate)
}
1172727
function createInline(type, props = {}, nodes) {
  const node = { object: 'inline', type, ...props };
  return addNodes(node, nodes);
}
443236
def make_func_call(id_, lineno, params):
    
    return symbols.FUNCCALL.make_node(id_, params, lineno)
276907
function ajaxConvert( s, response ) {

	// Apply the dataFilter if provided
	if ( s.dataFilter ) {
		response = s.dataFilter( response, s.dataType );
	}

	var dataTypes = s.dataTypes,
		converters = {},
		i,
		key,
		length = dataTypes.length,
		tmp,
		// Current and previous dataTypes
		current = dataTypes[ 0 ],
		prev,
		// Conversion expression
		conversion,
		// Conversion function
		conv,
		// Conversion functions (transitive conversion)
		conv1,
		conv2;

	// For each dataType in the chain
	for ( i = 1; i < length; i++ ) {

		// Create converters map
		// with lowercased keys
		if ( i === 1 ) {
			for ( key in s.converters ) {
				if ( typeof key === "string" ) {
					converters[ key.toLowerCase() ] = s.converters[ key ];
				}
			}
		}

		// Get the dataTypes
		prev = current;
		current = dataTypes[ i ];

		// If current is auto dataType, update it to prev
		if ( current === "*" ) {
			current = prev;
		// If no auto and dataTypes are actually different
		} else if ( prev !== "*" && prev !== current ) {

			// Get the converter
			conversion = prev + " " + current;
			conv = converters[ conversion ] || converters[ "* " + current ];

			// If there is no direct converter, search transitively
			if ( !conv ) {
				conv2 = undefined;
				for ( conv1 in converters ) {
					tmp = conv1.split( " " );
					if ( tmp[ 0 ] === prev || tmp[ 0 ] === "*" ) {
						conv2 = converters[ tmp[1] + " " + current ];
						if ( conv2 ) {
							conv1 = converters[ conv1 ];
							if ( conv1 === true ) {
								conv = conv2;
							} else if ( conv2 === true ) {
								conv = conv1;
							}
							break;
						}
					}
				}
			}
			// If we found no converter, dispatch an error
			if ( !( conv || conv2 ) ) {
				jQuery.error( "No conversion from " + conversion.replace(" "," to ") );
			}
			// If found converter is not an equivalence
			if ( conv !== true ) {
				// Convert with 1 or 2 converters accordingly
				response = conv ? conv( response ) : conv2( conv1(response) );
			}
		}
	}
	return response;
}
406608
function create_request_function(personality, doc_type,
				 id_field, label_field, link_type){

    return function(request, query) {

	// Declare a delayed response.
	var response = new Deferred();
	//response.wait(5000); // 5s wait for resolution

	// New agent on every call.
	var go = new bbop.golr.manager.ringo(server_loc, gconf);
	go.set_personality(personality); // profile in gconf
	go.add_query_filter('document_category', doc_type);
	
	// Define what we do when our GOlr (async) information
	// comes back within the scope of the deferred response
	// variable.
	function golr_callback_action(resp){

	    // Return caches for the values we'll collect.
	    var ret_terms = [];
	    var ret_descs = [];
	    var ret_links = [];

	    // Gather document info if available.
	    //var found_docs = resp.documents();		
	    bbop.core.each(resp.documents(),
			   function(doc){
			       var id = doc[id_field];
			       var label = doc[label_field];

			       ret_terms.push(label);
			       ret_descs.push(id);
			       ret_links.push(linker.url(id, link_type));
			   });

	    // Assemble final answer into the OpenSearch JSON
	    // form.
	    var ret_body = [query];
	    ret_body.push(ret_terms);
	    ret_body.push(ret_descs);
	    ret_body.push(ret_links);
	    var ans = {
		status: 200,
		headers: {'Content-Type': 'application/json'},
		body: [bbop.core.to_string(ret_body)]
	    };
	    response.resolve(ans);
	}

	// Run the agent action.
	//go.set_query(query);
	go.set_comfy_query(query);
	go.register('search', 'do', golr_callback_action);
	go.update('search');

	return response.promise;
    };
}
419812
function onEnd() {
		var data;
		if ( err ) {
			err.message = body;
			return onError( err );
		}
		// debug( 'Response body: %s', body );

		data = parse( body );
		if ( data instanceof Error ) {
			err = {
				'status': 502,
				'message': 'unable to parse endpoint response data as JSON: ' + data.message
			};
			return onError( err );
		}
		clbk( null, res, data );
	}
633277
def xmlresponse(py_data):
    
    xroot = ElementTree.Element('methodResponse')
    xparams = ElementTree.SubElement(xroot, 'params')
    xparam = ElementTree.SubElement(xparams, 'param')

    type_map = {'bool': 'boolean',
                'float': 'double',
                'str': 'string',
                'unicode': 'string',
                'datetime': 'dateTime.iso8601',
                'date': 'date.iso8601',
                'time': 'time.iso8601'}

    def xobj(xparent, py_obj):
        # convert a list of information
        if type(py_obj) in (tuple, list):
            xarr = ElementTree.SubElement(xparent, 'array')
            xdata = ElementTree.SubElement(xarr, 'data')
            for val in py_obj:
                xval = ElementTree.SubElement(xdata, 'value')
                xobj(xval, val)

        # convert a dictionary of information
        elif type(py_obj) == dict:
            xstruct = ElementTree.SubElement(xparent, 'struct')
            for key, val in py_obj.items():
                xmember = ElementTree.SubElement(xstruct, 'member')
                xname = ElementTree.SubElement(xmember, 'name')
                xname.text = key
                xval = ElementTree.SubElement(xmember, 'value')
                xobj(xval, val)

        # convert a None value
        elif py_obj is None:
            ElementTree.SubElement(xparent, 'nil')

        # convert a basic value
        else:
            typ = type(py_obj).__name__
            typ = type_map.get(typ, typ)
            xitem = ElementTree.SubElement(xparent, typ)

            # convert a datetime/date/time
            if isinstance(py_obj, datetime.date) or \
                    isinstance(py_obj, datetime.time) or \
                    isinstance(py_obj, datetime.datetime):

                if py_obj.tzinfo and pytz:
                    data = py_obj.astimezone(pytz.utc).replace(tzinfo=None)
                    xitem.text = data.isoformat()
                else:
                    xitem.text = py_obj.isoformat()

            # convert a boolean
            elif type(py_obj) == bool:
                xitem.text = nstr(int(py_obj))

            # convert a non-string object
            elif not type(py_obj) in (str, unicode):
                xitem.text = nstr(py_obj)

            # convert a string object
            else:
                xitem.text = py_obj

    xobj(xparam, py_data)
    projex.text.xmlindent(xroot)
    return ElementTree.tostring(xroot)
530574
function respOk (response, data, type) {
    if (type) {
        headers = {'Content-Type': type};
    }
    response.writeHead(200, headers);
    if (data) {
        response.write(data, 'utf-8');
    }
    response.end();
}
901520
function (response, type) {
		'use strict';
		let directives = response.response.directives;
		if (directives) {
			for (let i = 0; i < directives.length; i++) {
				if (directives[i].type === type) {
					return directives[i];
				}
			}
		}
		return undefined;
	}