Take a JSON representation of data and explode it out into the constituent
 Lists and Items for the given Storage instance.

 Returns all hashes.
969784
def populate
      file = File.read(json_file)
      storage = JSON.parse(file, :symbolize_names => true)

      @hashes = storage[:hashes]
      convert if @hashes.is_a? Array

      @hashes
    end
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
1204580
def to_hash
            index_hash = Hash.new
            index_hash["json_claz"] = self.class.name
            index_hash["id"] = id
            index_hash["org_id"] = org_id
            index_hash["name"] = name
            index_hash["accounts_id"] = accounts_id
            index_hash["inputs"] = inputs
            index_hash["assemblies"] = assemblies
            index_hash["created_at"] = created_at
            index_hash["some_msg"] = some_msg
            index_hash
        end
621655
def as_json(options={})
      options = @options.merge(options)

      if options[:root]
        { options[:root].to_sym => serializable_hash }.merge(meta_hash).merge(data_hash)
      else
        serializable_hash
      end
    end
329760
def to_hash(args = {}) # :nodoc:
      args ||= {}

      if args[:nested]
        {'url' => self[:@url] || self[:url]}
      else
        hash = super
        hash.merge!('@version' => self['@version']) unless new_record?
        {self.class.json_name => hash}
      end
    end
1346270
def to_json(excluded_fields = [])
      hash = {}
      self.instance_variables.each do |var|
        hash[var.to_s.delete "@"] = self.instance_variable_get var unless excluded_fields.is_a?(Array) && excluded_fields.include?(var.to_s.delete "@")
      end
      JSON.pretty_generate(hash)
    end
496785
def to_hash
      keys = table_header_keys
      values = self
      hash = {}
      keys.each_with_index {|k,i| hash[k]=values[i]}
      return hash
    end
176416
def parse_json(json)
      hash = JSON.parse(json, :symbolize_names => true)

      # Convert hash[:created] and hash[:updated] to Time objects
      if hash[:created]
        hash.merge!({ :created => parse_iso_date_string(hash[:created]) })
      end

      if hash[:updated]
        hash.merge!({ :updated => parse_iso_date_string(hash[:updated]) })
      end

      hash
    end
1042981
def ToJson(self):
        
        items = []

        for i in self.Items:
            items.append({'index': i.index, 'height': i.height})

        return {
            'version': self.StateVersion,
            'txHash': self.TransactionHash.ToString(),
            'txHeight': self.TransactionHeight,
            'items': items
        }
156470
def hash_contents(contents):
    
    assert isinstance(contents, GroupNode)

    result = hashlib.sha256()

    def _hash_int(value):
        result.update(struct.pack(">L", value))

    def _hash_str(string):
        assert isinstance(string, string_types)
        _hash_int(len(string))
        result.update(string.encode())

    def _hash_object(obj):
        _hash_str(obj.json_type)
        if isinstance(obj, (TableNode, FileNode)):
            hashes = obj.hashes
            _hash_int(len(hashes))
            for hval in hashes:
                _hash_str(hval)
        elif isinstance(obj, GroupNode):
            children = obj.children
            _hash_int(len(children))
            for key, child in sorted(iteritems(children)):
                _hash_str(key)
                _hash_object(child)
        else:
            assert False, "Unexpected object: %r" % obj

        # Backward compatibility: only hash metadata_hash if it's present.
        if obj.metadata_hash is not None:
            _hash_str(obj.metadata_hash)

    _hash_object(contents)

    return result.hexdigest()
268613
def to_hash
            index_hash = {}
            index_hash['json_claz'] = self.class.name
            index_hash['id'] = id
            index_hash['name'] = name
            index_hash['tosca_type'] = tosca_type
            index_hash['inputs'] = inputs
            index_hash['outputs'] = outputs
            index_hash['envs'] = envs
            index_hash['artifacts'] = artifacts
            index_hash['related_components'] = related_components
            index_hash['operations'] = operations
            index_hash['status'] = status
            index_hash['state'] = state
            index_hash['repo'] = repo
            index_hash['created_at'] = created_at
            index_hash
        end
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
488368
def to_json(self, sort_keys=False):
    
    d = self.to_json_dict()
    return json.dumps(d, sort_keys=sort_keys)
1166757
def to_child_hash
      hash = {}
      children { |child| hash[child.name] = child.value }
      return hash
    end
221335
def to_hash
            index_hash = Hash.new
            index_hash["json_claz"] = self.class.name
            index_hash["id"] = id
            index_hash["account_id"] = account_id
            index_hash["model"] = model
            index_hash["license"] = license
            index_hash["trial_ends"] = trial_ends
            index_hash["created_at"] = created_at
            index_hash
        end
726983
def[](*keys)
      values = json.is_a?(Array) ? json : [json]
      keys.each { |key| values = values.map{ |value| value.is_a?(Hash) ? value[key] : nil} }
      json.is_a?(Array) ? values : values.first
    end
93391
def to_hash
        h = {}
        keys.each { |k| h[ k ] = self.fetch( k ) }
        h
    end