Verify that the object we retrieved from cache matches the requested
        `id_field`/`id_val`.
359411
def verify(self, cls, id_field, id_val, obj_from_cache):
        
        return getattr(obj_from_cache, id_field) == id_val
701522
def ne_(self, value):
        ''' 
        '''
        if isinstance(value, QueryField):
            return self.__cached_id != value.__cached_id
        return self.__comparator('$ne', value)
545385
async def _has_id(self, *args, **kwds):
        
        # if there is only one positional argument
        if len(args) == 1:
            # parse the appropriate query
            result = await parse_string(
                self._query,
                self.service.object_resolver,
                self.service.connection_resolver,
                self.service.mutation_resolver,
                obey_auth=False
            )
            # go to the bottom of the result for the list of matching ids
            return self._find_id(result['data'], args[0])
        # otherwise
        else:
            # treat the attribute like a normal filter
            return self._has_id(**kwds)
559437
def _find_id(self, result, uid):
        
        # if the result is a list
        if isinstance(result, list):
            # if the list has a valid entry
            if any([self._find_id(value, uid) for value in result]):
                # then we're done
                return True

        # otherwise results could be dictionaries
        if isinstance(result, dict):
            # the children of the result that are lists
            list_children = [value for value in result.values() if isinstance(value, list)]

            # go to every value that is a list
            for value in list_children:
                # if the value is a match
                if self._find_id(value, uid):
                    # we're done
                    return True

            # the children of the result that are dicts
            dict_children = [value for value in result.values() if isinstance(value, dict)]

            # perform the check on every child that is a dict
            for value in dict_children:
                # if the child is a match
                if self._find_id(value, uid):
                    # we're done
                    return True

            # if there are no values that are lists and there is an id key
            if not list_children and not dict_children and 'id' in result:
                # the value of the remote id field
                result_id = result['id']
                # we've found a match if the id field matches (cast to match type)
                return result_id == type(result_id)(uid)

        # we didn't find the result
        return False
1189078
def identify_id(id: str) -> bool:
    
    return re.match(r'^https?://', id, flags=re.IGNORECASE) is not None
1236327
def exists(self, obj_id, obj_type=None):
        
        return self.object_key(obj_id, obj_type) in self._data
389603
def _get_persistent_id(self, o):
        
        if type(o) in self.hash_dedup:
            oid = o.__class__.__name__ + "-" + str(hash(o))
            self._object_cache[oid] = o
            return oid

        if any(isinstance(o,c) for c in self.unsafe_key_baseclasses):
            return None

        try:
            return self._uuid_cache[o]
        except KeyError:
            pass
        except TypeError:
            return None

        #if type(o) in self.uuid_dedup:
        #    return self._get_id(o)
        if o.__class__.__module__.split('.')[0] in self.module_dedup or o.__class__ in self.uuid_dedup:
            oid = o.__class__.__name__.split(".")[-1] + '-' + str(uuid.uuid4())
            self._object_cache[oid] = o
            self._uuid_cache[o] = oid
            return oid

        return None
437337
def id_field_name(cls):
        
        if cls._cache_id_field_name is None:
            pk_names = cls.pk_names()
            if len(pk_names) == 1:
                cls._cache_id_field_name = pk_names[0]
            else:  # pragma: no cover
                raise ValueError(
                    "{classname} has more than 1 primary key!"
                    .format(classname=cls.__name__)
                )
        return cls._cache_id_field_name
1306123
def verify_client_id(self):
        

        from .models import Client
        from .exceptions.invalid_client import ClientDoesNotExist
        from .exceptions.invalid_request import ClientNotProvided

        if self.client_id:
            try:
                self.client = Client.objects.for_id(self.client_id)
            # Catching also ValueError for the case when client_id doesn't contain an integer.
            except (Client.DoesNotExist, ValueError):
                raise ClientDoesNotExist()
        else:
            raise ClientNotProvided()
1020714
def find_by_id(self, custom_field, params={}, **options): 
        
        path = "/custom_fields/%s" % (custom_field)
        return self.client.get(path, params, **options)
207480
def _get_by_id(collection, id):
    '''
    
    '''
    matches = [item for item in collection if item.id == id]
    if not matches:
        raise ValueError('Could not find a matching item')
    elif len(matches) > 1:
        raise ValueError('The id matched {0} items, not 1'.format(len(matches)))
    return matches[0]
990806
def is_registered(id):
    """"""
    bucket = registration_s3_bucket()
    key = registration_key(id)
    found_keys = set(obj.key for obj in bucket.objects.filter(Prefix=key))
    return key in found_keys
669913
def ensure_cache_id(self, cache_id_obj):
        """"""
        cache_id = self._get_canonical_id(cache_id_obj)
        if cache_id != self._cache_id_obj:
            raise ValueError(
                "cache mismatch {0} != {1}".format(
                    cache_id, self._cache_id_obj))
1330990
def get(cls, id):
        

        # cached?
        if CACHE:
            if id in _cache['VRF']:
                log.debug('cache hit for VRF %d' % id)
                return _cache['VRF'][id]
            log.debug('cache miss for VRF %d' % id)

        try:
            vrf = VRF.list({ 'id': id })[0]
        except IndexError:
            raise NipapNonExistentError('no VRF with ID ' + str(id) + ' found')

        _cache['VRF'][id] = vrf
        return vrf
140449
def verify_hash(self, hashed_data, compare_data):
        
        return self.security.hashing_context.verify(
            encode_string(compare_data), hashed_data)
1010730
async def get_match(self, m_id, force_update=False) -> Match:
        
        found_m = self._find_match(m_id)
        if force_update or found_m is None:
            await self.get_matches()
            found_m = self._find_match(m_id)
        return found_m
1046535
public void cache(Identity oid, Object obj)
    {
        if (oid != null && obj != null)
        {
            ObjectCache cache = getCache(oid, obj, METHOD_CACHE);
            if (cache != null)
            {
                cache.cache(oid, obj);
            }
        }
    }