Retrieve component and subcomponent indexes from the given traversal path
        (e.g. PID_1_2 -> component=2, subcomponent=None)
429875
def _get_traversal_children(self, name):
        
        name = name.upper()
        parts = name.split('_')
        try:
            assert 3 <= len(parts) <= 4
            prefix = "{0}_{1}".format(parts[0], parts[1])
            component = int(parts[2])
            subcomponent = int(parts[3]) if len(parts) == 4 else None
        except (AssertionError, ValueError):
            return None, None
        else:
            if prefix != self.name:
                return None, None
        return component, subcomponent
1119099
def PathToComponents(path):
  
  precondition.AssertType(path, Text)
  if path and not path.startswith("/"):
    raise ValueError("Path '{}' is not absolute".format(path))

  if path:
    return tuple(path.split("/")[1:])
  else:
    return ()
744172
@Override
	public List<Component> findComponentChildren( String applicationName, String componentName ) {

		if( componentName == null )
			this.logger.fine( "Request: list root components in " + applicationName + "." );
		else
			this.logger.fine( "Request: find components that can be deployed under a " + componentName + " component in " + applicationName + "." );

		List<Component> result = new ArrayList<> ();
		Application app = this.manager.applicationMngr().findApplicationByName( applicationName );
		if( app != null ) {
			Component comp;
			if( componentName == null )
				result.addAll( app.getTemplate().getGraphs().getRootComponents());
			else if(( comp = ComponentHelpers.findComponent( app, componentName )) != null )
				result.addAll( ComponentHelpers.findAllChildren( comp ));
			else
				this.logger.fine( "No component called " + componentName + " was found in " + applicationName + "." );
		}

		return result;
	}
507586
public List<IntArrayList> findComponents() {
        int nodes = graph.getNodes();
        for (int start = 0; start < nodes; start++) {
            if (nodeIndex[start] == 0
                    && !ignoreSet.contains(start)
                    && !graph.isNodeRemoved(start))
                strongConnect(start);
        }

        return components;
    }
585302
def split_path(path):
        
        components = list()
        while path:
            next = win32.PathFindNextComponent(path)
            if next:
                prev = path[ : -len(next) ]
                components.append(prev)
            path = next
        return components
1284013
def components(self) -> List['DAGCircuit']:
        """"""
        comps = nx.weakly_connected_component_subgraphs(self.graph)
        return [DAGCircuit(comp) for comp in comps]
1240139
def _get_components(self):
        
        return tuple([self._getitem__components(i) for
                     i in range(self._len__components())])
1305407
def source_components(self):
        
        raw_sccs = self._component_graph()

        # Construct a dictionary mapping each vertex to the root of its scc.
        vertex_to_root = self.vertex_dict()

        # And keep track of which SCCs have incoming edges.
        non_sources = self.vertex_set()

        # Build maps from vertices to roots, and identify the sccs that *are*
        # reachable from other components.
        for scc in raw_sccs:
            root = scc[0][1]
            for item_type, w in scc:
                if item_type == 'VERTEX':
                    vertex_to_root[w] = root
                elif item_type == 'EDGE':
                    non_sources.add(vertex_to_root[w])

        sccs = []
        for raw_scc in raw_sccs:
            root = raw_scc[0][1]
            if root not in non_sources:
                sccs.append([v for vtype, v in raw_scc if vtype == 'VERTEX'])

        return [self.full_subgraph(scc) for scc in sccs]
227883
def getComponent(self, innerFlag=False):
        
        if self._currentIdx is None:
            raise error.PyAsn1Error('Component not chosen')
        else:
            c = self._componentValues[self._currentIdx]
            if innerFlag and isinstance(c, Choice):
                return c.getComponent(innerFlag)
            else:
                return c
1261424
function getRoutes(feature) {
  const targetPath = `src/features/${feature}/route.js`; //utils.mapFeatureFile(feature, 'route.js');
  if (vio.fileNotExists(targetPath)) return [];
  const theAst = ast.getAst(targetPath);
  const arr = [];
  let rootPath = '';
  let indexRoute = null;

  traverse(theAst, {
    ObjectExpression(path) {
      const node = path.node;
      const props = node.properties;
      if (!props.length) return;
      const obj = {};
      props.forEach(p => {
        if (_.has(p, 'key.name') && !p.computed) {
          obj[p.key.name] = p;
        }
      });
      if (obj.path && obj.component) {
        // in a route config, if an object expression has both 'path' and 'component' property, then it's a route config
        arr.push({
          path: _.get(obj.path, 'value.value'), // only string literal supported
          component: _.get(obj.component, 'value.name'), // only identifier supported
          isIndex: !!obj.isIndex && _.get(obj.isIndex, 'value.value'), // suppose to be boolean
          node: {
            start: node.start,
            end: node.end,
          },
        });
      }
      if (obj.isIndex && obj.component && !indexRoute) {
        // only find the first index route
        indexRoute = {
          component: _.get(obj.component, 'value.name'),
        };
      }
      if (obj.path && obj.childRoutes && !rootPath) {
        rootPath = _.get(obj.path, 'value.value');
        if (!rootPath) rootPath = '$none'; // only find the first rootPath
      }
    },
  });
  const prjRootPath = getRootRoutePath();
  if (rootPath === '$none') rootPath = prjRootPath;
  else if (!/^\//.test(rootPath)) rootPath = prjRootPath + '/' + rootPath;
  rootPath = rootPath.replace(/\/+/, '/');
  arr.forEach(item => {
    if (!/^\//.test(item.path)) {
      item.path = (rootPath + '/' + item.path).replace(/\/+/, '/');
    }
  });
  if (indexRoute) {
    indexRoute.path = rootPath;
    arr.unshift(indexRoute);
  }
  return arr;
}
322741
def ListDescendentPathInfos(self,
                              client_id,
                              path_type,
                              components,
                              timestamp=None,
                              max_depth=None):
    """"""
    result = []

    for path_idx, path_record in iteritems(self.path_records):
      other_client_id, other_path_type, other_components = path_idx
      if client_id != other_client_id or path_type != other_path_type:
        continue
      if len(other_components) == len(components):
        continue
      if not collection.StartsWith(other_components, components):
        continue
      if (max_depth is not None and
          len(other_components) - len(components) > max_depth):
        continue

      result.append(path_record.GetPathInfo(timestamp=timestamp))

    if timestamp is None:
      return sorted(result, key=lambda _: tuple(_.components))

    # We need to filter implicit path infos if specific timestamp is given.

    # TODO(hanuszczak): If we were to switch to use path trie instead of storing
    # records by path id, everything would be much easier.

    class TrieNode(object):
      """A trie of path components with path infos as values."""

      def __init__(self):
        self.path_info = None
        self.children = {}
        self.explicit = False

      def Add(self, path_info, idx=0):
        """Adds given path info to the trie (or one of its subtrees)."""
        components = path_info.components
        if idx == len(components):
          self.path_info = path_info
          self.explicit |= (
              path_info.HasField("stat_entry") or
              path_info.HasField("hash_entry"))
        else:
          child = self.children.setdefault(components[idx], TrieNode())
          child.Add(path_info, idx=idx + 1)
          self.explicit |= child.explicit

      def Collect(self, path_infos):
        if self.path_info is not None and self.explicit:
          path_infos.append(self.path_info)

        for component in sorted(iterkeys(self.children)):
          self.children[component].Collect(path_infos)

    trie = TrieNode()
    for path_info in result:
      trie.Add(path_info)

    explicit_path_infos = []
    trie.Collect(explicit_path_infos)
    return explicit_path_infos
992191
def get_components(self, root='C', visible=False):
        
        root_val = note_to_val(root)
        components = [v + root_val for v in self.components]

        if visible:
            components = [val_to_note(c, scale=root) for c in components]

        return components
1078076
def connected_components(graph):
    
    recursionlimit = getrecursionlimit()
    setrecursionlimit(max(len(graph.nodes())*2,recursionlimit))
    
    visited = {}
    count = 1

    # For 'each' node not found to belong to a connected component, find its connected
    # component.
    for each in graph:
        if (each not in visited):
            _dfs(graph, visited, count, each)
            count = count + 1
    
    setrecursionlimit(recursionlimit)
    return visited
876741
def _get_properties(path="", method="GET", forced_params=None):
    '''
    
    '''
    if api is None:
        _import_api()

    sub = api
    path_levels = [level for level in path.split('/') if level != '']
    search_path = ''
    props = []
    parameters = set([] if forced_params is None else forced_params)
    # Browse all path elements but last
    for elem in path_levels[:-1]:
        search_path += '/' + elem
        # Lookup for a dictionary with path = "requested path" in list" and return its children
        sub = (item for item in sub if item["path"] == search_path).next()['children']
    # Get leaf element in path
    search_path += '/' + path_levels[-1]
    sub = next((item for item in sub if item["path"] == search_path))
    try:
        # get list of properties for requested method
        props = sub['info'][method]['parameters']['properties'].keys()
    except KeyError as exc:
        log.error('method not found: "%s"', exc)
    for prop in props:
        numerical = re.match(r'(\w+)\[n\]', prop)
        # generate (arbitrarily) 10 properties for duplicatable properties identified by:
        # "prop[n]"
        if numerical:
            for i in range(10):
                parameters.add(numerical.group(1) + six.text_type(i))
        else:
            parameters.add(prop)
    return parameters
256788
function findAddressComponent(components, type) {
  for (var i = 0; i < components.length; i++) {
    if (components[i].types.indexOf(type) > -1) {
      return components[i];
    }
  }

  return null;
}
222493
private Map<String, Component> getComponents(JsonNode componentsNode) {
        Iterator<JsonNode> it = componentsNode.iterator();
        Map<String, Component> components = Maps.newHashMap();

        while(it.hasNext()){
            JsonNode componentNode = it.next();
            JsonNode pathNode = componentNode.path("path");
            JsonNode moduleNode = componentNode.path("moduleKey");
            components.put(componentNode.path("key").asText(),
                    new Component(pathNode.asText(), moduleNode.isMissingNode()?null:moduleNode.asText()));
        }

        return components;
    }
252262
def _indices(self):
        """"""
        path = self.parent
        layer = path.parent
        for path_index in range(len(layer.paths)):
            if path == layer.paths[path_index]:
                for node_index in range(len(path.nodes)):
                    if self == path.nodes[node_index]:
                        return Point(path_index, node_index)
        return None