Checks if a MUC room exists on the server.
485948
def room_exists(jid):
    """"""

    def _room_exists(xmpp):
        disco = xmpp.plugin['xep_0030']
        try:
            disco.get_info(jid)
        except IqError as e:
            if e.condition == 'item-not-found':
                return False
            raise
        else:
            return True

    return _execute_xmpp(_room_exists)
589259
def exists(method,
            ip,
            port=None,
            proto='tcp',
            direction='in',
            port_origin='d',
            ip_origin='d',
            ttl=None,
            comment=''):
    '''
    
    '''
    if method.startswith('temp'):
        return _temp_exists(method, ip)
    if port:
        rule = _build_port_rule(ip, port, proto, direction, port_origin, ip_origin, comment)
        return _exists_with_port(method, rule)
    exists = __salt__['cmd.run_all']("egrep ^'{0} +' /etc/csf/csf.{1}".format(ip, method))
    return not bool(exists['retcode'])
590895
def server(self):
        
        from indico_chat.plugin import ChatPlugin

        return self.custom_server or ChatPlugin.settings.get('muc_server')
1327333
def exists(self, filepath):
        """"""
        if self.is_ssh(filepath):
            self._check_ftp()
            remotepath = self._get_remote(filepath)
            try:
                self.ftp.stat(remotepath)
            except IOError as e:
                if e.errno == errno.ENOENT:
                    return False
            else:
                return True
        else:
            return os.path.exists(filepath)
830324
def contains(container, item):
    """"""

    # equality counts as containment and is usually non destructive
    if container == item:
        return True

    # testing mapping containment is usually non destructive
    if isinstance(container, abc.Mapping) and mapping_contains(container, item):
        return True

    # standard containment except special cases
    if isinstance(container, str):
        # str __contains__ includes substring match that we don't count as containment
        if strict_contains(container, item):
            return True
    else:
        try:
            if item in container:
                return True
        except Exception:
            pass

    # search matches in generic instances
    return instance_contains(container, item)
249156
public static boolean checkServerConnection(URL u) {
        boolean value = false;
        try {
            value = new RetrieveCheckServerConnection().execute(u).get();
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (ExecutionException e) {
            e.printStackTrace();
        }
        return value;

    }
112965
def has_request(self, request):
        

        queue_item = QueueItem(request, Response(request.url))
        key = queue_item.get_hash()

        for status in QueueItem.STATUSES:
            if key in self.__get_var("items_" + status).keys():
                return True

        return False
1370296
private static boolean checkIfCollectionExists(CloudSolrClient server, String collection) throws KeeperException, InterruptedException {
        ZkStateReader zkStateReader = server.getZkStateReader();
        zkStateReader.updateClusterState(true);
        ClusterState clusterState = zkStateReader.getClusterState();
        return clusterState.getCollectionOrNull(collection) != null;
    }
1162052
protected function checkTableExists()
  {
    $m = $this->getManager();

    $q = 'SHOW TABLES LIKE "' . $m->getPrefix() . $this->getTable() . '"';

    return (bool)$m->query($q)->rowCount();
  }
516674
function (server_name, onDone) {

	// check if cached server info exists	
	if (l_servers.hasOwnProperty(server_name)) {
		var server = l_servers[server_name];
		
		LOG.warn('cache exists: ', 'Entry');
		LOG.warn(server, 'Entry');
		UTIL.safeCall(onDone, server);
	}
	else {
		
		// seek server IP/port info from monitor
		//l_queryServer(server_name, function (result) {
		//SR.Script['handler'].queryServer(server_name, function (result) {
		//g_handler.queryServer(server_name, function (result) {
		SR.API.queryServer({name: server_name}, function (err, result) {
			
			if (err) {
				return LOG.error(err);	
			}
			
			if (result && result.length > 0) {
				// TODO: pick a random one if more than one choices OR choose based on loading?
				var index = UTIL.randInteger(result.length);
				var info = result[index];
			
				var server = {IP: info.IP, port: info.port}
				l_servers[server_name] = server;
				onDone(server);
			}
			else
				onDone();
		});
	}	
}
1286868
private HBaseQueueAdmin ensureTableExists(QueueName queueName) throws IOException {
    HBaseQueueAdmin admin = queueAdmin;
    try {
      if (!admin.exists(queueName)) {
        admin.create(queueName);
      }
    } catch (Exception e) {
      throw new IOException("Failed to open table " + admin.getActualTableName(queueName), e);
    }
    return admin;
  }
917851
def exists(self, digest):
        
        return self.conn.client.blob_exists(self.container_name, digest)
737343
function isExist(filename) {
    try {
        fs.accessSync(filename, fs.R_OK);
        return true;
    } catch (e) {
        return false;
    }
}
273851
def is_member(self, m):
        """"""
        if not m:
            return False
        elif isinstance(m, basestring):
            jid = m
        else:
            jid = m['JID']

        is_member = len(filter(lambda m: m['JID'] == jid and m.get('STATUS') in ('ACTIVE', 'INVITED'), self.params['MEMBERS'])) > 0

        return is_member
930011
def find_room_in_json(json)
      room_hash = json["rooms"].find { |r| r["name"] == room }

      if room_hash
        room_hash["id"]
      else
        raise NotFound, "Room name '#{room}' could not be found."
      end
    end
253195
def exists(cls, id):
        """"""
        return bool(redisco.get_client().exists(cls._key[str(id)]) or
                    redisco.get_client().sismember(cls._key['all'], str(id)))
1227873
def _check_file_exists_unix(self, remote_cmd=""):
        """"""
        if self.direction == "put":
            self.ssh_ctl_chan._enter_shell()
            remote_cmd = "ls {}".format(self.file_system)
            remote_out = self.ssh_ctl_chan.send_command(
                remote_cmd, expect_string=r"[\$#]"
            )
            self.ssh_ctl_chan._return_cli()
            return self.dest_file in remote_out
        elif self.direction == "get":
            return os.path.exists(self.dest_file)