iterate on all members and check if any has joined the replica
774917
def is_replicaset_initialized(self):
        

        # it's possible isMaster returns an "incomplete" result if we
        # query a replica set member while it's loading the replica set config
        # https://jira.mongodb.org/browse/SERVER-13458
        # let's try to detect this state before proceeding
        # seems like if the "secondary" field is present, but "setName" isn't,
        # it's a good indicator that we just need to wait a bit
        # add an uptime check in for good measure

        for member in self.get_members():
            server = member.get_server()

            if server.has_joined_replica():
                return True

        return False
1119936
def check_membership(self, groups):
        '''  '''
        if not groups or groups == ['']:
            return True
        if self.request.user.is_superuser:
            return True
        user_groups = self.request.user.groups.values_list("name", flat=True)
        return set(groups).intersection(set(user_groups))
1089490
def join(self, timeout=None):
        """"""
        if not self._ioloop_managed:
            # Do nothing if the loop is not managed
            return
        try:
            self._ioloop_thread.join(timeout)
        except AttributeError:
            raise RuntimeError('Cannot join if not started')
631262
def members(self):
        
        if self._members is None:
            self.assert_bind_client()
            self._members = self.bind_client.get_club_members(self.id)
        return self._members
1001651
def instance_contains(container, item):
    """"""
    return item in (member for _, member in inspect.getmembers(container))
119806
private void joinAllThreads() {
        Iterator iter = registeredWachdogs.values().iterator();
        while (iter.hasNext()) {
            Watchdog th = (Watchdog) iter.next();
            boolean isJoining = true;
            if (!th.isAlive() && log.isDebugEnabled()) {
                log.debug("Thread " + th + " finished");
            }
            while (th.isAlive() && isJoining) {
                try {
                    th.getThread().join();
                    isJoining = false;
                    if (log.isDebugEnabled()) {
                        log.debug("Thread " + th + " joined and finished");
                    }
                } catch (InterruptedException e) {
                }
            }
        }
    }
344869
def members
            unless @members
                @members = []
                [Adauth::AdObjects::Computer, Adauth::AdObjects::OU, Adauth::AdObjects::User, Adauth::AdObjects::Group].each do |object|
                    object.all.each do |entity|
                        @members.push entity if entity.is_a_member?(self)
                    end
                end
            end
            @members
        end
229998
def get_joined_members(self, force_resync=False) -> List[User]:
        
        if force_resync:
            response = self.client.api.get_room_members(self.room_id)
            for event in response['chunk']:
                if event['content']['membership'] == 'join':
                    user_id = event["state_key"]
                    if user_id not in self._members:
                        self._mkmembers(
                            User(
                                self.client.api,
                                user_id,
                                event['content'].get('displayname'),
                            ),
                        )
        return list(self._members.values())
1148027
def get_member(row, key):
    '''  '''
    (target, tkey, tvalue) = dict_crawl(row, key)
    if target:
        return tvalue
    return None
780631
def has_membership(self, user, role):
        
        targetRecord = AuthMembership.objects(creator=self.client, user=user).first()
        if targetRecord:
            return role in [i.role for i in targetRecord.groups]
        return False
1207990
private void join(Iterator<MemberState> iterator) {
    if (iterator.hasNext()) {
      cancelJoinTimer();
      joinTimeout = context.getThreadContext().schedule(context.getElectionTimeout().multipliedBy(2), () -> {
        join(iterator);
      });

      MemberState member = iterator.next();
      LOGGER.debug("{} - Attempting to join via {}", member().address(), member.getMember().serverAddress());

      context.getConnections().getConnection(member.getMember().serverAddress()).thenCompose(connection -> {
        JoinRequest request = JoinRequest.builder()
          .withMember(new ServerMember(member().type(), member().serverAddress(), member().clientAddress(), member().updated()))
          .build();
        return connection.<JoinRequest, JoinResponse>sendAndReceive(request);
      }).whenComplete((response, error) -> {
        // Cancel the join timer.
        cancelJoinTimer();

        if (error == null) {
          if (response.status() == Response.Status.OK) {
            LOGGER.info("{} - Successfully joined via {}", member().address(), member.getMember().serverAddress());

            Configuration configuration = new Configuration(response.index(), response.term(), response.timestamp(), response.members());

            // Configure the cluster with the join response.
            // Commit the configuration as we know it was committed via the successful join response.
            configure(configuration).commit();

            // If the local member is not present in the configuration, fail the future.
            if (!members.contains(this.member)) {
              joinFuture.completeExceptionally(new IllegalStateException("not a member of the cluster"));
            } else if (joinFuture != null) {
              joinFuture.complete(null);
            }
          } else if (response.error() == null || response.error() == CopycatError.Type.CONFIGURATION_ERROR) {
            // If the response error is null, that indicates that no error occurred but the leader was
            // in a state that was incapable of handling the join request. Attempt to join the leader
            // again after an election timeout.
            LOGGER.debug("{} - Failed to join {}", member().address(), member.getMember().address());
            resetJoinTimer();
          } else {
            // If the response error was non-null, attempt to join via the next server in the members list.
            LOGGER.debug("{} - Failed to join {}", member().address(), member.getMember().address());
            join(iterator);
          }
        } else {
          LOGGER.debug("{} - Failed to join {}", member().address(), member.getMember().address());
          join(iterator);
        }
      });
    }
    // If join attempts remain, schedule another attempt after two election timeouts. This allows enough time
    // for servers to potentially timeout and elect a leader.
    else {
      LOGGER.debug("{} - Failed to join cluster, retrying...", member.address());
      resetJoinTimer();
    }
  }
1342767
def _get_members(o):
    
    result = []
    for n in dir(o):
        if hasattr(o, n) and n not in ["__globals__", "func_globals"]:
            result.append((n, getattr(o, n)))
    return result
649161
def members(refresh = false)
      @members = nil if refresh
      @members ||= safe_members.sort{|a,b| a.to_s <=> b.to_s}
    end
778260
def get_repl_lag(self, master_status):
        
        member_status = self.get_member_rs_status()

        if not member_status:
            raise MongoctlException("Unable to determine replicaset status for"
                                    " member '%s'" %
                                    self.id)

        return get_member_repl_lag(member_status, master_status)
27781
def joined_organisations(doc):
    """"""
    if doc.get('type') == 'user':
        for org_id, state in doc.get('organisations', {}).items():
            org = {'_id': org_id}
            yield [doc['_id'], None], org

            try:
                yield [doc['_id'], state['state']], org
            except KeyError:
                pass
4497
def has_in_members(self, member):
        
        assert isinstance(member, github.NamedUser.NamedUser), member
        status, headers, data = self._requester.requestJson(
            "GET",
            self.url + "/members/" + member._identity
        )
        return status == 204
1255441
def perform_iteration(self):
        """"""
        stats = self.get_all_stats()

        self.redis_client.publish(
            self.redis_key,
            jsonify_asdict(stats),
        )