check if a feed is available from a peer apart from ignore_id
2337
function isAvailable(state, feed_id, ignore_id) {
  for(var peer_id in state.peers) {
    if(peer_id != ignore_id) {
      var peer = state.peers[peer_id]
      //BLOCK: check wether id has blocked this peer
      if((peer.clock && peer.clock[feed_id] || 0) > (state.clock[feed_id] || 0) && isShared(state, feed_id, peer_id)) {
        return true
      }
    }
  }
}
852744
def can_ignore_error(self, reqhnd=None):
        
        value = sys.exc_info()[1]
        try:
            if isinstance(value, BrokenPipeError) or \
                    isinstance(value, ConnectionResetError):
                return True
        except NameError:
            pass
        if not self.done:
            return False
        if not isinstance(value, socket.error):
            return False
        need_close = value.errno == 9
        if need_close and reqhnd is not None:
            reqhnd.close_connection = 1
        return need_close
1319002
def check(self, datas, *filers):
        '''
            
        '''
        # special case : no filter : want to read all the feed
        if self.match == "" and self.does_not_match == '':
            yield datas
        # let's filtering :
        else:
            condition1 = False
            condition2 = False
            # arg contain the property from which we want to check the 'data'
            for prop in filers:
                # check if my datas contains my property
                if prop in datas:
                    # filter to find only this data
                    if self.match != '' and condition1 is False:
                        condition1 = self.filter_that(self.match,
                                                      datas[prop])
                    # filter to exclude this data,
                    # when found, continue to the next entry
                    if self.does_not_match != '' and condition2 is False:
                        condition2 = self.filter_that(self.does_not_match,
                                                      datas[prop])
                        if condition2:
                            continue
        if condition1 and condition2 is False:
            yield datas
586429
def idSet(peer)
      @peersById.each do |e| 
        return if e.eql?(peer)
      end
      @peersById.pushToList(peer.trackerPeer.id, peer)
    end
1263055
def get_cached(self):
        
        def id_in_list(list, id):
            if id:
                if [i for i in list if i.id == id]:
                    return True
                else:
                    raise PyPumpException("id %r not in feed." % self._since)

        tmp = []
        if self._before is not None:
            # return list based on before param
            if not id_in_list(self.feed._items, self._before):
                return tmp
            if isinstance(self._before, six.string_types):
                found = False
                for i in self.feed._items:
                    if not found:
                        if i.id == self._before:
                            found = True
                        continue
                    else:
                        tmp.append(i)
                self._before = False
            return tmp

        if self._since is not None:
            # return list based on since param
            if not id_in_list(self.feed._items, self._since):
                return tmp
            if isinstance(self._since, six.string_types):
                found = False
                for i in self.feed._items:
                    if i.id == self._since:
                        found = True
                        break
                    else:
                        tmp.append(i)
                self._since = False
            return reversed(tmp)

        if not hasattr(self, 'usedcache'):
            self.usedcache = True  # invalidate cache

            if isinstance(self._offset, int):
                # return list based on offset
                return self.feed._items[self._offset:]

            return self.feed._items
        else:
            return tmp
745646
def feed_parser(self, data):
        """"""
        assert isinstance(data, bytes)
        self.controller.feed_parser(data)
876265
def wherenotin(self, fieldname, value):
        
        return self.wherein(fieldname, value, negate=True)
1339273
def _should_ignore(self, path):
        
        for ignore in self.options.ignores:
            if fnmatch.fnmatch(path, ignore):
                return True
        return False
978781
def exists(self):
        
        try:
            queue = self.queue
            queue.queue_declare(passive=True)
        except NotFound:
            return False
        except ChannelError as e:
            if e.reply_code == '404':
                return False
            raise e
        return True
1207563
def get_atom_feed_entry(self, feedentry_id):
        
        return self.session.query(self.feedentry_model).filter(
            self.feedentry_model.id == feedentry_id
        ).one()
734328
def is_ignored(resource):
    ''''''
    ignored_domains = current_app.config['LINKCHECKING_IGNORE_DOMAINS']
    url = resource.url
    if url:
        parsed_url = urlparse(url)
        return parsed_url.netloc in ignored_domains
    return True
333467
def connected(self, node_id):
        """"""
        conn = self._conns.get(node_id)
        if conn is None:
            return False
        return conn.connected()
448273
void synchronizeFromFollower(String peerId)
      throws IOException, TimeoutException, InterruptedException {
    LOG.debug("Begins synchronizing from follower {}.", peerId);
    Zxid lastZxid = persistence.getLatestZxid();
    Message pullTxn = MessageBuilder.buildPullTxnReq(lastZxid);
    LOG.debug("Last zxid of {} is {}", this.serverId, lastZxid);
    sendMessage(peerId, pullTxn);
    // Waits until the synchronization is finished.
    waitForSync(peerId);
  }
957043
async def filter_new_posts(self, source_id, post_ids):
        """"""
        new_ids = []
        try:
            db_client = self._db
            posts_in_db = await db_client.get_known_posts(source_id, post_ids)
            new_ids = [p for p in post_ids if p not in posts_in_db]
        except Exception as exc:
            logger.error("Error when filtering for new posts {} {}".format(source_id, post_ids))
            logger.exception(exc)
        return new_ids
1285217
def ignores(self, *args):
        
        for event in args:
            self._ignored.add(event.name)
1310795
def clean(feed: "Feed") -> "Feed":
    
    feed = feed.copy()
    ops = [
        "clean_ids",
        "clean_times",
        "clean_route_short_names",
        "drop_zombies",
    ]
    for op in ops:
        feed = globals()[op](feed)

    return feed
1297435
def feed(self, data_len, feed_time=None):
        '''
        '''
        self._bytes_transferred += data_len
        self._collected_bytes_transferred += data_len

        time_now = feed_time or time.time()
        time_diff = time_now - self._last_feed_time

        if time_diff < self._sample_min_time:
            return

        self._last_feed_time = time.time()

        if data_len == 0 and time_diff >= self._stall_time:
            self._stalled = True
            return

        self._samples.append((time_diff, self._collected_bytes_transferred))
        self._collected_bytes_transferred = 0