<commit_before># encoding: utf-8

module Nanoc3

  # Represents a compileable item in a site. It has content and attributes, as
  # well as an identifier (which starts and ends with a slash). It can also
  # store the modification time to speed up compilation.
  class Item

    # @return [Nanoc3::Site] The site this item belongs to
    attr_accessor :site

    # @return [Hash] This item's attributes
    attr_accessor :attributes

    # @return [String] This item's identifier
    attr_accessor :identifier

    # @return [Time] The time when this item was last modified
    attr_reader   :mtime

    # @return [Array<Nanoc3::ItemRep>] This item’s list of item reps
    attr_reader   :reps

    # @return [String] This item's raw, uncompiled content of this item (only
    # available for textual items)
    attr_reader   :raw_content

    # @return [String] The filename pointing to the file containing this
    # item’s content (only available for binary items)
    attr_reader   :raw_filename

    # @return [Nanoc3::Item, nil] The parent item of this item. This can be
    # nil even for non-root items.
    attr_accessor :parent

    # @return [Array<Nanoc3::Item>] The child items of this item
    attr_accessor :children

    # @return [Boolean] Whether or not this item is outdated because of its
    # dependencies are outdated
    attr_accessor :outdated_due_to_dependencies
    alias_method :outdated_due_to_dependencies?, :outdated_due_to_dependencies

    # Creates a new item with the given content or filename, attributes and
    # identifier.
    #
    # Note that the API in 3.1 has changed a bit since 3.0; the API remains
    # backwards compatible, however. Passing the modification time as the 4th
    # parameter is deprecated; pass it as the `:mtime` method option instead.
    #
    # @param [String] raw_content_or_raw_filename The uncompiled item content
    # (if it is a textual item) or the path to the filename containing the
    # content (if it is a binary item).
    #
    # @param [Hash] attributes A hash containing this item's attributes.
    #
    # @param [String] identifier This item's identifier.
    #
    # @param [Time, Hash, nil] params_or_mtime Extra parameters for the item,
    # or the time when this item was last modified (deprecated).
    #
    # @option params_or_mtime [Time, nil] :mtime (nil) The time when this item
    # was last modified
    #
    # @option params_or_mtime [Symbol, nil] :binary (true) Whether or not this
    # item is binary
    def initialize(raw_content_or_raw_filename, attributes, identifier, params_or_mtime=nil)
      # Get params and mtime
      # TODO [in nanoc 4.0] clean this up
      if params_or_mtime.nil? || params_or_mtime.is_a?(Time)
        params = {}
        @mtime = params_or_mtime
      elsif params_or_mtime.is_a?(Hash)
        params = params_or_mtime
        @mtime = params[:mtime]
      end

      # Get type and raw content or raw filename
      @is_binary = params.has_key?(:binary) ? params[:binary] : true
      if @is_binary
        @raw_filename = raw_content_or_raw_filename
      else
        @raw_content  = raw_content_or_raw_filename
      end<commit_msg>made item initializer default to non-binary<commit_after># encoding: utf-8

module Nanoc3

  # Represents a compileable item in a site. It has content and attributes, as
  # well as an identifier (which starts and ends with a slash). It can also
  # store the modification time to speed up compilation.
  class Item

    # @return [Nanoc3::Site] The site this item belongs to
    attr_accessor :site

    # @return [Hash] This item's attributes
    attr_accessor :attributes

    # @return [String] This item's identifier
    attr_accessor :identifier

    # @return [Time] The time when this item was last modified
    attr_reader   :mtime

    # @return [Array<Nanoc3::ItemRep>] This item’s list of item reps
    attr_reader   :reps

    # @return [String] This item's raw, uncompiled content of this item (only
    # available for textual items)
    attr_reader   :raw_content

    # @return [String] The filename pointing to the file containing this
    # item’s content (only available for binary items)
    attr_reader   :raw_filename

    # @return [Nanoc3::Item, nil] The parent item of this item. This can be
    # nil even for non-root items.
    attr_accessor :parent

    # @return [Array<Nanoc3::Item>] The child items of this item
    attr_accessor :children

    # @return [Boolean] Whether or not this item is outdated because of its
    # dependencies are outdated
    attr_accessor :outdated_due_to_dependencies
    alias_method :outdated_due_to_dependencies?, :outdated_due_to_dependencies

    # Creates a new item with the given content or filename, attributes and
    # identifier.
    #
    # Note that the API in 3.1 has changed a bit since 3.0; the API remains
    # backwards compatible, however. Passing the modification time as the 4th
    # parameter is deprecated; pass it as the `:mtime` method option instead.
    #
    # @param [String] raw_content_or_raw_filename The uncompiled item content
    # (if it is a textual item) or the path to the filename containing the
    # content (if it is a binary item).
    #
    # @param [Hash] attributes A hash containing this item's attributes.
    #
    # @param [String] identifier This item's identifier.
    #
    # @param [Time, Hash, nil] params_or_mtime Extra parameters for the item,
    # or the time when this item was last modified (deprecated).
    #
    # @option params_or_mtime [Time, nil] :mtime (nil) The time when this item
    # was last modified
    #
    # @option params_or_mtime [Symbol, nil] :binary (true) Whether or not this
    # item is binary
    def initialize(raw_content_or_raw_filename, attributes, identifier, params_or_mtime=nil)
      # Get params and mtime
      # TODO [in nanoc 4.0] clean this up
      if params_or_mtime.nil? || params_or_mtime.is_a?(Time)
        params = {}
        @mtime = params_or_mtime
      elsif params_or_mtime.is_a?(Hash)
        params = params_or_mtime
        @mtime = params[:mtime]
      end

      # Get type and raw content or raw filename
      @is_binary = params.has_key?(:binary) ? params[:binary] : false
      if @is_binary
        @raw_filename = raw_content_or_raw_filename
      else
        @raw_content  = raw_content_or_raw_filename
      end
{'fraction_non_alphanumeric': 0.07135016465422613, 'fraction_numerical': 0.004077152265955779, 'mean_word_length': 3.1228183581124758, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '7022679', 'n_tokens_mistral': 1921, 'n_tokens_neox': 1842, 'n_words': 726}