The collection will be filtered to exclude non VoltPort connections
775188
public void queueNotification(
            final Collection<ClientInterfaceHandleManager> connections,
            final Supplier<DeferredSerialization> notification,
            final Predicate<ClientInterfaceHandleManager> wantsNotificationPredicate) {
        m_submissionQueue.offer(new Runnable() {
            @Override
            public void run() {
                for (ClientInterfaceHandleManager cihm : connections) {
                    if (!wantsNotificationPredicate.apply(cihm)) continue;
                    final Connection c = cihm.connection;

                    /*
                     * To avoid extra allocations and promotion we initially store a single event
                     * as just the event. Once we have two or more events we create a linked list
                     * and walk the list to dedupe events by identity
                     */
                    Object pendingNotifications = m_clientsPendingNotification.get(c);
                    try {
                        if (pendingNotifications == null) {
                            m_clientsPendingNotification.put(c, notification);
                        } else if (pendingNotifications instanceof Supplier) {
                            //Identity duplicate check
                            if (pendingNotifications == notification) return;
                            //Convert to a two node linked list
                            @SuppressWarnings("unchecked")
                            Node n1 = new Node((Supplier<DeferredSerialization>)pendingNotifications, null);
                            n1 = m_cachedNodes.get(n1, n1);
                            Node n2 = new Node(notification, n1);
                            n2 = m_cachedNodes.get(n2, n2);
                            m_clientsPendingNotification.put(c,  n2);
                        } else {
                            //Walk the list and check if the notification is a duplicate
                            Node head = (Node)pendingNotifications;
                            boolean dup = false;
                            while (head != null) {
                                if (head.notification == notification) {
                                    dup = true;
                                    break;
                                }
                                head = head.next;
                            }
                            //If it's a dupe, no new work
                            if (dup) continue;
                            //Otherwise replace the head of the list which is the value in the map
                            Node replacement = new Node(notification, (Node)pendingNotifications);
                            replacement = m_cachedNodes.get(replacement, replacement);
                            m_clientsPendingNotification.put(c, replacement);
                        }
                    } catch (ExecutionException e) {
                        VoltDB.crashLocalVoltDB(
                                "Unexpected exception pushing client notifications",
                                true,
                                Throwables.getRootCause(e));
                    }
                }
            }
        });
    }
1272577
def skip_connections_distance(list_a, list_b):
    """"""
    distance_matrix = np.zeros((len(list_a), len(list_b)))
    for i, a in enumerate(list_a):
        for j, b in enumerate(list_b):
            distance_matrix[i][j] = skip_connection_distance(a, b)
    return distance_matrix[linear_sum_assignment(distance_matrix)].sum() + abs(
        len(list_a) - len(list_b)
    )
1167031
private void removeConnectionCallbacks() {
        connection.removeSyncStanzaListener(messageListener);
        if (messageCollector != null) {
            messageCollector.cancel();
            messageCollector = null;
        }
    }
641862
def get_connections_by_dests(self, dests):
        ''''''
        with self._mutex:
            res = []
            for c in self.connections:
                if not c.has_port(self):
                    continue
                has_dest = False
                for d in dests:
                    if c.has_port(d):
                        has_dest = True
                        break
                if has_dest:
                    res.append(c)
            return res
78218
public static <T> Collection<T> filter(Collection<T> data, Filter<T> filter) {
        if (!Utils.isEmpty(data)) {
            Iterator<T> iterator = data.iterator();
            while (iterator.hasNext()) {
                T item = iterator.next();
                if (!filter.accept(item)) {
                    iterator.remove();
                }
            }
        }
        return data;
    }
1272143
def list_conns(self, filters=None):
        
        _, connection_list = self.handler.streamed_request("list-conns",
                                                           "list-conn", filters)
        return connection_list
309513
function (connectionName, collectionName, options, cb) {

      options = options || {};
      var connectionObject = connections[connectionName];
      var collection = connectionObject.collections[collectionName];

      // Find matching documents
      collection.delete(options, function (err, result) {
        if (err) return cb(err);
        cb(null, result);
      });
    }
789597
def exclude(self, *args, **kwargs) -> "QuerySet":
        
        return self._filter_or_exclude(negate=True, *args, **kwargs)
655703
def _filter_types(types_dict):
    # type: (Dict[FunctionKey, T]) -> Dict[FunctionKey, T]
    """"""

    def exclude(k):
        # type: (FunctionKey) -> bool
        """Exclude filter"""
        return k.path.startswith('<') or k.func_name == '<module>'

    return {k: v for k, v in iteritems(types_dict) if not exclude(k)}
618640
private static void removeNonApplicableFilters(
            Collection<EntitySpec> entitySpecs, Set<Filter> filtersCopy,
            EntitySpec entitySpec) {
        Set<EntitySpec> entitySpecsSet = new HashSet<>();
        Set<String> filterPropIds = new HashSet<>();
        String[] entitySpecPropIds = entitySpec.getPropositionIds();
        for (Iterator<Filter> itr = filtersCopy.iterator(); itr.hasNext();) {
            Filter f = itr.next();
            Arrays.addAll(filterPropIds, f.getPropositionIds());
            for (EntitySpec es : entitySpecs) {
                if (Collections.containsAny(filterPropIds,
                        es.getPropositionIds())) {
                    entitySpecsSet.add(es);
                }
            }
            if (Collections.containsAny(filterPropIds, entitySpecPropIds)) {
                return;
            }
            if (!atLeastOneInInboundReferences(entitySpecsSet, entitySpec)) {
                itr.remove();
            }
            entitySpecsSet.clear();
            filterPropIds.clear();
        }
    }
879384
def filter(self, dataset):
    """"""
    self.info('Going to filter infrequent routes in the dataset')
    for route in dataset.routes.values():
      self.filter_line(route)
545958
def dropAllCollections(self):
        """"""
        for graph_name in self.graphs:
            self.graphs[graph_name].delete()
        for collection_name in self.collections:
            # Collections whose name starts with '_' are system collections
            if not collection_name.startswith('_'):
                self[collection_name].delete()
        return
1218192
def wherein(self, fieldname, collection, negate=False):
        
        if negate:
            return self.mask([elem not in collection
                              for elem in self[fieldname]])
        else:
            return self.mask([elem in collection
                              for elem in self[fieldname]])
914187
function(connection, collection, object, cb) {
      utils.removeCircularReferences(object);
      if (cb) {
        cb(object);
      }
      return object;
    }
1266196
def filter_unmanaged_physnets(query):
    
    config = cfg.CONF.ml2_arista
    managed_physnets = config['managed_physnets']

    # Filter out ports bound to segments on physnets that we're not
    # managing
    segment_model = segment_models.NetworkSegment
    if managed_physnets:
        query = (query
                 .join_if_necessary(segment_model)
                 .filter(segment_model.physical_network.in_(
                     managed_physnets)))
    return query
402276
def FilterCollection(aff4_collection, offset, count=0, filter_value=None):
  """"""

  if offset < 0:
    raise ValueError("Offset needs to be greater than or equal to zero")

  if count < 0:
    raise ValueError("Count needs to be greater than or equal to zero")

  count = count or sys.maxsize
  if filter_value:
    index = 0
    items = []
    for item in aff4_collection.GenerateItems():
      serialized_item = item.SerializeToString()
      if re.search(re.escape(filter_value), serialized_item, re.I):
        if index >= offset:
          items.append(item)
        index += 1

        if len(items) >= count:
          break
  else:
    items = list(itertools.islice(aff4_collection.GenerateItems(offset), count))

  return items
955974
function stripConnectionHeaders(req) {
  var conn = req.getHeader("connection");
  if (typeof(conn) === 'undefined' || conn === null)
    return;

  conn.split(/\s+/g).forEach(function(header) {
    if (header.length === 0)
      return;
    req.removeHeader(header);
  });
  req.removeHeader("connection");
}