(self)
Attempt to connect to a writable server, or return False.
Attempt to connect to a writable server, or return False.
Attempt to connect to a writable server or return False .
def _is_writable(self):
        """Attempt to connect to a writable server, or return False.
        """
        topology = self._get_topology()  # Starts monitors if necessary.
        try:
            svr = topology.select_server(writable_server_selector)

            # When directly connected to a secondary, arbiter, etc.,
            # select_server returns it, whatever the selector. Check
            # again if the server is writable.
            return svr.description.is_writable
        except ConnectionFailure:
            return False
def _is_writable ( self ) : topology = self . _get_topology ( ) # Starts monitors if necessary. try : svr = topology . select_server ( writable_server_selector ) # When directly connected to a secondary, arbiter, etc., # select_server returns it, whatever the selector. Check # again if the server is writable. return svr . description . is_writable except ConnectionFailure : return False