Allow the scheme to be set like a Hash.
11173
def []=( color_tag, constants )
      @scheme[to_key(color_tag)] = constants.respond_to?(:map) ?
          constants.map { |c| to_constant(c) }.join : to_constant(constants)
    end
245676
def to_hash
      OPTIONS.inject({}) do |hash, option|
        key = option.first
        hash[key] = self.send(key)
        hash
      end
    end
102006
def to_hash
      {
        :repository   => repository.name,
        :model        => model.name,
        :fields       => fields,
        :links        => links,
        :conditions   => conditions,
        :offset       => offset,
        :limit        => limit,
        :order        => order,
        :unique       => unique?,
        :add_reversed => add_reversed?,
        :reload       => reload?,
      }
    end
221191
def put_hash(name, hash)
      file_name = File.join(@db_dir, name + '.json')
      begin
        RobustFile.write(file_name, hash.to_json)
      rescue IOError => e
        PEROBS.log.fatal "Cannot write hash file '#{file_name}': #{e.message}"
      end
    end
790951
def _dhash(self, params):
        """"""
        m = hashlib.new('md5')
        m.update(self.hash.encode('utf-8'))
        for key in sorted(params.keys()):
            h_string = ('%s-%s' % (key, params[key])).encode('utf-8')
            m.update(h_string)
        return m.hexdigest()
783600
def scheme=(new_scheme)
      if new_scheme && !new_scheme.respond_to?(:to_str)
        raise TypeError, "Can't convert #{new_scheme.class} into String."
      elsif new_scheme
        new_scheme = new_scheme.to_str
      end
      if new_scheme && new_scheme !~ /\A[a-z][a-z0-9\.\+\-]*\z/i
        raise InvalidURIError, "Invalid scheme format: #{new_scheme}"
      end
      @scheme = new_scheme
      @scheme = nil if @scheme.to_s.strip.empty?

      # Reset dependent values
      remove_instance_variable(:@normalized_scheme) if defined?(@normalized_scheme)
      remove_composite_values

      # Ensure we haven't created an invalid URI
      validate()
    end
463044
def set_hash_key(self, file):
        """"""
        filehasher = hashlib.md5()
        while True:
            data = file.read(8192)
            if not data:
                break
            filehasher.update(data)
        file.seek(0)
        self.hash_key = filehasher.hexdigest()
1161203
def enable_encryption(self, output_key, input_key):
        """"""
        self._chacha = chacha20.Chacha20Cipher(output_key, input_key)
240129
def scheme(self, value=None):
        
        if value is not None:
            return URL._mutate(self, scheme=value)
        return self._tuple.scheme
509546
def normalize_hash(hash)
      new_hash = {}

      hash.each do |key,value|
        new_hash[key.to_sym] = normalize(value)
      end

      return new_hash
    end
1338350
def checksum_file(scheme, path):
    """"""
    h = getattr(hashlib, scheme)()

    with open(path, 'rb') as f:
        chunk = f.read(65535)
        while chunk:
            h.update(chunk)
            chunk = f.read(65535)
    return h.hexdigest()
1216129
def combine_hashes(hashes):
  """"""
  hasher = sha1()
  for h in sorted(hashes):
    h = ensure_binary(h)
    hasher.update(h)
  return hasher.hexdigest() if PY3 else hasher.hexdigest().decode('utf-8')
1170958
def to_hash
      characteristics.inject({}) do |memo, (k, v)|
        memo[k] = v.value
        memo
      end
    end
634654
def genhash(self, package, code):
        """"""
        return hex(checksum(
            hash_sep.join(
                str(item) for item in (VERSION_STR,)
                + self.__reduce__()[1]
                + (package, code)
            ).encode(default_encoding),
        ))
727301
def use_double_hash(password_hash=None):
    """"""
    # Default to plaintext for backward compatibility with
    # SECURITY_PASSWORD_SINGLE_HASH = False
    single_hash = config_value('PASSWORD_SINGLE_HASH') or {'plaintext'}

    if password_hash is None:
        scheme = _security.password_hash
    else:
        scheme = _pwd_context.identify(password_hash)

    return not (single_hash is True or scheme in single_hash)
312368
def set(key, opts = nil)
      fail ArgumentError, 'Second argument must be a hash' unless opts.is_a?(Hash)
      path  = key_endpoint + key
      payload = {}
      [:ttl, :value, :dir, :prevExist, :prevValue, :prevIndex].each do |k|
        payload[k] = opts[k] if opts.key?(k)
      end
      response = api_execute(path, :put, params: payload)
      Response.from_http_response(response)
    end
1064439
private long mixInHash(long hash, StorableInfo<?> info, LayoutOptions options, int multiplier)
    {
        hash = mixInHash(hash, info.getStorableType().getName(), multiplier);
        hash = mixInHash(hash, options, multiplier);

        for (StorableProperty<?> property : info.getAllProperties().values()) {
            if (!property.isJoin()) {
                hash = mixInHash(hash, property, multiplier);
            }
        }

        return hash;
    }