<commit_before># frozen_string_literal: true

require 'bigdecimal'

##
# = Gruff. Graphs.
#
# Author:: <NAME> <EMAIL>
#
# Originally Created:: October 23, 2005
#
# Extra thanks to <NAME> for writing RMagick, and also contributions by
# <NAME>, <NAME>, <NAME>, <NAME>, <NAME>,
# <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, Cies
# Breijs, <NAME>, and a cast of thousands.
#
# See {Gruff::Base#theme=} for setting themes.
module Gruff
  using String::GruffCommify

  # A common base class inherited from class of drawing a graph.
  class Base
    # Space around text elements. Mostly used for vertical spacing.
    LEGEND_MARGIN = TITLE_MARGIN = 20.0
    LABEL_MARGIN = 15.0
    DEFAULT_MARGIN = 20.0

    DEFAULT_TARGET_WIDTH = 800.0

    # Blank space above the graph. Default is +20+.
    attr_writer :top_margin

    # Blank space below the graph. Default is +20+.
    attr_writer :bottom_margin

    # Blank space to the right of the graph. Default is +20+.
    attr_writer :right_margin

    # Blank space to the left of the graph. Default is +20+.
    attr_writer :left_margin

    # Blank space below the title. Default is +20+.
    attr_writer :title_margin

    # Blank space below the legend. Default is +20+.
    attr_writer :legend_margin

    # A hash of names for the individual columns, where the key is the array
    # index for the column this label represents.
    #
    # Not all columns need to be named.
    #
    # @example
    #   { 0 => 2005, 3 => 2006, 5 => 2007, 7 => 2008 }
    attr_writer :labels

    # Set a label for the bottom of the graph.
    attr_writer :x_axis_label

    # Set a label for the left side of the graph.
    attr_writer :y_axis_label

    # Allow passing lambda to format labels for x axis.
    attr_writer :x_axis_label_format

    # Allow passing lambda to format labels for y axis.
    attr_writer :y_axis_label_format

    # Set increment of the vertical marking lines.
    attr_writer :x_axis_increment

    # Set increment of the horizontal marking lines.
    attr_writer :y_axis_increment

    # Height of staggering between labels (Bar graph only).
    attr_writer :label_stagger_height

    # Truncates labels if longer than max specified.
    attr_writer :label_max_size

    # How truncated labels visually appear if they exceed {#label_max_size=}.
    #
    # - +:absolute+ - does not show trailing dots to indicate truncation. This is the default.
    # - +:trailing_dots+ - shows trailing dots to indicate truncation (note that {#label_max_size=}
    #   must be greater than 3).
    attr_writer :label_truncation_style

    # Get or set the list of colors that will be used to draw the bars or lines.
    attr_accessor :colors

    # Set the large title of the graph displayed at the top.
    attr_writer :title

    # Prevent drawing of line markers. Default is +false+.
    attr_writer :hide_line_markers

    # Prevent drawing of the legend. Default is +false+.
    attr_writer :hide_legend

    # Prevent drawing of the title. Default is +false+.
    attr_writer :hide_title

    # Prevent drawing of line numbers. Default is +false+.
    attr_writer :hide_line_numbers

    # Set a message shown when there is no data. Fits up to 20 characters. Defaults
    # to +"No Data."+.
    attr_writer :no_data_message

    # Display the legend under the graph. Default is +false+.
    attr_writer :legend_at_bottom

    # Set the color of the auxiliary lines.
    attr_writer :marker_color

    # Set the shadow color of the auxiliary lines.
    attr_writer :marker_shadow_color

    # Set the number of horizontal lines shown for reference.
    attr_writer :marker_count

    # Set to +true+ if you want the data sets sorted with largest avg values drawn
    # first. Default is +false+.
    attr_writer :sort

    # Set to +true+ if you want the data sets drawn with largest avg values drawn
    # first. This does not affect the legend. Default is +false+.
    attr_writer :sorted_drawing

    # Optionally set the size of the colored box by each item in the legend.
    # Default is +20.0+.
    #
    # Will be scaled down if graph is smaller than 800px wide.
    attr_writer :legend_box_size

    # If one numerical argument is given, the graph is drawn at 4/3 ratio
    # according to the given width (+800+ results in 800x600, +400+ gives 400x300,
    # etc.).
    #
    # Or, send a geometry string for other ratios ( +'800x400'+, +'400x225'+).
    #
    # @param target_width [Numeric, String] The graph image width.
    #
    def initialize(target_width = DEFAULT_TARGET_WIDTH)
      if target_width.is_a?(String)
        @columns, @rows = target_width.split('x').map(&:to_f)
      else
        @columns = target_width.to_f
        @rows = target_width.to_f * 0.75
      end
      @columns.freeze
      @rows.freeze
<commit_msg>chore: Reorder attributes<commit_after># frozen_string_literal: true

require 'bigdecimal'

##
# = Gruff. Graphs.
#
# Author:: <NAME> <EMAIL>
#
# Originally Created:: October 23, 2005
#
# Extra thanks to <NAME> for writing RMagick, and also contributions by
# <NAME>, <NAME>, <NAME>, <NAME>, <NAME>,
# <NAME>, <NAME>, <NAME>, <NAME>, Kevin <NAME>
# Breijs, <NAME>, and a cast of thousands.
#
# See {Gruff::Base#theme=} for setting themes.
module Gruff
  using String::GruffCommify

  # A common base class inherited from class of drawing a graph.
  class Base
    # Space around text elements. Mostly used for vertical spacing.
    LEGEND_MARGIN = TITLE_MARGIN = 20.0
    LABEL_MARGIN = 15.0
    DEFAULT_MARGIN = 20.0

    DEFAULT_TARGET_WIDTH = 800.0

    # Blank space above the graph. Default is +20+.
    attr_writer :top_margin

    # Blank space below the graph. Default is +20+.
    attr_writer :bottom_margin

    # Blank space to the right of the graph. Default is +20+.
    attr_writer :right_margin

    # Blank space to the left of the graph. Default is +20+.
    attr_writer :left_margin

    # Blank space below the title. Default is +20+.
    attr_writer :title_margin

    # Blank space below the legend. Default is +20+.
    attr_writer :legend_margin

    # A hash of names for the individual columns, where the key is the array
    # index for the column this label represents.
    #
    # Not all columns need to be named.
    #
    # @example
    #   { 0 => 2005, 3 => 2006, 5 => 2007, 7 => 2008 }
    attr_writer :labels

    # Truncates labels if longer than max specified.
    attr_writer :label_max_size

    # How truncated labels visually appear if they exceed {#label_max_size=}.
    #
    # - +:absolute+ - does not show trailing dots to indicate truncation. This is the default.
    # - +:trailing_dots+ - shows trailing dots to indicate truncation (note that {#label_max_size=}
    #   must be greater than 3).
    attr_writer :label_truncation_style

    # Height of staggering between labels (Bar graph only).
    attr_writer :label_stagger_height

    # Set a label for the bottom of the graph.
    attr_writer :x_axis_label

    # Set a label for the left side of the graph.
    attr_writer :y_axis_label

    # Allow passing lambda to format labels for x axis.
    attr_writer :x_axis_label_format

    # Allow passing lambda to format labels for y axis.
    attr_writer :y_axis_label_format

    # Set increment of the vertical marking lines.
    attr_writer :x_axis_increment

    # Set increment of the horizontal marking lines.
    attr_writer :y_axis_increment

    # Get or set the list of colors that will be used to draw the bars or lines.
    attr_accessor :colors

    # Set the large title of the graph displayed at the top.
    attr_writer :title

    # Prevent drawing of line markers. Default is +false+.
    attr_writer :hide_line_markers

    # Prevent drawing of the legend. Default is +false+.
    attr_writer :hide_legend

    # Prevent drawing of the title. Default is +false+.
    attr_writer :hide_title

    # Prevent drawing of line numbers. Default is +false+.
    attr_writer :hide_line_numbers

    # Set a message shown when there is no data. Fits up to 20 characters. Defaults
    # to +"No Data."+.
    attr_writer :no_data_message

    # Set the color of the auxiliary lines.
    attr_writer :marker_color

    # Set the shadow color of the auxiliary lines.
    attr_writer :marker_shadow_color

    # Set the number of horizontal lines shown for reference.
    attr_writer :marker_count

    # Set to +true+ if you want the data sets sorted with largest avg values drawn
    # first. Default is +false+.
    attr_writer :sort

    # Set to +true+ if you want the data sets drawn with largest avg values drawn
    # first. This does not affect the legend. Default is +false+.
    attr_writer :sorted_drawing

    # Display the legend under the graph. Default is +false+.
    attr_writer :legend_at_bottom

    # Optionally set the size of the colored box by each item in the legend.
    # Default is +20.0+.
    #
    # Will be scaled down if graph is smaller than 800px wide.
    attr_writer :legend_box_size

    # If one numerical argument is given, the graph is drawn at 4/3 ratio
    # according to the given width (+800+ results in 800x600, +400+ gives 400x300,
    # etc.).
    #
    # Or, send a geometry string for other ratios ( +'800x400'+, +'400x225'+).
    #
    # @param target_width [Numeric, String] The graph image width.
    #
    def initialize(target_width = DEFAULT_TARGET_WIDTH)
      if target_width.is_a?(String)
        @columns, @rows = target_width.split('x').map(&:to_f)
      else
        @columns = target_width.to_f
        @rows = target_width.to_f * 0.75
      end
      @columns.freeze
      @rows.freeze

{'fraction_non_alphanumeric': 0.07666666666666666, 'fraction_numerical': 0.019791666666666666, 'mean_word_length': 2.949403537638832, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 39, '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': '2310040', 'n_tokens_mistral': 3119, 'n_tokens_neox': 2792, 'n_words': 1166}