Check to make sure the teaching object which will be used as a dictionary key is hashable
971379
def _validate_teaching(cls, belief, teaching, *args, **kwargs):
        
        if teaching.__hash__ is None:
            raise DictionaryDogmaException(''''The belief '%s' does not have a hashable teaching '%s' ''' % (belief, teaching ))

        return teaching
443566
def jsonhash(obj, root=True, exclude=None, hash_func=_jsonhash_sha1):
    '''
    
    '''
    if isinstance(obj, Mapping):
        # assumption: using in against set() is faster than in against list()
        if root and exclude:
            obj = {k: v for k, v in obj.iteritems() if k not in exclude}
        # frozenset's don't guarantee order; use sorted tuples
        # which means different python interpreters can return
        # back frozensets with different hash values even when
        # the content of the object is exactly the same
        result = sorted(
            (k, jsonhash(v, False)) for k, v in obj.iteritems())
    elif isinstance(obj, list):
        # FIXME: should lists be sorted for consistent hashes?
        # when the object is the same, just different list order?
        result = tuple(jsonhash(e, False) for e in obj)
    else:
        result = obj
    if root:
        result = unicode(hash_func(result))
    return result
479418
def to_hash
      hash = {}
      instance_variables.each do |name|
        value = instance_variable_get(name)
        next if value.nil?
        name = name[1..-1]
        key = self.class.names.key?(name) ? self.class.names[name] : name
        if value.instance_of? Array
          hash[key] = value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
        elsif value.instance_of? Hash
          hash[key] = {}
          value.each do |k, v|
            hash[key][k] = v.is_a?(BaseModel) ? v.to_hash : v
          end
        else
          hash[key] = value.is_a?(BaseModel) ? value.to_hash : value
        end
      end
      hash
    end
382052
boolean isAssignableKey(Method getter) {
        synchronized (autoGeneratedKeyGetterCache) {
            if ( !autoGeneratedKeyGetterCache.containsKey(getter) ) {
                autoGeneratedKeyGetterCache.put(
                        getter,
                        ReflectionUtils.getterOrFieldHasAnnotation(getter, DynamoDBAutoGeneratedKey.class)
                                && ( ReflectionUtils.getterOrFieldHasAnnotation(getter, DynamoDBHashKey.class) ||
                                     ReflectionUtils.getterOrFieldHasAnnotation(getter, DynamoDBRangeKey.class) ||
                                     ReflectionUtils.getterOrFieldHasAnnotation(getter, DynamoDBIndexHashKey.class) ||
                                     ReflectionUtils.getterOrFieldHasAnnotation(getter, DynamoDBIndexRangeKey.class)));
            }
            return autoGeneratedKeyGetterCache.get(getter);
        }
    }
446104
def serializable_hash(*options)
      super.collect do |key, value|
        if attribute_def = self.class.attr_json_registry[key.to_sym]
          key = attribute_def.store_key
          if value.kind_of?(Time) || value.kind_of?(DateTime)
            value = value.utc.change(usec: 0)
          end

          value = attribute_def.serialize(value)
        end
        # Do we need unknown key handling here? Apparently not?
        [key, value]
      end.to_h
    end
1248576
def data_key(data) :
    ""
    if isinstance(data, (bytes, float, frozenset, int, str, tuple)) :
        result = data
    else :
        # data itself is non-hashable
        result = id(data)
    #end if
    return \
        result
539423
boolean isAssignableKey(Method getter) {
        synchronized (autoGeneratedKeyGetterCache) {
            if ( !autoGeneratedKeyGetterCache.containsKey(getter) ) {
                autoGeneratedKeyGetterCache.put(
                        getter,
                        getter.isAnnotationPresent(DynamoDBAutoGeneratedKey.class)
                                && (getter.isAnnotationPresent(DynamoDBHashKey.class) || getter
                                        .isAnnotationPresent(DynamoDBRangeKey.class)));
            }
        }

        return autoGeneratedKeyGetterCache.get(getter);
    }
250353
def hash_value(key)
      if :hash == self.type
        value_node = self.children.find { |pair_node| pair_node.key.to_value == key }
        value_node ? value_node.value : nil
      else
        raise Synvert::Core::MethodNotSupported.new "has_key? is not handled for #{self.debug_info}"
      end
    end
1145278
def assoc(self, key, value):
        ''''''
        copydict = ImmutableDict()
        copydict.tree = self.tree.assoc(hash(key), (key, value))
        copydict._length = self._length + 1
        return copydict
291316
def check_have_hashtable_content(hashtable, keys = [], container = nil)
      hashtable = wrapper_hash(hashtable)
      keys = hashtable.keys if keys.empty?

      keys.each do |k|
        begin
          check_have_content hashtable[k.to_s], container
        rescue RSpec::Expectations::ExpectationNotMetError => e
          puts "The key: '#{k}'' has no matched content!!"
          raise
        end
      end
    end
551571
static void buildHashTable(Block keyBlock, int keyOffset, int keyCount, MethodHandle keyBlockHashCode, int[] outputHashTable, int hashTableOffset, int hashTableSize)
    {
        for (int i = 0; i < keyCount; i++) {
            int hash = getHashPosition(keyBlock, keyOffset + i, keyBlockHashCode, hashTableSize);
            while (true) {
                if (outputHashTable[hashTableOffset + hash] == -1) {
                    outputHashTable[hashTableOffset + hash] = i;
                    break;
                }
                hash++;
                if (hash == hashTableSize) {
                    hash = 0;
                }
            }
        }
    }
1024385
def _get_hash_object(hash_algo_name):
    
    algorithms = (hashlib.algorithms_guaranteed if six.PY3
                  else hashlib.algorithms)
    if hash_algo_name not in algorithms:
        msg = ("Unsupported/Invalid hash name '%s' provided."
               % hash_algo_name)
        raise exception.InvalidInputError(msg)

    return getattr(hashlib, hash_algo_name)()
195647
def _ordered_keys(dict_):
        
        return isinstance(dict_, OrderedDict) and dict_.keys() or \
               dict_ and sorted(dict_.keys()) or []
11638
def key_exists(self, key):
        
        assert isinstance(key, str)
        self._close()
        try:
            return self._unsafe_key_exists(key)
        finally:
            self._open()
1031570
def hashone(self):
    ""
    rs = self.one()
    if not rs: 
      return {}
    else:
      finds = " ".join(self._find).split(' ')
      return dict(zip((x.replace('?','') for x in finds), rs))
1323133
def appropriate_for(self, usage, alg='HS256'):
        
        try:
            _use = USE[usage]
        except:
            raise ValueError('Unknown key usage')
        else:
            if not self.use or self.use == _use:
                if _use == 'sig':
                    return self.get_key()
                else:
                    return self.encryption_key(alg)

            raise WrongUsage("This key can't be used for {}".format(usage))
158448
def serializable_hash(*)
      h               = attributes.extract!('included')
      h['data']       = { 'type'       => self.class.to_s.underscore.sub('esp/', '').pluralize,
                          'attributes' => changed_attributes.except('id', 'type', 'created_at', 'updated_at', 'relationships') }
      h['data']['id'] = id if id.present?
      h
    end