<commit_before>require 'backports'

module SymEngine
  class << self
    # Defines a shortcut for SymEngine::Symbol.new() allowing multiple symbols
    # to be created all at once.
    #
    # Examples:
    #
    #    x, y = SymEngine.symbols(%i{x y})
    #    x, y = SymEngine.symbols(%w{x y})
    #    x, y = SymEngine.symbols([:x, :y])
    #    x, y = SymEngine.symbols(['x', 'y'])
    #    x, y = SymEngine.symbols('x', 'y')
    #    x, y = SymEngine.symbols('x y')
    #
    def symbols(ary_or_string, *params)
      # Want to make sure we can accept an array or a bunch of splatted arguments
      if !params.empty?
        ary_or_string = (ary_or_string.is_a?(String) ? [ary_or_string] : ary_or_string).concat(params)
      elsif ary_or_string.is_a?(String)
        # or accept a string
        ary_or_string = ary_or_string.split
      end

      # Make an Array of SymEngine::Symbols from the parameters we received,
      # now that they're normalized.
      ary_or_string.map do |symbol_or_string|
        SymEngine::Symbol.new(symbol_or_string)
      end
    end

    def Function(n) # rubocop:disable Style/MethodName
      SymEngine::UndefFunction.new(n)
    end

    def evalf(operand, prec = 53, real = false)
      _evalf(operand, prec, real)
    end

    def lambdify(exp, *syms)
      syms.flatten!
      if exp.free_symbols.count > syms.length
        raise ArgumentError, 'Formula contains #{exp.free_symbols.count} free '\
                             'symbols. You should provide at least this number '\
                             'of arguments (only #{syms.length} given).'
      end<commit_msg>Fix single-quotes<commit_after>require 'backports'

module SymEngine
  class << self
    # Defines a shortcut for SymEngine::Symbol.new() allowing multiple symbols
    # to be created all at once.
    #
    # Examples:
    #
    #    x, y = SymEngine.symbols(%i{x y})
    #    x, y = SymEngine.symbols(%w{x y})
    #    x, y = SymEngine.symbols([:x, :y])
    #    x, y = SymEngine.symbols(['x', 'y'])
    #    x, y = SymEngine.symbols('x', 'y')
    #    x, y = SymEngine.symbols('x y')
    #
    def symbols(ary_or_string, *params)
      # Want to make sure we can accept an array or a bunch of splatted arguments
      if !params.empty?
        ary_or_string = (ary_or_string.is_a?(String) ? [ary_or_string] : ary_or_string).concat(params)
      elsif ary_or_string.is_a?(String)
        # or accept a string
        ary_or_string = ary_or_string.split
      end

      # Make an Array of SymEngine::Symbols from the parameters we received,
      # now that they're normalized.
      ary_or_string.map do |symbol_or_string|
        SymEngine::Symbol.new(symbol_or_string)
      end
    end

    def Function(n) # rubocop:disable Style/MethodName
      SymEngine::UndefFunction.new(n)
    end

    def evalf(operand, prec = 53, real = false)
      _evalf(operand, prec, real)
    end

    def lambdify(exp, *syms)
      syms.flatten!
      if exp.free_symbols.count > syms.length
        raise ArgumentError, "Formula contains #{exp.free_symbols.count} free "\
                             'symbols. You should provide at least this number '\
                             "of arguments (only #{syms.length} given)."
      end
{'fraction_non_alphanumeric': 0.10936537276648182, 'fraction_numerical': 0.0012322858903265558, 'mean_word_length': 2.3787721123829346, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4070962', 'n_tokens_mistral': 1085, 'n_tokens_neox': 1061, 'n_words': 282}