Executes the resolved end-point callback, or its fallback
        :rtype: Response or object
491135
def exec_route_callback(self) -> Response or object:
        
        if self.__method.lower() in self.__end_points:
            for bound in self.__end_points[self.__method.lower()]:

                route = list(bound)[0]
                expected_params = self.get_url_params(route)
                actual_params = self.get_url_params(self.get_end_point_uri())

                if self.request_matches_route(self.get_end_point_uri(), route):
                    self.app.log.info("> {0} {1}".format(self.__method, self.__uri))
                    if self.authenticate(route, actual_params):
                        self.app.log.debug(
                            "%s(%d) %s" % ("body ", len(self.__request.body), self.__request.body.decode('utf-8'))
                        )
                        pattern_params = self.get_callback_pattern(expected_params, actual_params)
                        self.app.request_handle_time = (
                            lambda d: int((d.days * 24 * 60 * 60 * 1000) + (d.seconds * 1000) + (d.microseconds / 1000))
                        )(datetime.now() - self.__request_start)

                        return bound[route](self.__request, self.app, **pattern_params)
                    else:
                        raise AuthException("Authentication failed.")

        if self.__method == "OPTIONS":
            self.app.log.info("Route matched: {0} {1}".format(self.__method, self.__uri))
            return self.default_route_options()

        if self.__route == '' and self.__uri == '':
            return self.welcome_page()
        else:
            return self.no_route_found(self.__request)
604000
def execute_callback(callback, *args)
      (callback.arity == 2 ? callback.call(*args[0, 2]) : callback.call(*args)) if callback
    end
471471
def _result_handler(self, response: Dict[str, Any]):
        
        res = response.get("MESSAGE")
        ID = res.get("ID")
        result = res.get("RESULT")
        fut = self.tasks.get(ID)
        fut.set_result(result)
        return True
761239
function finalhandler (req, res, options) {
  var opts = options || {}

  // get environment
  var env = opts.env || process.env.NODE_ENV || 'development'

  // get error callback
  var onerror = opts.onerror

  return function (err) {
    var headers
    var msg
    var status

    // ignore 404 on in-flight response
    if (!err && headersSent(res)) {
      debug('cannot 404 after headers sent')
      return
    }

    // unhandled error
    if (err) {
      // respect status code from error
      status = getErrorStatusCode(err)

      if (status === undefined) {
        // fallback to status code on response
        status = getResponseStatusCode(res)
      } else {
        // respect headers from error
        headers = getErrorHeaders(err)
      }

      // get error message
      msg = getErrorMessage(err, status, env)
    } else {
      // not found
      status = 404
      msg = 'Cannot ' + req.method + ' ' + encodeUrl(getResourceName(req))
    }

    debug('default %s', status)

    // schedule onerror callback
    if (err && onerror) {
      defer(onerror, err, req, res)
    }

    // cannot actually respond
    if (headersSent(res)) {
      debug('cannot %d after headers sent', status)
      req.socket.destroy()
      return
    }

    // send response
    send(req, res, status, headers, msg)
  }
}
723692
function (response) {
              var swagger = response.obj;
              if (lock) {
                delete lock[item.root];
              }
              if (self.resolverCache) {
                self.resolverCache[item.root] = swagger;
              }
              self.resolveItem(swagger, item.root, resolutionTable, resolvedRefs, unresolvedRefs, item);
              processedCalls += 1;

              if (processedCalls === expectedCalls) {
                self.finish(spec, _root, resolutionTable, resolvedRefs, unresolvedRefs, callback);
              }
            }
360534
function finishBasicPromise (resolve, reject) {
  return (err, res) => {
    if (err) {
      return reject(err);
    } else {
      return resolve(res);
    }
  };
}
200014
def exec_all_endpoints(self, *args, **kwargs):
        """"""
        results = []
        for handler in self.endpoints:
            if isinstance(handler, weakref.ref):
                handler = handler()
            if self.adapt_params:
                bind = self._adapt_call_params(handler, args, kwargs)
                res = handler(*bind.args, **bind.kwargs)
            else:
                res = handler(*args, **kwargs)
            if isinstance(res, MultipleResults):
                if res.done:
                    results += res.results
                else:
                    results += res._results
            elif res is not NoResult:
                results.append(res)
        return MultipleResults(results, concurrent=self.concurrent, owner=self)
423126
def finalize_response(self, request, response, *args, **kwargs):
        
        # Make the error obvious if a proper response is not returned
        assert isinstance(response, HttpResponseBase), (
            'Expected a `Response`, `HttpResponse` or `HttpStreamingResponse` '
            'to be returned from the view, but received a `%s`'
            % type(response)
        )

        if isinstance(response, Response):
            if not getattr(request, 'accepted_renderer', None):
                neg = self.perform_content_negotiation(request, force=True)
                request.accepted_renderer, request.accepted_media_type = neg

            response.accepted_renderer = request.accepted_renderer
            response.accepted_media_type = request.accepted_media_type
            response.renderer_context = self.get_renderer_context()

        for key, value in self.headers.items():
            response[key] = value

        return response
1246187
def expose_endpoints (module, *args):
    
    
    for op in args:
        # Capture the closure state
        def create_method (o):
            return lambda exp: send_request(o, exp)
        
        setattr(sys.modules[__name__], op, create_method(op))
        setattr(module, op, getattr(sys.modules[__name__], op))
823253
def do_execute(self):
        
        result = None
        evl = self.input.payload
        pltclassifier.plot_prc(
            evl,
            class_index=self.resolve_option("class_index"),
            title=self.resolve_option("title"),
            key_loc=self.resolve_option("key_loc"),
            outfile=self.resolve_option("outfile"),
            wait=bool(self.resolve_option("wait")))
        return result
999335
def do_execute(self):
        
        if isinstance(self.input.payload, Instances):
            inst = None
            data = self.input.payload
        elif isinstance(self.input.payload, Instance):
            inst = self.input.payload
            data = inst.dataset

        index = str(self.resolve_option("index"))
        unset = bool(self.resolve_option("unset"))
        if unset:
            data.no_class()
        else:
            if index == "first":
                data.class_is_first()
            elif index == "last":
                data.class_is_last()
            else:
                data.class_index = int(index) - 1

        if inst is None:
            self._output.append(Token(data))
        else:
            self._output.append(Token(inst))

        return None
245757
void handle(OngoingRequest ongoingRequest, RequestContext requestContext, Endpoint endpoint) {
    try {
      endpoint.invoke(requestContext)
          .whenComplete((message, throwable) -> {
            try {
              if (message != null) {
                ongoingRequest.reply(message);
              } else if (throwable != null) {
                // unwrap CompletionException
                if (throwable instanceof CompletionException) {
                  throwable = throwable.getCause();
                }
                handleException(throwable, ongoingRequest);
              } else {
                LOG.error(
                    "Both message and throwable null in EndpointInvocationHandler for request "
                    + ongoingRequest
                    + " - this shouldn't happen!");
                handleException(new IllegalStateException("Both message and throwable null"),
                                ongoingRequest);
              }
            } catch (Throwable t) {
              // don't try to respond here; just log the fact that responding failed.
              LOG.error("Exception caught when replying", t);
            }
          });
    } catch (Exception e) {
      handleException(e, ongoingRequest);
    }
  }
808663
def callback(response = {})
      if response.empty?
        raise ArgumentError, "No callback parameters found"
      end

      CallbackResponse.new(response, config)
    end
1321809
def handle(self, endpoint, *args, **kwargs):
        
        method = self.request_method()

        try:
            if not method in self.http_methods.get(endpoint, {}):
                raise MethodNotImplemented(
                    "Unsupported method '{}' for {} endpoint.".format(
                        method,
                        endpoint
                    )
                )

            if not self.is_authenticated():
                raise Unauthorized()

            self.data = self.deserialize(method, endpoint, self.request_body())
            view_method = getattr(self, self.http_methods[endpoint][method])
            data = view_method(*args, **kwargs)
            if is_future(data):
                # need to check if the view_method is a generator or not
                data = yield data
            serialized = self.serialize(method, endpoint, data)
        except Exception as err:
            raise gen.Return(self.handle_error(err))

        status = self.status_map.get(self.http_methods[endpoint][method], OK)
        raise gen.Return(self.build_response(serialized, status=status))
69628
def execute(self):
        
        es = connections.get_connection(self._using)

        self._response = self._response_class(
            self,
            es.update_by_query(
                index=self._index,
                body=self.to_dict(),
                **self._params
            )
        )
        return self._response
561620
def Execute(self, http):
        

        self._Execute(http)

        for key in self.__request_response_handlers:
            response = self.__request_response_handlers[key].response
            callback = self.__request_response_handlers[key].handler

            exception = None

            if response.status_code >= 300:
                exception = exceptions.HttpError.FromResponse(response)

            if callback is not None:
                callback(response, exception)
            if self.__callback is not None:
                self.__callback(response, exception)
344298
def post_execute(self):
        
        result = super(Sink, self).post_execute()
        if result is None:
            self._input = None
        return result