Return a pretty formatted string of the list of routes.
510325
def fmt_routes(bottle_app):
    """"""
    routes = [(r.method, r.rule) for r in bottle_app.routes]
    if not routes:
        return
    string = 'Routes:\n'
    string += fmt_pairs(routes, sort_key=operator.itemgetter(1))
    return string
443483
def pretty_relpath(path, start):
    '''
    
    '''
    relpath = os.path.relpath(path, start)
    if relpath.startswith('..'):
        return path
    return relpath
1368481
def flask_paths(self):
        
        paths = {}
        for url_path, handler in self.url_paths.items():
            url_path = convert_regex_to_flask_path(url_path)
            paths[url_path] = handler

        return paths
737069
def ToDebugString(self):
    """"""
    text_parts = ['Path segment index\tPath segments(s)']
    for index, path_segments in self.path_segments_per_index.items():
      text_parts.append('{0:d}\t\t\t[{1:s}]'.format(
          index, ', '.join(path_segments)))

    text_parts.append('')

    return '\n'.join(text_parts)
1203749
private function getHypertextString($routes = [])
    {
        // Check if we have routes
        if (!$routes) {
            return '';
        }

        // Loop through the routes and add them to the string
        $str = "links: \n";
        foreach ($routes as $name => $route) {
            $str .= "\trel: {$name}. href: {$route}.\n";
        }
        return $str;
    }
808688
def prettifysql(sql):
    """"""
    pretty = []
    for line in sql.split('\n'):
        pretty.extend(["%s,\n" % x for x in line.split(',')])
    return pretty
975937
def pretty(self, indent=0, indent_str='  '):
        
        return '{0}{1}({2!r}): {3!r}'.format(
            indent_str * indent,
            self.__class__.__name__,
            self.name,
            self.value
        )
1102653
def pretty_list(list)
      center = nil
      list.map.with_index do |c, idx|
        next center = Helper.color('[self]', sev: :bin) if c == @base

        color_c = Helper.color(format('%#x', c))
        fwd = fd_of(c)
        next "#{color_c}(invalid)" if fwd.nil? # invalid c

        bck = bk_of(c)
        if center.nil? # bk side
          format('%s%s', color_c, fwd == list[idx + 1] ? nil : Helper.color(format('(%#x)', fwd)))
        else # fd side
          format('%s%s', bck == list[idx - 1] ? nil : Helper.color(format('(%#x)', bck)), color_c)
        end
      end.join(' === ')
    end
480028
@GET
    public List<String> getRoutes() {
        List<Resource> resourceList = resourceContext.getResourceModel().getResources();
        List<String> routeList = Lists.newArrayList();
        for (Resource resource : resourceList) {
            String path = resource.getPath().startsWith("/") ? "" : "/" + resource.getPath();
            if (resource.getAllMethods().size() > 0) {
                routeList.add(path);
            }
            routeList.addAll(
                    resource.getChildResources()
                            .stream()
                            .map(res -> path + (res.getPath().startsWith("/") ? "" : "/") + res.getPath())
                            .collect(Collectors.toList())
            );
        }
        return routeList;
    }
676834
def as_lines(self):
        """"""

        out_lines = []
        for t,v in self.lines:

            # Make the output prettier
            if t == 'Section':
                out_lines.append('')

            out_lines.append('{}: {}'.format(t,v if v is not None else '') )

        return '\n'.join(out_lines)
781706
private function getHypertextHtml($routes = [])
    {
        // Check if we have routes
        if (!$routes) {
            return '';
        }

        // Create the html table
        $html = "<table style=\"border: 1px solid black;\">\n";

        // Loop through the routes and add them as rows to the table
        foreach ($routes as $name => $route) {
            $html .= "<tr>\n";
            $html .= "<td style=\"border: 1px solid black;\">rel: {$name}</td>\n";
            $html .= "<td style=\"border: 1px solid black;\">href: {$route}</td>\n";
            $html .= "</tr>\n";
        }
        $html .= "</table>\n";

        return $html;
    }
1123365
def routing(routes, request):
    """"""

    # strip trailing slashes from request path
    path = request.path.strip('/')

    # iterate through routes to match
    args = {}
    for name, route in routes.items():
        if route['path'] == '^':
            # this section exists because regex doesn't work for null character as desired
            if path == '':
                match = [True]
            else:
                match = []
        else:
            match = re.findall(route['path'], path)
        
        if match:
            # found the matching url, iterate through variables to pass data
            # check if method exists
            if not request.method in route['method']:
                raise TornMethodNotAllowed
            
            values = match[0] # in form of tuples
            if type(values) != bool:
                for i in range(len(route['variables'])):
                    # if value is blank, check if default exists and pass it instead
                    if type(values) == str:
                        args[route['variables'][i]] = values
                    else:
                        if not values[i] and route['variables'][i] in route['defaults']:
                            values[i] = route['defaults'][route['variables'][i]]
                        args[route['variables'][i]] = values[i]
            
            # we have the variables we need, args, path, controller
            return {
                'kwargs'        : args,
                'controller'    : route['controller']
            }
    raise TornNotFoundError
659541
def _get_route_info(self, request):
        """"""
        resolve_match = resolve(request.path)

        app_name = resolve_match.app_name    # The application namespace for the URL pattern that matches the URL.
        namespace = resolve_match.namespace  # The instance namespace for the URL pattern that matches the URL.
        url_name = resolve_match.url_name    # The name of the URL pattern that matches the URL.
        view_name = resolve_match.view_name  # Name of the view that matches the URL, incl. namespace if there's one.

        return {
            "app_name": app_name or None,
            "namespace": namespace or None,
            "url_name": url_name or None,
            "view_name": view_name or None,
        }
1249338
public String generateJSON(Collection<Route> routes) {
        Swagger swagger = build(routes);
        String json = Json.pretty(swagger);
        return json;
    }
4648
def formatted(self):
        """"""
        return ' '.join(self.compact[i:i + 4] for i in range(0, len(self.compact), 4))
875383
function describeRoute(route) {
		var host = route.Host;
		var domain = route.DomainName;
		var apps = route.Apps;
		var appsNum = route.Apps.length;

		var strResult = "\n" + host + "\t" + domain;

		if(appsNum != 0){
			strResult += "\t" + route.Apps[0].Name;
			if(appsNum > 1){
				for(var i = 1; i < appsNum; i++){
					strResult += ", " + route.Apps[i].Name;
				}
			}
		}
		return strResult;
	}
329856
def get_urlpatterns(self):
        
        return [
            path('', self.index_view.as_view(), name='index'),
            path(
                _('forum/<str:slug>-<int:pk>/'),
                self.forum_view.as_view(),
                name='forum',
            ),
        ]