<commit_before>local function class(new, extends, name)
	local base_mt = {
		__index = new;
	}
	setmetatable(new, {
		__tostring = function()
			return name
		end;
		__call = function(...)
			local instance = setmetatable({}, base_mt)
			if new.__init then
				new.__init(instance, ...)
			end
			return instance
		end;
		__index = extends;
	})
	return new
end

return class
<commit_msg>class: add __tostring and track arguments better<commit_after>local function class(new, extends, name)
	local base_mt = {
		__index = new;
		__tostring = function(self)
			return (name .. "(" .. table.concat(self.__args, ", ") .. ")")
		end;
	}
	setmetatable(new, {
		__tostring = function()
			return name
		end;
		__call = function(this_class, ...) -- luacheck: ignore 212
			local instance = setmetatable({}, base_mt)
			instance.__args = {}
			for i, v in ipairs({...}) do
				local _type = type(v)
				if _type == "string" then
					instance.__args[i] = ("%q"):format(v)
				else
					instance.__args[i] = tostring(v)
				end
			end
			instance.__class = new
			if new.__init then
				new.__init(instance, ...)
			end
			return instance
		end;
		__index = extends;
	})
	return new
end

return class

{'fraction_non_alphanumeric': 0.13266162888329136, 'fraction_numerical': 0.0025188916876574307, 'mean_word_length': 2.947019867549669, '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': '5181138', 'n_tokens_mistral': 486, 'n_tokens_neox': 410, 'n_words': 110}