Look up the method to call
        Return the route info and its arguments on success:
        Return None on error
979596
def _route_match( self, method_name, path_info, route_table ):
        
        path = path_info['path']

        for route_path, route_info in route_table.items():
            if method_name not in route_info['routes'].keys():
                continue

            grps = re.match(route_path, path)
            if grps is None:
                continue

            groups = grps.groups()
            return {
                'route': route_info,
                'method': route_info['routes'][method_name],
                'args': groups,
            }

        return None
560041
def get_handler_name(route: Route, logic: Callable) -> str:
    
    if route.handler_name is not None:
        return route.handler_name
    if any(m for m in route.methods if m.method.lower() == 'post'):
        # A list endpoint
        if route.heading != 'API':
            return '{}ListHandler'.format(get_valid_class_name(route.heading))
        return '{}ListHandler'.format(get_valid_class_name(logic.__name__))
    if route.heading != 'API':
        return '{}Handler'.format(get_valid_class_name(route.heading))
    return '{}Handler'.format(get_valid_class_name(logic.__name__))
1295835
def find_callback(args, kw=None):
    ''
    if args and callable(args[-1]):
        return args[-1], args[:-1]
    try:
        return kw['callback'], args
    except (KeyError, TypeError):
        return None, args
58263
def get_object_or_404(queryset, *args, **kwargs):
    
    try:
        return queryset.get(*args, **kwargs)
    except (ValueError, TypeError, DoesNotExist, ValidationError):
        raise Http404()
938117
def is_flask_route_function(ast_node):
    """"""
    for decorator in ast_node.decorator_list:
        if isinstance(decorator, ast.Call):
            if _get_last_of_iterable(get_call_names(decorator.func)) == 'route':
                return True
    return False
571123
def match(self, environ):
        '''  '''
        verb = environ['REQUEST_METHOD'].upper()
        path = environ['PATH_INFO'] or '/'
        target = None
        if verb == 'HEAD':
            methods = ['PROXY', verb, 'GET', 'ANY']
        else:
            methods = ['PROXY', verb, 'ANY']

        for method in methods:
            if method in self.static and path in self.static[method]:
                target, getargs = self.static[method][path]
                return target, getargs(path) if getargs else {}
            elif method in self.dyna_regexes:
                for combined, rules in self.dyna_regexes[method]:
                    match = combined(path)
                    if match:
                        target, getargs = rules[match.lastindex - 1]
                        return target, getargs(path) if getargs else {}

        # No matching route found. Collect alternative methods for 405 response
        allowed = set([])
        nocheck = set(methods)
        for method in set(self.static) - nocheck:
            if path in self.static[method]:
                allowed.add(verb)
        for method in set(self.dyna_regexes) - allowed - nocheck:
            for combined, rules in self.dyna_regexes[method]:
                match = combined(path)
                if match:
                    allowed.add(method)
        if allowed:
            allow_header = ",".join(sorted(allowed))
            raise HTTPError(405, "Method not allowed.", Allow=allow_header)

        # No matching route and no alternative method found. We give up
        raise HTTPError(404, "Not found: " + repr(path))
688764
def _get(self, url, method, host):
        
        url = unquote(host + url)
        # Check against known static routes
        route = self.routes_static.get(url)
        method_not_supported = MethodNotSupported(
            "Method {} not allowed for URL {}".format(method, url),
            method=method,
            allowed_methods=self.get_supported_methods(url),
        )
        if route:
            if route.methods and method not in route.methods:
                raise method_not_supported
            match = route.pattern.match(url)
        else:
            route_found = False
            # Move on to testing all regex routes
            for route in self.routes_dynamic[url_hash(url)]:
                match = route.pattern.match(url)
                route_found |= match is not None
                # Do early method checking
                if match and method in route.methods:
                    break
            else:
                # Lastly, check against all regex routes that cannot be hashed
                for route in self.routes_always_check:
                    match = route.pattern.match(url)
                    route_found |= match is not None
                    # Do early method checking
                    if match and method in route.methods:
                        break
                else:
                    # Route was found but the methods didn't match
                    if route_found:
                        raise method_not_supported
                    raise NotFound("Requested URL {} not found".format(url))

        kwargs = {
            p.name: p.cast(value)
            for value, p in zip(match.groups(1), route.parameters)
        }
        route_handler = route.handler
        if hasattr(route_handler, "handlers"):
            route_handler = route_handler.handlers[method]
        return route_handler, [], kwargs, route.uri
304891
def get(self, params=None):
        
        return self._call('get', url=self.endpoint, params=params)
1087072
def _call(self, method, path, data=None):
    
    if is_python3():
      conn = http.client.HTTPConnection(API_HOST)
    else:
      conn = httplib.HTTPConnection(API_HOST)

    headers = {'User-Agent' : USER_AGENT}

    if data:
      headers.update( {'Content-type': 'application/x-www-form-urlencoded'} )
      conn.request(method, path, self._urlencode(data), headers)

    else:
      conn.request(method, path, None, headers)

    response = conn.getresponse()
    result   =  [response.status, self._parse_body(response.read())]
    conn.close()
    return result
391990
def _get_method(name, func):
    ""
    def method(self, *args, **kw):
        return func(self, *args, **kw)
    method.__name__ = name
    return method
945373
def routeargs(path, host = None, vhost = None, method = [b'POST'], **kwargs):
        ""
        def decorator(func):
            func.routemode = 'routeargs'
            func.route_path = path
            func.route_host = host
            func.route_vhost = vhost
            func.route_method = method
            func.route_kwargs = kwargs
            return func
        return decorator
72957
def find_route_by_view_name(self, view_name):
        
        if not view_name:
            return (None, None)

        for uri, route in self.routes_all.items():
            if route.name == view_name:
                return uri, route

        return (None, None)
647286
def dispatch_request(self):
        """"""

        req = _request_ctx_stack.top.request
        app = current_app

        # Return flask's default options response. See issue #40
        if req.method == "OPTIONS":
            return app.make_default_options_response()

        if req.routing_exception is not None:
            app.raise_routing_exception(req)

        # The routing rule has some handy attributes to extract how Flask found
        # this endpoint
        rule = req.url_rule

        # Wrap the real view_func
        view_func = self.wrap_view_func(
            app, rule, req, app.view_functions[rule.endpoint], req.view_args
        )

        return view_func(**req.view_args)
861452
def get_method(self, call, *args, **kwargs):
        
        method_class = self.registry.get(call.action, call.version)
        method = method_class(*args, **kwargs)
        if not method.is_available():
            raise APIError(400, "InvalidAction", "The action %s is not "
                           "valid for this web service." % call.action)
        else:
            return method
689708
function getMethod(methodname) {
  if (controllers[methodname]) {
    return function(call, callback) {
      console.log(call);
      return controllers[methodname](call, callback);
    };
  } else {
    return function(call, callback) {
      // By default we print an empty response.
      callback(null, {});
    };
  }
}
710785
def get_url(route_name, id = nil, engine = Rails.application)
      return route_name.call if id.nil?
      return route_name.call(id) unless id.nil?
    end
64920
private function checkMethod() {
        if (strpos(self::$currentRoute['method'], '|') !== false) {
            if (!in_array($_SERVER['REQUEST_METHOD'], explode('|', self::$currentRoute['method']))) {
                throw new RouteException(_message(ExceptionMessages::INCORRECT_METHOD, $_SERVER['REQUEST_METHOD']));
            }
        } else if ($_SERVER['REQUEST_METHOD'] != self::$currentRoute['method']) {
            throw new RouteException(_message(ExceptionMessages::INCORRECT_METHOD, $_SERVER['REQUEST_METHOD']));
        }
    }