<commit_before>class STRC
	Exception = Class.new(StandardError)

	def initialize
		@dict = {}
	end

	# Set a given key to a value
	def set(key, value)
		@dict[key] = value
		return "OK"
	end

	# Get the value for the given key
	def get(key)
		@dict[key]
	end

	# Add a member to a set
	def sadd(key, *args)
		if args.length < 1
			raise STRC::Exception.new "Wrong number of arguments (1 for 2)"
		end
		if @dict.has_key?(key)
			if @dict[key].class == Array
				@dict[key] << args
			else
				raise STRC::Exception.new "ERR Operation against a key holding the wrong kind of value"
			end
		else
			@dict[key] = args
		end
		return args.length
	end

	# Remove a member from a set
	def srem(key, member)
		if sismember(key, member)
			@dict[key].delete_at(@dict[key].index(member))
			return true
		else
			return false
		end
	end

	# Determine if the given value is a member of the set at key
	def sismember(key, member)
		if @dict.has_key?(key)
			if @dict[key].class == Array
				return true unless @dict[key].index(member).nil?
			else
				raise STRC::Exception .new "ERR Operation against a key holding the wrong kind of value"
			end
		end
		return false
	end

	# Returns an array of members of the set
	def smembers(key)
		if @dict.has_key?(key)
			if @dict[key].class == Array
				return @dict[key]
			else
				raise STRC::Exception .new "ERR Operation against a key holding the wrong kind of value"
			end
		else
			return []
		end
	end

	# Gets the length of a set
	def scard(key)
		if @dict.has_key?(key)
			if @dict[key].class == Array
				@dict[key].length
			else
				raise STRC::Exception.new "ERR Operation against a key holding the wrong kind of value"
			end
		else
			return 0
		end
	end<commit_msg>added smembers, made the other set commands a little more readable<commit_after>class STRC
	Exception = Class.new(StandardError)

	def initialize
		@dict = {}
	end

	# Set a given key to a value
	def set(key, value)
		@dict[key] = value
		return "OK"
	end

	# Get the value for the given key
	def get(key)
		@dict[key]
	end

	# Add a member to a set
	def sadd(key, *args)
		if args.length < 1
			raise STRC::Exception.new "Wrong number of arguments (1 for 2)"
		end
		# if @dict.has_key?(key)
		# 	if @dict[key].class == Array
		# 		@dict[key] << args
		# 	else
		# 		raise STRC::Exception.new "ERR Operation against a key holding the wrong kind of value"
		# 	end
		# else
		# 	@dict[key] = args
		# end
		set = smembers(key)
		@dict[key] = set + args
		return args.length
	end

	# Remove a member from a set
	def srem(key, member)
		if sismember(key, member)
			@dict[key].delete_at(@dict[key].index(member))
			return true
		else
			return false
		end
	end

	# Determine if the given value is a member of the set at key
	def sismember(key, member)
		# if @dict.has_key?(key)
		# 	if @dict[key].class == Array
		# 		return true unless @dict[key].index(member).nil?
		# 	else
		# 		raise STRC::Exception .new "ERR Operation against a key holding the wrong kind of value"
		# 	end
		# end
		set = smembers(key)
		return !set.index(member).nil?
		#return false
	end

	# Returns an array of members of the set
	def smembers(key)
		if @dict.has_key?(key)
			if @dict[key].class == Array
				return @dict[key]
			else
				raise STRC::Exception .new "ERR Operation against a key holding the wrong kind of value"
			end
		else
			return []
		end
	end

	# Gets the length of a set
	def scard(key)
		# if @dict.has_key?(key)
		# 	if @dict[key].class == Array
		# 		@dict[key].length
		# 	else
		# 		raise STRC::Exception.new "ERR Operation against a key holding the wrong kind of value"
		# 	end
		# else
		# 	return 0
		# end
		set = smembers(key)
		return set.length
	end
{'fraction_non_alphanumeric': 0.10051616408584624, 'fraction_numerical': 0.0021733224667209996, 'mean_word_length': 3.0065288356909683, 'pattern_counts': {'":': 0, '<': 9, '<?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': '3565833', 'n_tokens_mistral': 1485, 'n_tokens_neox': 1308, 'n_words': 464}