Equals :meth:`route`.
354308
def get(self, path=None, method='GET', **options):
        
        return self.route(path, method, **options)
45552
def get_working_if():
    """"""
    try:
        # return the interface associated with the route with smallest
        # mask (route by default if it exists)
        iface = min(conf.route.routes, key=lambda x: x[1])[3]
    except ValueError:
        # no route
        iface = scapy.consts.LOOPBACK_INTERFACE
    if iface.is_invalid():
        # Backup mode: try them all
        for iface in six.itervalues(IFACES):
            if not iface.is_invalid():
                return iface
        return None
    return iface
1303990
function Route(path,content,operation){
	if(typeof(path) === 'string'){
		if(path === '*') path = '.*';
		path = new RegExp(path);
	}
	if(typeof(content) === 'string'){
		if(content === '*') content = '.*';
		content = new RegExp(content);
	}
	this.path = path;
	this.content = content;
	this.operation = operation;
}
615145
public Route matchRoute(String url) {
        if (hashRoute.containsKey(url)) {
            return new Route(hashRoute.get(url).get(0), null);
        }

        for (RegexRoute route : regexRoute) {
            Matcher matcher = route.getPattern().matcher(url);
            if (matcher.matches()) {
                return new Route(route, matcher);
            }
        }
        return null;
    }
999623
function normalize(route) {
  const normalized = { ...route };

  if (is.not.array(normalized.path) && is.not.string(normalized.path)) {
    throw new Error("The route's path must be a String or [String]");
  }

  if (is.array(normalized.method)) {
    /* If method is an array */
    for (let method of normalized.method) {
      method = clean(method);
    }
  }

  /* If method is a string */
  if (is.string(normalized.method)) {
    normalized.method = clean(normalized.method);
  }

  return normalized;
}
805677
def get_routes(iface):
    '''
    
    '''

    filename = os.path.join(_DEB_NETWORK_UP_DIR, 'route-{0}'.format(iface))
    results = _read_file(filename)

    filename = os.path.join(_DEB_NETWORK_DOWN_DIR, 'route-{0}'.format(iface))
    results += _read_file(filename)

    return results
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
1071736
def setup_versioned_routes(routes, version=None):
    """"""
    prefix = '/' + version if version else ""
    for r in routes:
        path, method = r
        route(prefix + path, method, routes[r])
142994
def copy(self, **params):
        ''''''
        new_params = dict()
        for name in ['owner', 'priority', 'key', 'final']:
            new_params[name] = params.get(name, getattr(self, name))
        return Route(**new_params)
267465
def matches(self, request):
        
        return (
            partial_path_match(request.path_info, self.path) and
            request.method == self.method
        )
1341201
def score_route(parts, path)
      score = 0
      pars  = {}

      if parts.length == path.length
        parts.each_with_index do |part, i|
          if part[0] == ':'
            score += 1
            pars["#{part[1..-1]}"] = path[i]
          elsif part == path[i].downcase
            score += 2
          end
        end
      end

      return score, pars
    end
176695
function(route, args) {
        var index;

        // There is a requirement for this route.
        if (typeof(self.routes[route].requirements) != 'undefined') {
            // For each arguments.
            for (index in args) {
                // If there is a requirement.
                if (self.routes[route].requirements[index] != null) {
                    // Check if it is fulfilled.
                    var regTest = (new RegExp(self.routes[route].requirements[index]));
                    // If not, replace data with :argument.
                    if (!regTest.test(args[index])) {
                        args[index] = ':' + index
                    }
                }
            }
        }
        return args
    }
884006
function Router(req, res, next) {
        const server = this;
        const state = {
            method: req.method.toUpperCase(),
            params: {},
            routes: routes.concat(),
            routeUnhandled: true,
            server: server,
        };
        run(state, req, res, err => {
            req.params = {};
            if (state.routeUnhandled) req.log('unhandled', 'Router had no matching paths');
            next(err);
        });
    }
731948
function adaptForRouter(val, key) {
  key = key.split(/\s+/);
  if (typeof val === 'string' || typeof val === 'function' || Array.isArray(val)) {
    val = {
      path: key[0],
      method: key[1],
      controller: val
    };
  } else if (typeof val === 'object') {
    if (!val.path) {
      val.path = key[0];
    }
    if (!val.method) {
      val.method = key[1];
    }
  } else {
    throw new Error(`Problem with route "${key}"`);
  }
  return val;
}
39282
def route!(base = settings, pass_block=nil)
      if routes = base.routes[@request.request_method]
        routes.each do |pattern, keys, conditions, block|
          pass_block = process_route(pattern, keys, conditions) do |*args|
            route_eval { block[*args] }
          end
        end
      end

      # Run routes defined in superclass.
      if base.superclass.respond_to?(:routes)
        return route!(base.superclass, pass_block)
      end

      route_eval(&pass_block) if pass_block
      route_missing
    end
335930
def route(method, path)
      method_routes = self.routes.find_all{|x| x.method == method}
      method_routes.each do |route|
        if route.path =~ WILDCARD_PATTERN
          src = "\\A#{route.path.gsub('*','(.*)')}\\Z"
          if match = path.match(Regexp.new(src))
            return [route, match[1].split('/')]
          end
        elsif route.path =~ NAMED_SEGMENTS_PATTERN
          src = "\\A#{route.path.gsub(NAMED_SEGMENTS_REPLACEMENT_PATTERN, '/(?<\1>[^$/]+)')}\\Z"
          if match = path.match(Regexp.new(src))
            return [route, Hash[match.names.zip(match.captures)]]
          end
        elsif path == route.path
          return [route]
        end
      end
      nil
    end
722773
def map ref,route, options={}
      context = Context.collection[get_context]
      context.routes[ref]= Route.new(route, context,options)
    end