<commit_before>require 'aws-sdk'

class Stack
  attr_accessor :stack, :name, :deployed

  SUCESS_STATES  = ["CREATE_COMPLETE", "UPDATE_COMPLETE"]
  FAILURE_STATES = ["CREATE_FAILED", "DELETE_FAILED", "UPDATE_ROLLBACK_FAILED", "ROLLBACK_FAILED", "ROLLBACK_COMPLETE","ROLLBACK_FAILED","UPDATE_ROLLBACK_COMPLETE","UPDATE_ROLLBACK_FAILED"]
  END_STATES     = SUCESS_STATES + FAILURE_STATES

  # WAITING_STATES = ["CREATE_IN_PROGRESS","DELETE_IN_PROGRESS","ROLLBACK_IN_PROGRESS","UPDATE_COMPLETE_CLEANUP_IN_PROGRESS","UPDATE_IN_PROGRESS","UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS","UPDATE_ROLLBACK_IN_PROGRESS"]
  def initialize(stack_name)
    @name = stack_name
    @cf = AWS::CloudFormation.new
    @stack = @cf.stacks[name]
    @ec2 = AWS::EC2.new
  end

  def deployed
    return stack.exists?
  end

  def apply(template_file, parameters, disable_rollback=false, capabilities=[], notify=[])
    if ( template_file =~ /^https:\/\/s3\S+\.amazonaws\.com\/(.*)/ )
      template = template_file<commit_msg>add open regex that checks on https and .json<commit_after>require 'aws-sdk'

class Stack
  attr_accessor :stack, :name, :deployed

  SUCESS_STATES  = ["CREATE_COMPLETE", "UPDATE_COMPLETE"]
  FAILURE_STATES = ["CREATE_FAILED", "DELETE_FAILED", "UPDATE_ROLLBACK_FAILED", "ROLLBACK_FAILED", "ROLLBACK_COMPLETE","ROLLBACK_FAILED","UPDATE_ROLLBACK_COMPLETE","UPDATE_ROLLBACK_FAILED"]
  END_STATES     = SUCESS_STATES + FAILURE_STATES

  # WAITING_STATES = ["CREATE_IN_PROGRESS","DELETE_IN_PROGRESS","ROLLBACK_IN_PROGRESS","UPDATE_COMPLETE_CLEANUP_IN_PROGRESS","UPDATE_IN_PROGRESS","UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS","UPDATE_ROLLBACK_IN_PROGRESS"]
  def initialize(stack_name)
    @name = stack_name
    @cf = AWS::CloudFormation.new
    @stack = @cf.stacks[name]
    @ec2 = AWS::EC2.new
  end

  def deployed
    return stack.exists?
  end

  def apply(template_file, parameters, disable_rollback=false, capabilities=[], notify=[])
    if ( template_file =~ /^https:\/\/.*(.json)$/ )
      template = template_file
    elsif ( template_file =~ /^https:\/\/s3\S+\.amazonaws\.com\/(.*)/ )
      template = template_file
{'fraction_non_alphanumeric': 0.13227016885553472, 'fraction_numerical': 0.0028142589118198874, 'mean_word_length': 5.686520376175548, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6403919', 'n_tokens_mistral': 776, 'n_tokens_neox': 788, 'n_words': 110}