(self)
Return primary's address or None.
Return primary's address or None.
Return primary s address or None .
def get_primary(self):
        """Return primary's address or None."""
        # Implemented here in Topology instead of MongoClient, so it can lock.
        with self._lock:
            topology_type = self._description.topology_type
            if topology_type != TOPOLOGY_TYPE.ReplicaSetWithPrimary:
                return None

            return writable_server_selector(self._new_selection())[0].address
def get_primary ( self ) : # Implemented here in Topology instead of MongoClient, so it can lock. with self . _lock : topology_type = self . _description . topology_type if topology_type != TOPOLOGY_TYPE . ReplicaSetWithPrimary : return None return writable_server_selector ( self . _new_selection ( ) ) [ 0 ] . address