Returns a proc that, when called with the payload, parses it according to the configuration.

 By default, this will assume the payload is JSON, parse it, and return a HashWithIndifferentAccess.
184403
def payload_parser
      @payload_parser ||= if @receive_raw_payload
                            ->(payload) { payload }
                          else
                            ->(payload) {
                              ActiveSupport::HashWithIndifferentAccess.new(JSON.parse(payload))
                            }
                          end
    end
502604
def _get_payload(self, key):
        
        path = self._path(key)

        # If the file doesn't exists, we obviously can't return the cache so we will
        # just return null. Otherwise, we'll get the contents of the file and get
        # the expiration UNIX timestamps from the start of the file's contents.
        if not os.path.exists(path):
            return {'data': None, 'time': None}

        with open(path, 'rb') as fh:
            contents = fh.read()

        expire = int(contents[:10])

        # If the current time is greater than expiration timestamps we will delete
        # the file and return null. This helps clean up the old files and keeps
        # this directory much cleaner for us as old files aren't hanging out.
        if round(time.time()) >= expire:
            self.forget(key)

            return {'data': None, 'time': None}

        data = self.unserialize(contents[10:])

        # Next, we'll extract the number of minutes that are remaining for a cache
        # so that we can properly retain the time for things like the increment
        # operation that may be performed on the cache. We'll round this out.
        time_ = math.ceil((expire - round(time.time())) / 60.)

        return {'data': data, 'time': time_}
1190963
def get_default_config(self):
        
        config = super(ProcessStatCollector, self).get_default_config()
        config.update({
            'path':     'proc'
        })
        return config
948196
public function parse(): Payload
    {
        /** Check signature from header */
        if (!$this->_checkSignature()) {
            throw new BadSignatureException('Hook secret does not match.');
        }

        /** Get data from different locations according to content-type */
        switch ($this->serverBag->get('CONTENT_TYPE')) {
            case 'application/json':
                $data = $this->getRawData();
                break;

            case 'application/x-www-form-urlencoded':
                $data = $_POST['payload'];
                break;

            default:
                throw new Exception('Unsupported content type: "' . $this->serverBag->get('CONTENT_TYPE') . '"');
        }
        $this->setParsedData($data);

        return $this;
    }
930642
def parse_server(server)
      name = nil
      options = {}

      case server
      when Symbol, String
        name = server.to_sym
      when Hash
        unless server.has_key?(:name)
          raise(MissingOption,"the 'server' option must contain a 'name' option for which server to use",caller)
        end

        if server.has_key?(:name)
          name = server[:name].to_sym
        end

        if server.has_key?(:options)
          options.merge!(server[:options])
        end
      end

      return [name, options]
    end
1300987
def json_file_to_hash(filename)
      raise "File #{filename} not found" unless File.exist?(filename)

      file = File.read(filename)
      begin
        FFI_Yajl::Parser.parse(file)
      rescue FFI_Yajl::ParseError
        raise "File #{filename} does not appear to contain valid JSON"
      end
    end
770710
def _get_hash(self, name, operation, create=False):
        
        return self._get_by_type(name, operation, create, b'hash', {})
411201
def get_instance(self, payload):
        
        return ExecutionInstance(self._version, payload, flow_sid=self._solution['flow_sid'], )
62724
def raw_default(context)
      value = options.fetch(:default)
      return value unless value.is_a?(Proc)

      case value.arity
      when 1 then context.instance_exec(self, &value)
      else context.instance_exec(&value)
      end
    end
811020
def get_hash(node,fields = None,exclude = ['pk','_id'],target = 'pk'):
    

    hasher = Hasher()

    def add_to_hash(value):

        if isinstance(value,dict):
            if target in value:
                add_to_hash(value[target])
            else:
                attribute_list = []
                for key,v in sorted(value.items(),key = lambda x: x[0]):

                    if (fields is not None and key not in fields) \
                        or (exclude is not None and key in exclude):
                        continue
                    add_to_hash(key)
                    add_to_hash(v)
        elif isinstance(value,(tuple,list)) and value and isinstance(value[0],(dict,node_class)):
            for i,v in enumerate(value):
                hasher.add(i)
                add_to_hash(v)
        else:
            hasher.add(value)

    add_to_hash(node)

    return hasher.digest.hexdigest()
456569
function(){
			var oUshellContainer = Utils.getUshellContainer();
			if (oUshellContainer) {
				var oURLParser = oUshellContainer.getService("URLParsing");
				var oParsedHash = oURLParser.parseShellHash(hasher.getHash());
				return oParsedHash ? oParsedHash : { };
			}
			return { };
		}
625693
def parse(config)
      hash = {}
      config.each do |label, spec|
        field = Field.new(label, spec)
        hash[field.name.to_sym] = field
      end
      hash
    end
1297551
def return_payload
      @value = @raw.map do |e|
        { name: e['Name'],
          payload: (Base64.decode64(e['Payload']) unless e['Payload'].nil?) }
      end
    end
59191
def as_json(*args)
      request = construct_request_hash
      request[:context] = s(context)
      request[:local_variables] = local_variables if local_variables

      {
        api_key: s(api_key),
        notifier: NOTIFIER,
        error: {
          token: id,
          class: s(error_class),
          message: s(error_message),
          backtrace: s(parse_backtrace(backtrace)),
          fingerprint: fingerprint_hash,
          tags: s(tags),
          causes: s(causes)
        },
        request: request,
        server: {
          project_root: s(config[:root]),
          revision: s(config[:revision]),
          environment_name: s(config[:env]),
          hostname: s(config[:hostname]),
          stats: stats,
          time: now,
          pid: pid
        }
      }
    end
514099
def payload_for(value)
      case value
      when Array, Hash
        JSON.dump value
      else
        value
      end
    rescue
      value
    end
976878
def _get_proc_like_prefix(self, sig):
        
        sig_match = chpl_sig_pattern.match(sig)
        if sig_match is None:
            return ChapelObject.get_signature_prefix(self, sig)

        prefixes, _, _, _, _ = sig_match.groups()
        if prefixes:
            return prefixes.strip() + ' '
        elif self.objtype.startswith('iter'):
            return 'iter' + ' '
        elif self.objtype in ('method', 'function'):
            return 'proc' + ' '
        else:
            return ChapelObject.get_signature_prefix(self, sig)
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