<commit_before>local Players = game:GetService("Players")

-------------------------
-- Documentation Stuff --
-------------------------

-- Revised November 13th, 2015
-- @author Quenty
-- This script handles a variety of tasks and generic functions that are useful for
-- ROBLOX game developement. It is meant to be imported into another script.
-- @return The qSystems library. 

--[[
Updates and Changes log
November 21st, 2015
- Removed Signal library, and Nevermore dependency

November 15th, 2015
- Updated documentation
- Cleaned up code a bit

November 17th, 2014
- Removed importing into the environment

August 18th, 2014
- Removed isA method
- Cleaned up commented code
- Removed classOrServiceAlreadyExists

August 14th, 2014
- Updated Make() so it doesn't create a new function to function (no pun intended)
- Removed warn() function, as ROBLOX has a native one.

March 6th, 2014
- Updated WaitForChild to have a time limit
- Modified WaitForChild to make sure the parent isn't nil

February 9th, 2014
- Updated CheckCharacter to check for HumanoidRootPart

January 26th, 2014
- Removed old code
- Fixed issue with constructor and class system

January 25th, 2014
- Updated Class System to return extra parameters from constructor pass constructed object. 

Janurary 4th, 2014
- Removed the class and service list for performance reasons

January 2nd, 2014
- Add Sign function

January 1st, 2014
- Fixed CheckCharacter to work with Local scripts (Replication change)

December 28th, 2013
- Removed VerifyArg and error functions
- Updated Headercode for new NevermoreEngine
- Started change log
- Setup qSystems to work with module scripts.
- Added new alias to roundnumber (Round)
]]
	
local lib = {}

-----------------------
-- General functions --
-----------------------

local function RoundNumber(Number, Divider)
	-- Rounds a Number, with 1.5 rounding up to 2, and so forth, by default. 
	-- @param Number the Number to round
	-- @param [Divider] optional Number of which to "round" to. If nothing is given, it will default
	--     to 1.

	Divider = Divider or 1

	return (math.floor((Number/Divider)+0.5)*Divider)
end
lib.RoundNumber = RoundNumber
lib.Round = RoundNumber

local function Modify(Instance, Values)
	--- Modifies an Instance by using a table.  
	-- @param Instance The instance to modify
	-- @param Values A table with keys as the value to change, and the value as the property to
	--     assign

	assert(type(Values) == "table", "Values is not a table")

	for Index, Value in next, Values do
		if type(Index) == "number" then
			Value.Parent = Instance
		else
			Instance[Index] = Value
		end
	end
	return Instance
end

local function Make(ClassType, Properties)
	--- Using a syntax hack to create a nice way to Make new items.  
	-- @param ClassType The type of class to instantiate
	-- @param Properties The properties to use

	return Modify(Instance.new(ClassType), Properties)
end

lib.Modify = Modify
lib.Make = Make

local function WaitForChild(Parent, Name, TimeLimit)
	-- Waits for a child to appear. Not efficient, but it shoudln't have to be. It helps with
	-- debugging. Useful when ROBLOX lags out, and doesn't replicate quickly. Will warn
	-- @param Parent The Parent to search in for the child.
	-- @param Name The name of the child to search for
	-- @param TimeLimit If TimeLimit is given, then it will return after the t imelimit, even if it
	--     hasn't found the child.

	assert(Parent, "Parent is nil")
	assert(type(Name) == "string", "Name is not a string.")

	local Child     = Parent:FindFirstChild(Name)
	local StartTime = tick()
	local Warned    = false

	while not Child do
		wait()
		Child = Parent:FindFirstChild(Name)
		if not Warned and StartTime + (TimeLimit or 5) <= tick() then
			Warned = true
				warn("[WaitForChild] - Infinite yield possible for WaitForChild(" .. Parent:GetFullName() .. ", " .. Name .. ")")
			if TimeLimit then
				return Parent:FindFirstChild(Name)
			end
		end
	end

	return Child
end<commit_msg>Clean up some syntax and add more debug info<commit_after>local Players = game:GetService("Players")

-------------------------
-- Documentation Stuff --
-------------------------

-- Revised November 13th, 2015
-- @author Quenty
-- This script handles a variety of tasks and generic functions that are useful for
-- ROBLOX game developement. It is meant to be imported into another script.
-- @return The qSystems library. 

--[[
Updates and Changes log
November 21st, 2015
- Removed Signal library, and Nevermore dependency

November 15th, 2015
- Updated documentation
- Cleaned up code a bit

November 17th, 2014
- Removed importing into the environment

August 18th, 2014
- Removed isA method
- Cleaned up commented code
- Removed classOrServiceAlreadyExists

August 14th, 2014
- Updated Make() so it doesn't create a new function to function (no pun intended)
- Removed warn() function, as ROBLOX has a native one.

March 6th, 2014
- Updated WaitForChild to have a time limit
- Modified WaitForChild to make sure the parent isn't nil

February 9th, 2014
- Updated CheckCharacter to check for HumanoidRootPart

January 26th, 2014
- Removed old code
- Fixed issue with constructor and class system

January 25th, 2014
- Updated Class System to return extra parameters from constructor pass constructed object. 

Janurary 4th, 2014
- Removed the class and service list for performance reasons

January 2nd, 2014
- Add Sign function

January 1st, 2014
- Fixed CheckCharacter to work with Local scripts (Replication change)

December 28th, 2013
- Removed VerifyArg and error functions
- Updated Headercode for new NevermoreEngine
- Started change log
- Setup qSystems to work with module scripts.
- Added new alias to roundnumber (Round)
]]
	
local lib = {}

-----------------------
-- General functions --
-----------------------

local function RoundNumber(Number, Divider)
	-- Rounds a Number, with 1.5 rounding up to 2, and so forth, by default. 
	-- @param Number the Number to round
	-- @param [Divider] optional Number of which to "round" to. If nothing is given, it will default
	--     to 1.

	Divider = Divider or 1

	return math.floor(Number/Divider+0.5)*Divider
end
lib.RoundNumber = RoundNumber
lib.Round = RoundNumber

local function Modify(Instance, Values)
	--- Modifies an Instance by using a table.  
	-- @param Instance The instance to modify
	-- @param Values A table with keys as the value to change, and the value as the property to
	--     assign

	assert(type(Values) == "table", "Values is not a table")

	for Index, Value in next, Values do
		if type(Index) == "number" then
			Value.Parent = Instance
		else
			Instance[Index] = Value
		end
	end
	return Instance
end

local function Make(ClassType, Properties)
	--- Using a syntax hack to create a nice way to Make new items.  
	-- @param ClassType The type of class to instantiate
	-- @param Properties The properties to use

	return Modify(Instance.new(ClassType), Properties)
end

lib.Modify = Modify
lib.Make = Make

local function WaitForChild(Parent, Name, TimeLimit)
	-- Waits for a child to appear. Not efficient, but it shoudln't have to be. It helps with
	-- debugging. Useful when ROBLOX lags out, and doesn't replicate quickly. Will warn
	-- @param Parent The Parent to search in for the child.
	-- @param Name The name of the child to search for
	-- @param TimeLimit If TimeLimit is given, then it will return after the t imelimit, even if it
	--     hasn't found the child.

	assert(Parent, "Parent is nil")
	assert(type(Name) == "string", "Name is not a string.")

	local Child     = Parent:FindFirstChild(Name)
	local StartTime = tick()
	local Warned    = false

	while not Child do
		wait()
		Child = Parent:FindFirstChild(Name)
		if not Warned and StartTime + (TimeLimit or 5) <= tick() then
			Warned = true
				warn("[WaitForChild] - Infinite yield possible for WaitForChild(" .. Parent:GetFullName() .. ", " .. Name .. ")\n" .. debug.traceback())
			if TimeLimit then
				return Parent:FindFirstChild(Name)
			end
		end
	end

	return Child
end
{'fraction_non_alphanumeric': 0.09835657370517928, 'fraction_numerical': 0.02166334661354582, 'mean_word_length': 3.2435287902799788, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6619095', 'n_tokens_mistral': 2527, 'n_tokens_neox': 2230, 'n_words': 1045}