Get the list of individual relations leading to the targeted node

        Args:
            goal (str): Name of the targeted node
        Return:
            list of tuple of Node
435447
def steps(self, goal):
        

        path = self.path(goal)
        for i in range(len(path) - 1):
            yield path[i], path[i + 1]
13912
def resolve(self):
        
        values = {}
        for target_name in self.target_names:
            if self.context.is_build_needed(self.parent, target_name):
                self.context.build_task(target_name)

            if len(self.keyword_chain) == 0:
                values[target_name] = self.context.tasks[target_name].value
            else:
                values[target_name] = reduce(
                    lambda task, name: getattr(task, name),
                    self.keyword_chain,
                    self.context.tasks[target_name].task)
        return self.function(**values)
1005590
def list_nodes(**kwargs):
    '''
    
    '''
    ret = {}

    nodes = list_nodes_full()
    for node in nodes:
        ret[node] = {}
        for prop in 'id', 'image', 'size', 'state', 'private_ips', 'public_ips':
            ret[node][prop] = nodes[node][prop]

    return ret
1126467
def get_relationship_targets(item_ids, relationships, id2rec):
    """"""
    # Requirements to use this function:
    #     1) item Terms must have been loaded with 'relationships'
    #     2) item IDs in 'item_ids' arguement must be present in id2rec
    #     3) Arg, 'relationships' must be True or an iterable
    reltgt_objs_all = set()
    for goid in item_ids:
        obj = id2rec[goid]
        for reltype, reltgt_objs_cur in obj.relationship.items():
            if relationships is True or reltype in relationships:
                reltgt_objs_all.update(reltgt_objs_cur)
    return reltgt_objs_all
807771
def _get_edges(self):
        
        idset = set([id(x) for x in self.objects])
        self.edges = set([])
        for n in self.objects:
            refset = set([id(x) for x in get_referents(n)])
            for ref in refset.intersection(idset):
                label = ''
                members = None
                if isinstance(n, dict):
                    members = n.items()
                if not members:
                    members = named_refs(n)
                for (k, v) in members:
                    if id(v) == ref:
                        label = k
                        break
                self.edges.add(_Edge(id(n), ref, label))
902294
def create_legacy_graph_tasks():
  """"""
  return [
    transitive_hydrated_targets,
    transitive_hydrated_target,
    hydrated_targets,
    hydrate_target,
    find_owners,
    hydrate_sources,
    hydrate_bundles,
    RootRule(OwnersRequest),
  ]
633112
def show_relations(self):
        '''  '''
        for src_node in self.iter_nodes():
            for relation in src_node.outgoing:
                for dst_node in src_node.outgoing[relation]:
                    print(repr(src_node.obj), '-', relation, '-', repr(dst_node.obj))
171856
def get_for_targets(self, targets):
    
    products = OrderedSet()
    for target in targets:
      products.update(self._products_by_target[target])
    return products
1326913
def all():
    
    return [goal for _, goal in sorted(Goal._goal_by_name.items()) if goal.active]
585066
def get_plan(self, nodes=None):
        
        if nodes:
            plan = self.graph.resolve_nodes(nodes)
        else:
            plan = self.graph.resolve_node()

        return plan
350331
def get_nodes(self, request, *args, **kwargs):
        
        # ListSerializerMixin.list returns a serializer object
        return (self.list(request, *args, **kwargs)).data
580288
def iter_initial_relations(self, subject_graph):
        """"""
        if self.pattern_graph.num_edges != subject_graph.num_edges:
            return # don't even try
        for pair in CustomPattern.iter_initial_relations(self, subject_graph):
            yield pair
1118667
def get_line_relative_to_node(self, target_node: ast.AST, offset: int) -> str:
        
        return self.lines[target_node.lineno - self.node.lineno + offset]
34152
private List<ODocument> getEdgesBetweenModels(String source, String target) {
        ODocument from = getModel(source);
        ODocument to = getModel(target);
        String query = "select from E where out = ? AND in = ?";
        return graph.query(new OSQLSynchQuery<ODocument>(query), from, to);
    }
1161590
def get_relationships(manager, handle_id1, handle_id2, rel_type=None, legacy=True):
    
    if rel_type:
        q = """
        MATCH (a:Node {{handle_id: {{handle_id1}}}})-[r:{rel_type}]-(b:Node {{handle_id: {{handle_id2}}}})
        RETURN collect(r) as relationships
        """.format(rel_type=rel_type)
    else:
        q = """
            MATCH (a:Node {handle_id: {handle_id1}})-[r]-(b:Node {handle_id: {handle_id2}})
            RETURN collect(r) as relationships
            """
    with manager.session as s:
        if legacy:
            relationships = s.run(q, {'handle_id1': handle_id1, 'handle_id2': handle_id2}).single()['relationships']
            return [relationship.id for relationship in relationships]
        return s.run(q, {'handle_id1': handle_id1, 'handle_id2': handle_id2}).single()['relationships']
941177
def target_names(targets):
    """"""
    names = []
    for entry in targets:
        if isinstance(entry, ast.Name):
            names.append(entry.id)
        elif isinstance(entry, ast.Tuple):
            for element in entry.elts:
                if isinstance(element, ast.Name):
                    names.append(element.id)

    return names
1037820
def nodes(self):
        
        if not hasattr(self, '_nodes'):
            base_url = "{}/{}".format(NodeBalancerConfig.api_endpoint, NodeBalancerNode.derived_url_path)
            result = self._client._get_objects(base_url, NodeBalancerNode, model=self, parent_id=(self.id, self.nodebalancer_id))

            self._set('_nodes', result)

        return self._nodes