Verify an existing RBD handle is connected and valid.
497358
def check_valid_device(self, path, run_as_root=True):
        """"""
        if self.im_root:
            try:
                with open(path, 'r') as f:
                    f.read(4096)
            except Exception:
                return False
            return True

        try:
            self._execute('dd', 'if=' + path, 'of=/dev/null', 'bs=4096',
                          'count=1', root_helper=self._root_helper,
                          run_as_root=True)
        except putils.ProcessExecutionError:
            return False
        return True
423233
def check_existing_pid
      return false unless pid_file_exists?
      pid = read_pid
      fail 'Existing process found.' if pid > 0 && pid_exists?(pid)
      delete_pid
    end
956196
def validate_and_handle(self, cli, buffer):
        
        if buffer.validate():
            if self.handler:
                self.handler(cli, buffer)

            buffer.append_to_history()
1108066
def CheckForeignKeysWrapper(conn):
    
    yield
    cur = conn.cursor()
    cur.execute('PRAGMA foreign_key_check')
    errors = cur.fetchall()
    if errors:
        raise ForeignKeyError(errors)
591268
def _on_recv_complete(self, handle, addr, flags, data, error):
        """"""
        assert handle is self._handle
        if error:
            self._log.warning('pyuv error {} in recv callback', error)
            self._protocol.error_received(TransportError.from_errno(error))
        elif flags:
            assert flags & pyuv.UV_UDP_PARTIAL
            self._log.warning('ignoring partial datagram')
        elif data:
            self._protocol.datagram_received(data, addr)
766047
def verify(self, base_path, update=False):
        """"""
        return self.project.verify_submission(base_path, self, update=update)
1201041
def Attach(self, pid):
    """"""
    if self.inferior.is_running:
      answer = raw_input('Already attached to process ' +
                         str(self.inferior.pid) +
                         '. Detach? [y]/n ')
      if answer and answer != 'y' and answer != 'yes':
        return None
      self.Detach()
    # Whatever position we had before will not make any sense now
    for plugin in self.plugins:
      plugin.position = None
    self.inferior.Reinit(pid)
483724
def handle_connack(self):
        """"""
        self.logger.info("CONNACK reveived")
        ret, flags = self.in_packet.read_byte()
        if ret != NC.ERR_SUCCESS:
            self.logger.error("error read byte")
            return ret
        
        # useful for v3.1.1 only
        session_present = flags & 0x01

        ret, retcode = self.in_packet.read_byte()
        if ret != NC.ERR_SUCCESS:
            return ret
        
        evt = event.EventConnack(retcode, session_present)
        self.push_event(evt)
        
        if retcode == NC.CONNECT_ACCEPTED:
            self.state = NC.CS_CONNECTED
            return NC.ERR_SUCCESS
        
        elif retcode >= 1 and retcode <= 5:
            return NC.ERR_CONN_REFUSED
        else:
            return NC.ERR_PROTOCOL
345722
void verifyPcNotDirty() {
		if (handle == null || handle.internalGetPCI() == null || 
				!handle.internalGetPCI().jdoZooIsDirty()) {
			ZooPC pc = jdoZooGetContext().getSession().internalGetCache().findCoByOID(
					jdoZooGetOid());
			if (pc == null || !pc.jdoZooIsDirty()) {
				return;
			}
		}
		throw DBLogger.newUser("This object has been modified via its Java class as well as via" +
				" the schema API. This is not allowed. Objectid: " + 
				Util.oidToString(jdoZooGetOid()));
	}
1271542
def check(self, radl):
        """"""

        if not radl.get_system_by_name(self.system):
            raise RADLParseException("Invalid system id '%s'" % self.system, line=self.line)
        if not radl.get_configure_by_name(self.configure):
            raise RADLParseException("Invalid configure id '%s'" % self.configure, line=self.line)
802851
def is_valid(self) -> bool:
        
        return CRCPubkey.from_pubkey(self.pubkey).crc == self.crc
1090776
@Override
    protected void checkIfAlreadyConnected(DeviceProxy device, String attribute, String event_name, CallBack callback, int max_size, boolean stateless) throws DevFailed {
        //  Nothing to do (only override)
    }
166462
def _maybe_handle(self, prefix, handler, path, params, data=None):
    """"""
    if path.startswith(prefix):
      relpath = path[len(prefix):]
      if data:
        handler(relpath, params, data)
      else:
        handler(relpath, params)
      return True
    else:
      return False
80803
def verify(backup_path, fast):
    """"""
    from PyHardLinkBackup.phlb.verify import verify_backup

    verify_backup(backup_path, fast)
1070596
def _transport_ready_handler(self, fd, cb_condition):
        
        if(self.user_cb):
            self.user_cb(self.user_arg)
        return True
271038
def isPIDValid(self, pid):
        
        ## Slightly copied wholesale from http://stackoverflow.com/questions/568271/how-to-check-if-there-exists-a-process-with-a-given-pid
        ## Thanks to http://stackoverflow.com/users/1777162/ntrrgc and http://stackoverflow.com/users/234270/speedplane
        class ExitCodeProcess(ctypes.Structure):
            _fields_ = [('hProcess', ctypes.c_void_p),
                        ('lpExitCode', ctypes.POINTER(ctypes.c_ulong))]
        SYNCHRONIZE = 0x100000
        PROCESS_QUERY_LIMITED_INFORMATION = 0x1000
        process = self._kernel32.OpenProcess(SYNCHRONIZE|PROCESS_QUERY_LIMITED_INFORMATION, 0, pid)
        if not process:
            return False
        ec = ExitCodeProcess()
        out = self._kernel32.GetExitCodeProcess(process, ctypes.byref(ec))
        if not out:
            err = self._kernel32.GetLastError()
            if self._kernel32.GetLastError() == 5:
                # Access is denied.
                logging.warning("Access is denied to get pid info.")
            self._kernel32.CloseHandle(process)
            return False
        elif bool(ec.lpExitCode):
            # There is an exit code, it quit
            self._kernel32.CloseHandle(process)
            return False
        # No exit code, it's running.
        self._kernel32.CloseHandle(process)
        return True
728208
def verify(self, connection_type=None):
        
        req_body = self._cli.make_body(connectionType=connection_type)

        resp = self.action('verify', **req_body)
        resp.raise_if_err()
        return resp