GenerateNTResponse
17704
def generate_nt_response_mschap2(authenticator_challenge, peer_challenge, username, password):
    """"""
    challenge = challenge_hash(peer_challenge, authenticator_challenge, username)
    password_hash = nt_password_hash(password)
    return challenge_response(challenge, password_hash)
1301256
function storeResponse(message, id, dest)
  {
    var response =
    {
      message: message,
      /** Timeout to auto-clean old responses */
      timeout: setTimeout(function()
      {
        responses.remove(id, dest);
      },
      response_timeout)
    };

    responses.set(response, id, dest);
  }
110085
def generate_code(request, response):
    
    for proto_file in request.proto_file:
        types = []
        messages = {}

        results = traverse(proto_file)
        map_types = {}
        def full_name(package, item):
            return "%s.%s" % (package, item.name)
        for item, package in results["types"]:
            if item.options.has_key("map_entry"):
                map_types[full_name(package, item)] = dict([(x.name,x) for x in item.field])
        for item, package in results["types"]:
            name = full_name(package, item)
            if name in map_types:
                continue
            data = {
                'name': simplify_name(name),
                'doc': item.comment
            }

            if item.kind == DescriptorProto:
                data.update({
                    'type': 'message',
                    'fields': []
                })
                for f in item.field:
                    kind = type_to_string(f, map_types)
                    data["fields"].append({
                        'name': f.name,
                        'type': kind,
                        'doc': f.comment
                        })
                if len(item.oneof_decl) > 0:
                    data["fields"] = [
                        {
                            "name": item.oneof_decl[0].name,
                            "type": [" %s "% x["type"] for x in data["fields"]],
                            "doc": "\n".join(["%s: %s"%(x["type"],x["doc"]) for x in data["fields"] if x["doc"] != ""])
                        }]
                types.append(data)
            elif item.kind == EnumDescriptorProto:
                comments = ["\n* `%s`: %s"%(v.name, v.comment) for v in item.value]
                data.update({
                    'type': 'enum',
                    'symbols': [v.name for v in item.value]
                })
                data["doc"] += "\n" + " ".join(comments)
                types.append(data)
            elif item.kind == ServiceDescriptorProto:
                for m in item.method:
                    messages[m.name] = {
                        "doc": m.comment,
                        "request": [{
                            "name": "request",
                            "type": ":protobuf:message:`%s`" % simplify_name(m.input_type),
                        }],
                        "response": ":protobuf:message:`%s`" % simplify_name(m.output_type),
                        "errors" : [ ":protobuf:message:`GAException`" ]
                    }
            else:
                raise Exception, item.kind

        comments = "\n".join(results["file"])
        output = {
            "types": types,
            "messages": messages,
            "protocol": proto_file.name.split("/")[-1].split(".")[0],
            'doc': comments,
            "namespace": proto_file.package,
        }

        # Fill response
        f = response.file.add()
        f.name = proto_file.name + '.json'
        f.content = json.dumps(output, indent=2)
1006812
def _generate_content(self):
        """"""
        # concat into a dict
        dic = self.config
        dic['mode'] = self.language
        if self.theme:
            dic['theme'] = self.theme
        # dumps with json
        return json.dumps(dic, indent=8, separators=(',', ': '))
672223
def _WriteResponses(self, responses, cursor):
    """"""

    query = ("INSERT IGNORE INTO flow_responses "
             "(client_id, flow_id, request_id, response_id, "
             "response, status, iterator, timestamp) VALUES ")

    templates = []
    args = []
    for r in responses:
      templates.append("(%s, %s, %s, %s, %s, %s, %s, NOW(6))")
      client_id_int = db_utils.ClientIDToInt(r.client_id)
      flow_id_int = db_utils.FlowIDToInt(r.flow_id)

      args.append(client_id_int)
      args.append(flow_id_int)
      args.append(r.request_id)
      args.append(r.response_id)
      if isinstance(r, rdf_flow_objects.FlowResponse):
        args.append(r.SerializeToString())
        args.append("")
        args.append("")
      elif isinstance(r, rdf_flow_objects.FlowStatus):
        args.append("")
        args.append(r.SerializeToString())
        args.append("")
      elif isinstance(r, rdf_flow_objects.FlowIterator):
        args.append("")
        args.append("")
        args.append(r.SerializeToString())
      else:
        # This can't really happen due to db api type checking.
        raise ValueError("Got unexpected response type: %s %s" % (type(r), r))

    query += ",".join(templates)
    try:
      cursor.execute(query, args)
    except MySQLdb.IntegrityError:
      # If we have multiple responses and one of them fails to insert, we try
      # them one by one so we don't lose any valid replies.
      if len(responses) > 1:
        for r in responses:
          self._WriteResponses([r], cursor)
      else:
        logging.warn("Response for unknown request: %s", responses[0])
573094
final public function generateResponse($request = null)
    {
        while (true) {
            $this->setWebRequest($request);

            try {
                if ($request->header("Accept") == "application/leaf") {
                    $response = new XmlResponse($this);
                    $response->setContent($this->renderXhr());
                } else {
                    $response = new HtmlResponse($this);
                    $response->setContent($this->render());
                }

                return $response;
            } catch (RequiresViewReconfigurationException $er) {
                $this->initialiseView();
            }
        }

        return null;
    }
264419
public function createResponse()
    {
        if (empty($this->headers)) {
            throw new \RuntimeException('No headers have been received');
        }

        // HTTP-version SP status-code SP reason-phrase
        $startLine = explode(' ', array_shift($this->headers), 3);
        $headers = \GuzzleHttp\headers_from_lines($this->headers);
        $normalizedKeys = \GuzzleHttp\normalize_header_keys($headers);

        if (!empty($this->options['decode_content'])
            && isset($normalizedKeys['content-encoding'])
        ) {
            $headers['x-encoded-content-encoding']
                = $headers[$normalizedKeys['content-encoding']];
            unset($headers[$normalizedKeys['content-encoding']]);
            if (isset($normalizedKeys['content-length'])) {
                $headers['x-encoded-content-length']
                    = $headers[$normalizedKeys['content-length']];

                $bodyLength = (int) $this->sink->getSize();
                if ($bodyLength) {
                    $headers[$normalizedKeys['content-length']] = $bodyLength;
                } else {
                    unset($headers[$normalizedKeys['content-length']]);
                }
            }
        }

        // Attach a response to the easy handle with the parsed headers.
        $this->response = new Response(
            $startLine[1],
            $headers,
            $this->sink,
            substr($startLine[0], 5),
            isset($startLine[2]) ? (string) $startLine[2] : null
        );
    }
622304
def generate_response(self, input_statement, additional_response_selection_parameters=None):
        
        Statement = self.storage.get_object('statement')

        results = []
        result = None
        max_confidence = -1

        for adapter in self.logic_adapters:
            if adapter.can_process(input_statement):

                output = adapter.process(input_statement, additional_response_selection_parameters)
                results.append(output)

                self.logger.info(
                    '{} selected "{}" as a response with a confidence of {}'.format(
                        adapter.class_name, output.text, output.confidence
                    )
                )

                if output.confidence > max_confidence:
                    result = output
                    max_confidence = output.confidence
            else:
                self.logger.info(
                    'Not processing the statement using {}'.format(adapter.class_name)
                )

        class ResultOption:
            def __init__(self, statement, count=1):
                self.statement = statement
                self.count = count

        # If multiple adapters agree on the same statement,
        # then that statement is more likely to be the correct response
        if len(results) >= 3:
            result_options = {}
            for result_option in results:
                result_string = result_option.text + ':' + (result_option.in_response_to or '')

                if result_string in result_options:
                    result_options[result_string].count += 1
                    if result_options[result_string].statement.confidence < result_option.confidence:
                        result_options[result_string].statement = result_option
                else:
                    result_options[result_string] = ResultOption(
                        result_option
                    )

            most_common = list(result_options.values())[0]

            for result_option in result_options.values():
                if result_option.count > most_common.count:
                    most_common = result_option

            if most_common.count > 1:
                result = most_common.statement

        response = Statement(
            text=result.text,
            in_response_to=input_statement.text,
            conversation=input_statement.conversation,
            persona='bot:' + self.name
        )

        response.confidence = result.confidence

        return response
124617
function buildResponse(data) {
    var response = {};
    response.totalItems = data.length;
    response.itemsPerPage = itemsPerPage;
    response.totalPages = itemsPerPage === null ? 1 : Math.ceil(data.length / itemsPerPage);
    response.currentPage = itemsPerPage === null ? 1 : currentPage;
    response.data = itemsPerPage === null ? data : data.slice(itemsPerPage * (currentPage - 1), itemsPerPage);

    return response;
}
888461
function generate() {
    var parsed = ensureConfig();
    if (!parsed.name)
        mu.log.error('cannot generate template using name of undefined.\n').write().exit();
    // Generate the template.
    mu.render(parsed.name, parsed.output, parsed.options);
}
849161
function replaceResponse(res) {
  // copy for response.headers.hasOwnProperty is undefined case
  // https://github.com/oauthjs/node-oauth2-server/pull/486
  const newResponse = {
    headers: {},
  };
  for (const property in res) {
    if (property !== 'headers') {
      newResponse[property] = res[property];
    }
  }
  for (const field in res.headers) {
    newResponse.headers[field] = res.headers[field];
  }
  newResponse.header = newResponse.headers;
  return newResponse;
}
1052018
def async_make_reply(msgname, types, arguments_future, major):
    """"""
    arguments = yield arguments_future
    raise gen.Return(make_reply(msgname, types, arguments, major))
315364
public function generateResponse($request = null, $currentUrlFragment = false)
    {
        if ($currentUrlFragment === false) {
            $currentUrlFragment = $request->urlPath;
        }

        if (!$this->matchesRequest($request, $currentUrlFragment)) {
            return false;
        }

        UrlHandler::setExecutingUrlHandler($this);

        Log::debug(function () {
            return "Handler " . get_class($this) . " selected to generate response";
        }, "ROUTER");

        Log::indent();

        $context = new PhpContext();
        $context->UrlHandler = $this;

        $this->matchingUrl = $this->getMatchingUrlFragment($request, $currentUrlFragment);

        if ($this->parentHandler) {
            $this->handledUrl = $this->parentHandler->handledUrl . $this->matchingUrl;
        } else {
            $this->handledUrl = $this->matchingUrl;
        }

        $childUrlFragment = substr($currentUrlFragment, strlen($this->matchingUrl));

        foreach ($this->childUrlHandlers as $childHandler) {
            $response = $childHandler->generateResponse($request, $childUrlFragment);

            if ($response !== false) {
                return $response;
            }
        }

        $response = $this->generateResponseForRequest($request, $currentUrlFragment);

        Log::debug(function () use ($response) {
            if ($response !== false) {
                return "Response generated by handler";
            }

            return "Handler deferred generation";
        }, "ROUTER");

        Log::outdent();

        return $response;
    }
667690
private void createResponse() {
        response = new GenericQueryResponse(
            queryErrorObservable.onBackpressureBuffer(),
            queryRowObservable.onBackpressureBuffer(),
            querySignatureObservable.onBackpressureBuffer(),
            queryStatusObservable.onBackpressureBuffer(),
            queryInfoObservable.onBackpressureBuffer(),
            queryProfileInfoObservable.onBackpressureBuffer(),
            currentRequest,
            status,
            requestID,
            clientContextID
        );
    }
1126440
function NWTIOResponse (request) {
	this.request = request;
	try {
		this.obj = JSON.parse(request.responseText);
	} catch(e) {}
}
207068
private function generateResponse($view, $contentDisposition, $parameters,
        $options)
    {
        return new Response(
            $this->getOutputFromView($view, $parameters, $options),
            200,
            array(
                'Content-Type'          => 'application/pdf',
                'Content-Disposition'   => $contentDisposition,
            )
        );
    }
1181480
def Genra(request):
	
	school = request.GET['school']
	c = Course(school=school)
	return JsonResponse(c.getGenra(), safe=False)