Check if a given LDAP object exists.
5489
def _check_exists(database: Database, table: LdapObjectClass, key: str, value: str):
    
    try:
        get_one(table, Q(**{key: value}), database=database)
        return True
    except ObjectDoesNotExist:
        return False
748617
def assure_directory_exists(path, is_file=False):
    """"""
    if is_file:
        path = osp.dirname(path)
    # END handle file
    if not osp.isdir(path):
        os.makedirs(path)
        return True
    return False
1178923
def exists(project, credentials):
        """"""
        user, oauth_access_token = parsecredentials(credentials) #pylint: disable=unused-variable
        printdebug("Checking if project " + project + " exists for " + user)
        return os.path.isdir(Project.path(project, user))
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)))
11178
def directory_exists(self, directory):
        """"""
        file_list = []
        self.session.retrlines('LIST', file_list.append)
        return any(f.split()[-1] == directory and f.upper().startswith('D') for f in file_list)
1052026
def exists(self):
        
        return self.rpc_model.search_count(
            self.domain, context=self.context
        ) > 0
19773
def exists(self, key, **opts):
        """"""
        key, store = self._expand_opts(key, opts)
        data = store.get(key)
        # Note that we do not actually delete the thing here as the max_age
        # just for this call may have triggered a False.
        if not data or self._has_expired(data, opts):
            return False
        return True
821326
private void existsCheck(Dn dn) throws NoSuchNodeException, MissingParentException {
        try {
            if (!connection.exists(dn.getParent())) {
                throw new MissingParentException(lastMatch(dn));
            } else if (!connection.exists(dn)) {
                throw new NoSuchNodeException(dn);
            }
        } catch (LdapException e) {
            throw new LdapDaoException(e);
        }
    }
706437
def get(method, hmc, uri, uri_parms, logon_required):
        """"""
        query_str = uri_parms[0]
        try:
            console = hmc.consoles.lookup_by_oid(None)
        except KeyError:
            raise InvalidResourceError(method, uri)
        result_ldap_srv_defs = []
        filter_args = parse_query_parms(method, uri, query_str)
        for ldap_srv_def in console.ldap_server_definitions.list(filter_args):
            result_ldap_srv_def = {}
            for prop in ldap_srv_def.properties:
                if prop in ('element-uri', 'name', 'type'):
                    result_ldap_srv_def[prop] = ldap_srv_def.properties[prop]
            result_ldap_srv_defs.append(result_ldap_srv_def)
        return {'ldap-server-definitions': result_ldap_srv_defs}
130981
function isExist(dir) {
  dir = path.normalize(dir);
  try {
    fs.accessSync(dir, fs.R_OK);
    return true;
  } catch (e) {
    return false;
  }
}
885881
def does_s3_object_exist(bucket_name, key, session=None):
    """"""
    if session:
        s3_resource = session.resource('s3')
    else:
        s3_resource = boto3.resource('s3')

    try:
        s3_resource.Object(bucket_name, key).load()
    except ClientError as exc:
        if exc.response['Error']['Code'] == '404':
            return False
        raise
    return True
704928
def exists(name, path=None):
    '''
    
    '''

    _exists = name in ls_(path=path)
    # container may be just created but we did cached earlier the
    # lxc-ls results
    if not _exists:
        _exists = name in ls_(cache=False, path=path)
    return _exists
519241
def _get_ldap_msg(e):
        """"""
        msg = e
        if hasattr(e, 'message'):
            msg = e.message
            if 'desc' in e.message:
                msg = e.message['desc']
            elif hasattr(e, 'args'):
                msg = e.args[0]['desc']
        return msg
246291
def isAuth(self):
        '''
        
        '''
        if isinstance(self.__conn, ldap.ldapobject.LDAPObject) or self.__conn:
            return True
        return False
1302219
def _check_object_exists(self):
        
        if not DB.get_keys(self.key):
            raise KeyError("Object with key '{}' not exist".format(self.key))
219870
def validate_path_exists(s):
    """"""
    if s is None:
        return None
    if os.path.exists(s):
        return s
    else:
        raise ValueError('"%s" should be a path but it does not exist' % s)
963478
def matches(self, ldap_filter):
        # type: (Any[str, pelix.ldapfilter.LDAPFilter]) -> bool
        
        return pelix.ldapfilter.get_ldap_filter(ldap_filter).matches(
            self.__properties
        )