<commit_before>require 'aptible/auth'

module Aptible
  module CLI
    module Helpers
      module Token
        def fetch_token
          @token ||= current_token_hash[Aptible::Auth.configuration.root_url]
          return @token if @token
          fail Thor::Error, 'Could not read token: please run aptible login'
        end

        def save_token(token)
          hash = current_token_hash.merge(
            Aptible::Auth.configuration.root_url => token
          )

          FileUtils.mkdir_p(File.dirname(token_file))<commit_msg>Check for token in APTIBLE_ACCESS_TOKEN<commit_after>require 'aptible/auth'

module Aptible
  module CLI
    module Helpers
      module Token
        TOKEN_ENV_VAR = 'APTIBLE_ACCESS_TOKEN'

        def fetch_token
          @token ||= ENV[TOKEN_ENV_VAR] ||
                     current_token_hash[Aptible::Auth.configuration.root_url]
          return @token if @token
          fail Thor::Error, 'Could not read token: please run aptible login ' \
                            "or set #{TOKEN_ENV_VAR}"
        end

        def save_token(token)
          hash = current_token_hash.merge(
            Aptible::Auth.configuration.root_url => token
          )

          FileUtils.mkdir_p(File.dirname(token_file))
{'fraction_non_alphanumeric': 0.0773524720893142, 'fraction_numerical': 0.0, 'mean_word_length': 2.217948717948718, 'pattern_counts': {'":': 0, '<': 3, '<?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': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3288539', 'n_tokens_mistral': 368, 'n_tokens_neox': 358, 'n_words': 81}