Define route dependencies.
Toc content is built by querying section metadata, but those API routes may not exist at the root level.
187466
protected function registerRouteDependencies() {
		$this->frontMatterMetadata->register_routes();
		$this->backMatterMetadata->register_routes();
		$this->chapterMetadata->register_routes();
	}
535341
def gotoItem(self, path):
        
        if not path:
            return
        
        sections = nativestring(path).split('/')
        check = projex.text.underscore(sections[0])
        
        for i in range(self.uiContentsTREE.topLevelItemCount()):
            item = self.uiContentsTREE.topLevelItem(i)
            if check in (projex.text.underscore(item.text(0)), item.text(1)):
                item.gotoItem('/'.join(sections[1:]))
                break
1329117
def _constructUrl(self, route):
        """"""
        return liburls.api(
            self.options['rootUrl'],
            self.serviceName,
            self.apiVersion,
            route.rstrip('/'))
384086
def gather_meta(self):
        
        if not os.path.exists(self.paths["meta"]):
            return ""

        meta_dict = utils.yaml_load(self.paths["meta"])

        # gather the dependencies
        if meta_dict and "dependencies" in meta_dict:
            # create a simple list of each role that is a dependency
            dep_list = []

            for dependency in meta_dict["dependencies"]:
                if type(dependency) is dict:
                    dep_list.append(dependency["role"])
                else:
                    dep_list.append(dependency)

            # unique set of dependencies
            meta_dict["dependencies"] = list(set(dep_list))

            self.dependencies = meta_dict["dependencies"]
        else:
            self.dependencies = []

        return utils.file_to_string(self.paths["meta"])
569630
@SuppressWarnings("unchecked")
    protected void addRelevantProjectDependencies(Set<Artifact> artifacts) throws Exception {
        getLog().debug("Project Dependencies will be included.");

        Set<Artifact> dependencies = project.getArtifacts();
        getLog().debug("There are " + dependencies.size() + " dependencies in the project");

        // system scope dependencies are not returned by maven 2.0. See MEXEC-17
        dependencies.addAll(getAllNonTestOrProvidedScopedDependencies());

        Iterator<Artifact> iter = dependencies.iterator();
        while (iter.hasNext()) {
            Artifact classPathElement = iter.next();
            getLog().debug("Adding project dependency artifact: " + classPathElement.getArtifactId() + " to classpath");

            artifacts.add(classPathElement);
        }
    }
59765
private void gatherEvidence(Dependency dependency, final String name,
            String contents) {
        final Matcher matcher = AC_INIT_PATTERN.matcher(contents);
        if (matcher.find()) {
            dependency.addEvidence(EvidenceType.PRODUCT, name, "Package", matcher.group(1), Confidence.HIGHEST);
            dependency.addEvidence(EvidenceType.VERSION, name, "Package Version", matcher.group(2), Confidence.HIGHEST);

            if (null != matcher.group(3)) {
                dependency.addEvidence(EvidenceType.VENDOR, name, "Bug report address", matcher.group(4), Confidence.HIGH);
            }
            if (null != matcher.group(5)) {
                dependency.addEvidence(EvidenceType.PRODUCT, name, "Tarname", matcher.group(6), Confidence.HIGH);
            }
            if (null != matcher.group(7)) {
                final String url = matcher.group(8);
                if (UrlStringUtils.isUrl(url)) {
                    dependency.addEvidence(EvidenceType.VENDOR, name, "URL", url, Confidence.HIGH);
                }
            }
        }
    }
1226447
def declare_api_routes(config):
    """"""
    # The pregenerator makes sure we can generate a path using
    # request.route_path even if we don't have all the variables.
    #
    # For example, instead of having to do this:
    #     request.route_path('resource', hash=hash, ignore='')
    # it's possible to do this:
    #     request.route_path('resource', hash=hash)
    def pregenerator(path):
        # find all the variables in the path
        variables = [(s.split(':')[0], '') for s in path.split('{')[1:]]

        def wrapper(request, elements, kwargs):
            modified_kwargs = dict(variables)
            modified_kwargs.update(kwargs)
            return elements, modified_kwargs
        return wrapper

    def add_route(name, path, *args, **kwargs):
        return config.add_route(name, path, *args,
                                pregenerator=pregenerator(path), **kwargs)

    add_route('content', '/contents/{ident_hash:([^:/@.]+(@[0-9.]*[0-9]+)?)}{separator:(:?)}{page_ident_hash:([^:/@.]+(@[0-9.]*[0-9]+)?)?}{ignore:(/[^/.]*?/?)?}{ext:([.](html|json))?}')  # noqa cnxarchive.views:get_content
    add_route('resource', '/resources/{hash}{ignore:(/.*)?}')  # noqa cnxarchive.views:get_resource
    add_route('export', '/exports/{ident_hash}.{type}{ignore:(/.*)?}')  # noqa cnxarchive.views:get_export
    add_route('extras', '/extras{key:(/(featured|messages|licenses|subjects|languages))?}')  # noqa cnxarchive.views:extras
    add_route('content-extras', '/extras/{ident_hash:([^:/@.]+(@[0-9.]*[0-9]+)?)}{separator:(:?)}{page_ident_hash:([^:/@.]+(@[0-9.]*[0-9]+)?)?}')  # noqa cnxarchive.views:get_extra
    add_route('search', '/search')  # cnxarchive.views:search
    add_route('in-book-search', '/search/{ident_hash:([^:/]+)}')  # noqa cnxarchive.views:in-book-search
    add_route('in-book-search-page', '/search/{ident_hash:([^:/]+)}:{page_ident_hash}')  # noqa cnxarchive.views:in_book_search_highlighted_results
    add_route('sitemap-index', '/sitemap_index.xml')  # noqa cnxarchive.views:sitemap
    add_route('sitemap', '/sitemap-{from_id}.xml')  # noqa cnxarchive.views:sitemap
    add_route('robots', '/robots.txt')  # noqa cnxarchive.views:robots
    add_route('legacy-redirect', '/content/{objid}{ignore:(/)?}')  # noqa cnxarchive.views:redirect_legacy_content
    add_route('legacy-redirect-latest', '/content/{objid}/latest{ignore:(/)?}{filename:(.+)?}')  # noqa cnxarchive.views:redirect_legacy_content
    add_route('legacy-redirect-w-version', '/content/{objid}/{objver}{ignore:(/)?}{filename:(.+)?}')  # noqa cnxarchive.views:redirect_legacy_content
    add_route('recent', '/feeds/recent.rss')  # cnxarchive.views:recent
    add_route('oai', '/feeds/oai')  # cnxarchive.views:oai
    add_route('xpath', '/xpath.html')  # cnxarchive.views.xpath
    add_route('xpath-json', '/xpath.json')
938052
def trace_dependencies(req, requirement_set, dependencies, _visited=None):
    
    _visited = _visited or set()
    if req in _visited:
        return
    _visited.add(req)
    for reqName in req.requirements():
        try:
            name = pkg_resources.Requirement.parse(reqName).project_name
        except ValueError, e:
            logger.error('Invalid requirement: %r (%s) in requirement %s' % (
                reqName, e, req))
            continue
        subreq = requirement_set.get_requirement(name)
        dependencies.append((req, subreq))
        trace_dependencies(subreq, requirement_set, dependencies, _visited)
30752
private static List<DependencyError> checkAlwaysForbiddenSection(final Dependencies dependencies, final ClassInfo classInfo) {

        final List<DependencyError> errors = new ArrayList<DependencyError>();

        final Iterator<String> importedPackages = classInfo.getImports().iterator();
        while (importedPackages.hasNext()) {
            final String importedPackage = importedPackages.next();
            final NotDependsOn ndo = Utils.findForbiddenByName(dependencies.getAlwaysForbidden(), importedPackage);
            if (ndo != null) {
                errors.add(new DependencyError(classInfo.getName(), importedPackage, ndo.getComment()));
            }
        }

        return errors;
    }
1338858
public void initializeRelativePath(ServletRequest request, String relativeTo) 
    {
        if ( relativeTo == null )
        {
            relativeTo = _relativeTo;
        }

        if ( relativeTo == null ) return;

        assert ! relativeTo.endsWith("/") : relativeTo;
        String path = getPath();
         
        // If this is a local (relative) path, prefix it with the given 'relativeTo' path, and save a flag.
        // We save this flag in a local variable because the Forward object may be saved/restored for use again.
        if (! getContextRelative() && ! FileUtils.isAbsoluteURI(path)) {
            assert path.startsWith("/") : path;
            setPath(relativeTo + path);
            setContextRelative(true);
            _outsidePageFlowDirectory = true;
        }
        
        // Store a flag in the request that will prevent another page flow from being initialized implicitly because
        // we're hitting a path within it.  We want to stay in the context of the current page flow.
        if (_outsidePageFlowDirectory) {
            PageFlowRequestWrapper.get(request).setStayInCurrentModule(true);
        }
    }
1303597
function Headings({ toc, path }) {
    if (!toc.length) {
      return null
    }
    return (
      <ul>
        {toc.map(function(item, index) {
          const href = `${path}#${item.id}`

          return (
            <li key={index}>
              {item.children.length > 0 && (
                <input
                  id={href}
                  className="nav_toggle"
                  type="checkbox"
                  defaultChecked={false}
                />
              )}
              <a
                className={`nav_toggle-label nav_item-name nav_sublink
                  ${item.children.length ? '' : 'nav_childless'}`}
                href={href}
              >
                {item.title}
              </a>
              <Headings toc={item.children} path={path} />
            </li>
          )
        })}
      </ul>
    )
  }
1096202
function routeFromRel (route, rel) {
    // if rel is empty string then this is route
    if (rel.length === 0) {
        // set root flag on route
        route.root = true
        // return route
        return route
    }
    // if rel is above root this is error
    assert.ok(!rel.match(/^\./), 'relative path above app root: '+rel)
    // split rel into directories
    var dirs = rel.split('/')
    // get next route node for each dir in rel path
    _.each(dirs, dir => {
        // create sub node if it does not exists
        if (!route.routes) {
            route.routes = {}
        }
        // create new entry for dir if it does not exist
        if (!route.routes[dir]) {
            route.routes[dir] = {}
        }
        // switch context
        route = route.routes[dir]
    })
    // return resolved route
    return route
}
24261
private String collectDependenciesWithoutDefinedManager(String rootDirectory, List<DependencyInfo> dependencyInfos){
        String error = null;
        try {
            collectDepDependencies(rootDirectory, dependencyInfos);
            goDependencyManager = GoDependencyManager.DEP;
        } catch (Exception e){
            try {
                collectGoDepDependencies(rootDirectory, dependencyInfos);
                goDependencyManager = GoDependencyManager.GO_DEP;
            } catch (Exception e1){
                try {
                    collectVndrDependencies(rootDirectory, dependencyInfos);
                    goDependencyManager = GoDependencyManager.VNDR;
                } catch (Exception e2) {
                    try {
                        collectGoGradleDependencies(rootDirectory, dependencyInfos);
                        goDependencyManager = GoDependencyManager.GO_GRADLE;
                    } catch (Exception e3) {
                        try {
                            collectGlideDependencies(rootDirectory, dependencyInfos);
                            goDependencyManager = GoDependencyManager.GLIDE;
                        } catch (Exception e4) {
                            try {
                                collectGoVendorDependencies(rootDirectory, dependencyInfos);
                                goDependencyManager = GoDependencyManager.GO_VENDOR;
                            } catch (Exception e5) {
                                try {
                                    collectGoPMDependencies(rootDirectory, dependencyInfos);
                                    goDependencyManager = GoDependencyManager.GOPM;
                                } catch (Exception e6) {
                                    error = "Couldn't collect dependencies - no dependency manager is installed";
                                }
                            }
                        }
                    }
                }
            }
        }
        return error;
    }
487757
function makePath(to, params, query) {
        var path;
        if (PathUtils.isAbsolute(to)) {
          path = to;
        } else {
          var route = to instanceof Route ? to : Router.namedRoutes[to];

          invariant(route instanceof Route, 'Cannot find a route named "%s"', to);

          path = route.path;
        }

        return PathUtils.withQuery(PathUtils.injectParams(path, params), query);
      }
1119430
private boolean getPodsAndDependenciesSection(List<String> directDependenciesLines, List<String> allDependenciesLines, String podFileLock) {
        boolean successReadPodfile = true;
        boolean podsSection = false;
        boolean dependenciesSection = false;
        try (BufferedReader br = new BufferedReader(new FileReader(podFileLock))) {
            String line;
            logger.debug("The content of Podfile.lock - {}:", podFileLock);
            while ((line = br.readLine()) != null) {
                logger.debug(line);
                if (line.startsWith(PODS)) {
                    dependenciesSection = false;
                    podsSection = true;
                } else if (line.startsWith(DEPENDENCIES)) {
                    podsSection = false;
                    dependenciesSection = true;
                } else if (line.trim().equals(Constants.EMPTY_STRING)) {
                    podsSection = false;
                    dependenciesSection = false;
                } else if (podsSection) {
                    allDependenciesLines.add(line);
                } else if (dependenciesSection) {
                    directDependenciesLines.add(line);
                }
            }
        } catch (IOException e) {
            logger.warn("Couldn't read the Podfile.lock: {}", podFileLock);
            successReadPodfile = false;
        }
        return successReadPodfile;
    }
196016
public function mapRoute2Toc($route, $toc)
    {
        if (key_exists($route, $toc)) {
            return $route;
        } elseif (key_exists($route . "/index", $toc)) {
            return $route . "/index";
        }

        throw new \Anax\Exception\NotFoundException(t('The page does not exists.'));
    }
1004475
function appendDependency( $dependencySection, $parameters )
    {
        if ( !in_array( $dependencySection,
                        array( 'provides', 'requires',
                               'obsoletes', 'conflicts' ) ) )
            return false;

        $this->Parameters['dependencies'][$dependencySection][] = $parameters;
    }