<commit_before>module OpenStack
module Compute

  class Metadata

    def initialize(connection, parent_url, metadata=nil)
      @connection = connection
      @base_url = "#{parent_url}/metadata"
      @metadata = metadata
    end

    def [](key)
      refresh if @metadata.nil?
      @metadata[key]
    end

    def []=(key, value)
      @metadata = {} if @metadata.nil?
      @metadata[key] = value
    end

    def store(key, value)
      @metadata = {} if @metadata.nil?
      @metadata[key] = value
    end

    def each_pair
      @metadata = {} if @metadata.nil?
      @metadata.each_pair do |k,v|
          yield k, v
      end
    end

    def each
      refresh if @metadata.nil?
      @metadata.each
    end
<commit_msg>Add size method to metadata.<commit_after>module OpenStack
module Compute

  class Metadata

    def initialize(connection, parent_url, metadata=nil)
      @connection = connection
      @base_url = "#{parent_url}/metadata"
      @metadata = metadata
    end

    def [](key)
      refresh if @metadata.nil?
      @metadata[key]
    end

    def []=(key, value)
      @metadata = {} if @metadata.nil?
      @metadata[key] = value
    end

    def store(key, value)
      @metadata = {} if @metadata.nil?
      @metadata[key] = value
    end

    def each_pair
      @metadata = {} if @metadata.nil?
      @metadata.each_pair do |k,v|
          yield k, v
      end
    end

    def size
      @metadata = {} if @metadata.nil?
      @metadata.size
    end

    def each
      refresh if @metadata.nil?
      @metadata.each
    end

{'fraction_non_alphanumeric': 0.10748560460652591, 'fraction_numerical': 0.0, 'mean_word_length': 2.1155378486055776, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3202234', 'n_tokens_mistral': 493, 'n_tokens_neox': 475, 'n_words': 135}