<commit_before>require 'date'
require 'bigdecimal'
require 'bigdecimal/util'
require 'active_support/core_ext/big_decimal/conversions'
require 'active_support/core_ext/string/conversions'

module Neo4j::Shared
  class Boolean;
  end

  module TypeConverters
    CONVERTERS = {}

    class Boolean;
    end

    class BaseConverter
      class << self
        def converted?(value)
          value.is_a?(db_type)
        end
      end

      def supports_array?
        false
      end
    end

    class IntegerConverter < BaseConverter
      class << self
        def convert_type
          Integer
        end

        def db_type
          Integer
        end

        def to_db(value)
          value.to_i
        end

        alias to_ruby to_db
      end
    end

    class FloatConverter < BaseConverter
      class << self
        def convert_type
          Float
        end

        def db_type
          Float
        end

        def to_db(value)
          value.to_f
        end

        alias to_ruby to_db
      end
    end

    class BigDecimalConverter < BaseConverter
      class << self
        def convert_type
          BigDecimal
        end

        def db_type
          String
        end

        def to_db(value)
          case value
          when Rational
            value.to_f.to_d
          when respond_to?(:to_d)
            value.to_d
          else
            BigDecimal.new(value.to_s)
          end.to_s
        end

        def to_ruby(value)
          value.to_d
        end
      end
    end

    class StringConverter < BaseConverter
      class << self
        def convert_type
          String
        end

        def db_type
          String
        end

        def to_db(value)
          value.to_s
        end

        alias to_ruby to_db
      end
    end

    class BooleanConverter < BaseConverter
      FALSE_VALUES = %w(n N no No NO false False FALSE off Off OFF f F).to_set

      class << self
        def converted?(value)
          converted_values.include?(value)
        end

        def converted_values<commit_msg>reverting unintentional formatting<commit_after>require 'date'
require 'bigdecimal'
require 'bigdecimal/util'
require 'active_support/core_ext/big_decimal/conversions'
require 'active_support/core_ext/string/conversions'

module Neo4j::Shared
  class Boolean; end

  module TypeConverters
    CONVERTERS = {}

    class Boolean; end

    class BaseConverter
      class << self
        def converted?(value)
          value.is_a?(db_type)
        end
      end

      def supports_array?
        false
      end
    end

    class IntegerConverter < BaseConverter
      class << self
        def convert_type
          Integer
        end

        def db_type
          Integer
        end

        def to_db(value)
          value.to_i
        end

        alias to_ruby to_db
      end
    end

    class FloatConverter < BaseConverter
      class << self
        def convert_type
          Float
        end

        def db_type
          Float
        end

        def to_db(value)
          value.to_f
        end
        alias to_ruby to_db
      end
    end

    class BigDecimalConverter < BaseConverter
      class << self
        def convert_type
          BigDecimal
        end

        def db_type
          String
        end

        def to_db(value)
          case value
          when Rational
            value.to_f.to_d
          when respond_to?(:to_d)
            value.to_d
          else
            BigDecimal.new(value.to_s)
          end.to_s
        end

        def to_ruby(value)
          value.to_d
        end
      end
    end

    class StringConverter < BaseConverter
      class << self
        def convert_type
          String
        end

        def db_type
          String
        end

        def to_db(value)
          value.to_s
        end
        alias to_ruby to_db
      end
    end

    class BooleanConverter < BaseConverter
      FALSE_VALUES = %w(n N no No NO false False FALSE off Off OFF f F).to_set

      class << self
        def converted?(value)
          converted_values.include?(value)
        end

        def converted_values
{'fraction_non_alphanumeric': 0.04319654427645788, 'fraction_numerical': 0.00047996160307175426, 'mean_word_length': 1.4078567302137492, 'pattern_counts': {'":': 0, '<': 37, '<?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': '2630090', 'n_tokens_mistral': 1198, 'n_tokens_neox': 1150, 'n_words': 319}