Finding peers by type

@param type type of peer
@return found peers
420740
@ObjectiveCName("findPeersWithType:")
    public Command<List<PeerSearchEntity>> findPeers(PeerSearchType type) {
        return callback -> modules.getSearchModule().findPeers(type)
                .then(v -> callback.onResult(v))
                .failure(e -> callback.onError(e));
    }
1312216
public SearchResponse searchAll(String index, String type,
            AggregationBuilder[] aggregationBuilders) {
        return searchAll(index, type, null, aggregationBuilders);
    }
1227166
public static <T extends GraphQLType> List<T> sortGraphQLTypes(Collection<T> types) {
        List<T> sorted = new ArrayList<>(types);
        sorted.sort(graphQLTypeComparator());
        return sorted;
    }
1121629
public <T> Map<String, T> findByTypeWithName(Class<T> type) {
        return applicationContext.getBeansOfType(type);
    }
155443
public boolean containsOfType(final Class<? extends Tag> type) {
	read.lock();
	try {
	    return tags.containsKey(type);
	} finally {
	    read.unlock();
	}
    }
433633
public List<Class<?>> getRawTypes(List<DomainObjectType> types) {
		List<Class<?>> resultList = new ArrayList<Class<?>>();
		for (DomainObjectType type : types) {
			resultList.add(type.getType());
		}
		return resultList;
	}
129306
public static List<Class<?>> resolveHierarchy(final Class<?> type) {
        final List<Class<?>> res = Lists.newArrayList();
        Class<?> current = type;
        while (!Object.class.equals(current) && current != null) {
            res.add(current);
            current = current.getSuperclass();
        }
        return res;
    }
782524
public int leechers() {
    int count = 0;
    for (TrackedPeer peer : this.peers.values()) {
      if (!peer.isCompleted()) {
        count++;
      }
    }
    return count;
  }
1248531
@Override
	public List<CPDefinitionLink> findByCP_T(long CProductId, String type) {
		return findByCP_T(CProductId, type, QueryUtil.ALL_POS,
			QueryUtil.ALL_POS, null);
	}
715489
public List<String> getFreeNodesForType(ResourceType type) {
    ArrayList<String> freeNodes = new ArrayList<String>();
    for (Map.Entry<String, ClusterNode> entry: nameToNode.entrySet()) {
      ClusterNode node = entry.getValue();
      synchronized (node) {
        if (!node.deleted &&
            node.getMaxCpuForType(type) > node.getAllocatedCpuForType(type)) {
          freeNodes.add(entry.getKey() + ": " + node.getFree().toString());
        }
      }
    }
    return freeNodes;
  }
1316800
public static List<CPDefinitionLink> findByCP_T(long CProductId, String type) {
		return getPersistence().findByCP_T(CProductId, type);
	}
469059
public static ConnectionType getConnectionType(byte type) {
        switch (type) {
            case TYPE_OUTBOUND:
                return OUTBOUND;
            case TYPE_OUTBOUND_CR_TO_REMOTE:
                return OUTBOUND_CR_TO_REMOTE;
            case TYPE_OUTBOUND_SR_TO_CR_REMOTE:
                return OUTBOUND_SR_TO_CR_REMOTE;

            case TYPE_INBOUND:
                return INBOUND;
            case TYPE_INBOUND_CR:
                return INBOUND_CR;

            case TYPE_INTERNAL_CR_SR:
                return INTERNAL_CR_SR;
        }

        return null;
    }
169748
def get_resources_of_type(network_id, type_id, **kwargs):
    

    nodes_with_type = db.DBSession.query(Node).join(ResourceType).filter(Node.network_id==network_id, ResourceType.type_id==type_id).all()
    links_with_type = db.DBSession.query(Link).join(ResourceType).filter(Link.network_id==network_id, ResourceType.type_id==type_id).all()
    groups_with_type = db.DBSession.query(ResourceGroup).join(ResourceType).filter(ResourceGroup.network_id==network_id, ResourceType.type_id==type_id).all()

    return nodes_with_type, links_with_type, groups_with_type
672671
public ArrayList<TcpEndpoint> peers() {
        tcp_endpoint_vector v = p.get_peers();
        int size = (int) v.size();
        ArrayList<TcpEndpoint> l = new ArrayList<>();

        for (int i = 0; i < size; i++) {
            l.add(new TcpEndpoint(v.get(i)));
        }

        return l;
    }
111130
public boolean existRunnableNodes(ResourceType type) {
    RunnableIndices r = typeToIndices.get(type);
    return r.existRunnableNodes();
  }
427566
public static List<Method> findMethods(Class<?> type,
			Class<? extends Annotation> annotation) {
		List<Method> list = new ArrayList<Method>();
		while (type != null) {
			for (Method method : type.getDeclaredMethods()) {
				if (method.getAnnotation(annotation) != null) {
					list.add(method);
				}
			}
			type = type.getSuperclass();
		}
		return list;
	}
39589
def getPeers(self):
        '''
            
        '''
        parentNode = self.parentNode
        # If no parent, no peers
        if not parentNode:
            return None

        peers = parentNode.children

        # Otherwise, get all children of parent excluding this node
        return TagCollection([peer for peer in peers if peer is not self])