Parses given params or file and returns Hash including the given key.
773881
def parse_params(params, key_word)
      body = params.has_key?(:path) ? load_file(params[:path], key_word) : params
      body = { key_word => body } unless body.has_key?(key_word.to_sym)
      body
    end
150547
def [](key)
      file = filename key
      return unless File.exist? file

      File.read(file, encoding: "utf-8")
    end
833007
def hash_key_path(hash, *path)
      result = nil

      path.each do |key|
        return nil unless hash.respond_to? :"[]"
        result = hash = hash[key]
      end

      return result
    end
1028275
def decode(cls, key):
        

        # Determine bucket key version
        prefix, sep, param_str = key.partition(':')
        if sep != ':' or prefix not in cls._prefix_to_version:
            raise ValueError("%r is not a bucket key" % key)
        version = cls._prefix_to_version[prefix]

        # Take the parameters apart...
        parts = param_str.split('/')
        uuid = parts.pop(0)
        params = {}
        for part in parts:
            name, sep, value = part.partition('=')

            # Make sure it's well-formed
            if sep != '=':
                raise ValueError("Cannot interpret parameter expression %r" %
                                 part)

            params[name] = cls._decode(value)

        # Return a BucketKey
        return cls(uuid, params, version=version)
419680
def extract_key_value(line)
      match = line.match(KEY_VALUE_PATTERN)
      if match
        key = match[1]
        value = match[2]
        [key.strip, value.strip]
      else
        []
      end
    end
935961
def parse_files(self, req, name, field):
        """"""
        files = ((k, v) for k, v in req.POST.items() if hasattr(v, "file"))
        return core.get_value(MultiDict(files), name, field)
1331994
def get_key_or_sym(hash, k)
      hash.fetch(k.to_sym, hash.fetch(k.to_s, nil))
    end
291708
def query_params_from_hash(value, prefix = nil)
      case value
      when Array
        value.map { |v| query_params_from_hash(v, "#{prefix}%5B%5D") }.join("&")
      when Hash
        value.map { |k, v|
          query_params_from_hash(v, prefix ? "#{prefix}%5B#{Rack::Utils.escape_path(k)}%5D" : Rack::Utils.escape_path(k))
        }.join("&")
      when NilClass
        prefix
      else
        raise ArgumentError, "value must be a Hash" if prefix.nil?
        "#{prefix}=#{Rack::Utils.escape_path(value)}"
      end
    end
527343
def get(self, key):
        
        upload = None
        files_states = self.backend.get(key)
        files = MultiValueDict()
        if files_states:
            for name, state in files_states.items():
                f = BytesIO()
                f.write(state['content'])

                # If the post is too large, we cannot use a
                # InMemoryUploadedFile instance.
                if state['size'] > settings.FILE_UPLOAD_MAX_MEMORY_SIZE:
                    upload = TemporaryUploadedFile(
                        state['name'],
                        state['content_type'],
                        state['size'],
                        state['charset'],
                    )
                    upload.file = f
                else:
                    f = BytesIO()
                    f.write(state['content'])
                    upload = InMemoryUploadedFile(
                        file=f,
                        field_name=name,
                        name=state['name'],
                        content_type=state['content_type'],
                        size=state['size'],
                        charset=state['charset'],
                    )
                files[name] = upload

                # Go to the first byte in the file for future use
                upload.file.seek(0)

        return files
689313
def _parse_file(cls, path, pickle=False):
        """"""

        fname = path
        if fname.endswith(".gz"):
            fname = path[:-3]

        if fname.endswith('.pkl'):
            #you asked for the pickled file. I'll give it to you
            log.debug("loading pickled file %s ..." % fname)
            return cPickle.load( open(fname, "rb") )
        elif os.path.isfile("%s.pkl" % fname):
            #there is a cached version I can give to you
            log.info("loading pickled file %s.pkl ..." % fname)
            if os.stat(path).st_mtime > os.stat("%s.pkl" % fname).st_mtime:
                log.critical("*** pickled file %s.pkl is not up to date ***" % (path))
            return cPickle.load( open("%s.pkl" % fname, "rb") )

        data = fastLoadChain(path, cls._strfactory)
        if pickle and not os.path.isfile('%s.pkl' % fname):
            log.info("pckling to %s.pkl" % (fname))
            with open('%s.pkl' % fname, 'wb') as fd:
                cPickle.dump(data, fd)
        return data
989348
function _parseKey(key) {
  const result = key.match(/^(.+)\[([0-9]+)\]$/);

  if (result) {
    return {element: result[1], index: parseInt(result[2], 10)};
  } else {
    return {element: key, index: null};
  }
}
105214
function parseUrlHash_(hash) {
    const parameters = hash.split('&');

    let tabHash = parameters[0];
    if (tabHash === '' || tabHash === '#') {
      tabHash = undefined;
    }

    // Split each string except the first around the '='.
    let paramDict = null;
    for (let i = 1; i < parameters.length; i++) {
      const paramStrings = parameters[i].split('=');
      if (paramStrings.length !== 2) {
        continue;
      }
      if (paramDict === null) {
        paramDict = {};
      }
      const key = decodeURIComponent(paramStrings[0]);
      const value = decodeURIComponent(paramStrings[1]);
      paramDict[key] = value;
    }

    return {tabHash, parameters: paramDict};
  }
206753
def get_hash(fName, readSize, dire=pDir()):
    
    if not fileExists(fName, dire):
        return -1
    readSize = readSize * 1024 # bytes to be read
    fName = os.path.join(dire, fName) # name coupled with path
    with open(fName, 'rb') as f:
        size = os.path.getsize(fName)
        if size < readSize * 2:
            return -1
        data = f.read(readSize)
        f.seek(-readSize, os.SEEK_END)
        data += f.read(readSize)
    return md5(data).hexdigest()
671144
def params_sorted_by_key(params)
      case params
      when Hash
        params.map     { |k, v| [k.to_s, params_sorted_by_key(v)] }
              .sort_by { |k, v| k }
              .to_h
      when Array
        params.map { |val| params_sorted_by_key(val) }
      else
        params.to_s
      end
    end
368407
@Override
    public byte[] get(String key) {
        File f = new File(directory, hash(key));
        FileInputStream fi = null;
        byte[] data = null;
        int read = 0;
        try {
            if (outOfDate(f)) {
                f.delete();
                return null;
            }
            data = new byte[(int) f.length()];
            fi = new FileInputStream(f);
            read = fi.read(data);
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (fi != null) {
            try {
                fi.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        if (read == 0) {
            return null;
        }
        return data;
    }
346561
function(key) {
            var s = Storage.storage();
            if (s == null) {
                return null;
            }
            if (_.isUndefined(s[key]) == false) {
                try {
                    return JSON.parse(s[key]);
                } catch(err) {
                    logging.error("Error parsing ", s[key], err);
                    return s[key];
                }
                
            } else {
                return null;
            }
        }
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