<commit_before>require 'active_support/core_ext/module/delegation'
require 'shellwords'

module Travis
  module Build
    class Data
      class Env
        delegate :secure_env_enabled?, :pull_request, :config, :build, :job, :repository, to: :data

        attr_reader :data

        def initialize(data)
          @data = data
        end

        def vars
          travis_vars + config_vars
        end

        private

          def travis_vars
            to_vars(
              TRAVIS_PULL_REQUEST:    pull_request || false,
              TRAVIS_SECURE_ENV_VARS: secure_env_vars?,
              TRAVIS_BUILD_ID:        build[:id],
              TRAVIS_BUILD_NUMBER:    build[:number],
              TRAVIS_BUILD_DIR:       [ BUILD_DIR, repository[:slug].shellescape ].join('/'),
              TRAVIS_JOB_ID:          job[:id],
              TRAVIS_JOB_NUMBER:      job[:number],
              TRAVIS_BRANCH:          job[:branch].shellescape,
              TRAVIS_COMMIT:          job[:commit],
              TRAVIS_COMMIT_RANGE:    job[:commit_range],
              TRAVIS_REPO_SLUG:       repository[:slug].shellescape,
              TRAVIS_OS_NAME:         job[:os],
            )
          end

          def extract_config_vars(vars)
            vars = to_vars(Array(vars).compact.reject(&:empty?))
            vars.reject!(&:secure?) unless secure_env_enabled?
            vars
          end

          def config_vars
            extract_config_vars(config[:global_env]) + extract_config_vars(config[:env])
          end

          def to_vars(args)
            args.to_a.map { |args| Var.create(*args) }.flatten
          end

          def secure_env_vars?
            secure_env_enabled? && config_vars.any?(&:secure?)
          end<commit_msg>Include Travis specific environment variables.<commit_after>require 'active_support/core_ext/module/delegation'
require 'shellwords'

module Travis
  module Build
    class Data
      class Env
        delegate :secure_env_enabled?, :pull_request, :config, :build, :job, :repository, to: :data

        attr_reader :data

        def initialize(data)
          @data = data
        end

        def vars
          travis_vars + config_vars
        end

        private

          def travis_vars
            to_vars(
              TRAVIS_PULL_REQUEST:    pull_request || false,
              TRAVIS_SECURE_ENV_VARS: secure_env_vars?,
              TRAVIS_BUILD_ID:        build[:id],
              TRAVIS_BUILD_NUMBER:    build[:number],
              TRAVIS_BUILD_DIR:       [ BUILD_DIR, repository[:slug].shellescape ].join('/'),
              TRAVIS_JOB_ID:          job[:id],
              TRAVIS_JOB_NUMBER:      job[:number],
              TRAVIS_BRANCH:          job[:branch].shellescape,
              TRAVIS_COMMIT:          job[:commit],
              TRAVIS_COMMIT_RANGE:    job[:commit_range],
              TRAVIS_REPO_SLUG:       repository[:slug].shellescape,
              TRAVIS_OS_NAME:         job[:os],
              TRAVIS:                 'true',
              CI:                     'true',
              CONTINUOUS_INTEGRATION: 'true'
            )
          end

          def extract_config_vars(vars)
            vars = to_vars(Array(vars).compact.reject(&:empty?))
            vars.reject!(&:secure?) unless secure_env_enabled?
            vars
          end

          def config_vars
            extract_config_vars(config[:global_env]) + extract_config_vars(config[:env])
          end

          def to_vars(args)
            args.to_a.map { |args| Var.create(*args) }.flatten
          end

          def secure_env_vars?
            secure_env_enabled? && config_vars.any?(&:secure?)
          end
{'fraction_non_alphanumeric': 0.08933405522468868, 'fraction_numerical': 0.0, 'mean_word_length': 1.6775362318840579, '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': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7561259', 'n_tokens_mistral': 1074, 'n_tokens_neox': 1057, 'n_words': 191}