<commit_before>#!/usr/bin/env lua

-- over-ride or define stubs for functions
strfind = string.find
strsub = string.sub


function GetAddOnMetadata( )
	return "@VERSION@"
end
SlashCmdList = {}

-- import the addon file
package.path = "/usr/local/bin/?.lua;'" .. package.path
require "c"

-- find ~/.calc
pathSeparator = string.sub( package.config, 1, 1 ) -- first character of this string (http://www.lua.org/manual/5.2/manual.html#pdf-package.config)
settingsFilePath = {
	os.getenv( "HOME" ),
	".calc"
}
settingsFile = table.concat( settingsFilePath, pathSeparator )
-- load ~/.calc
function DoFile( filename )
	local f = assert( loadfile( filename ) )
	return f()
end
DoFile( settingsFile )

-- remove the WowSpecific commands
WowSpecific = {"gold","silver","copper","health","hp",
		"power","haste","mastery","honor","conquest",
		"cp","valor","vp","justice","jp","token"}
for _, fun in pairs(WowSpecific) do
	calc.functions[fun] = nil
end

-- over-ride some functions.
function calc.Print( msg )
	msg = "> "..msg;
	print( msg )
end

-- add a command to quit
calc.functions["quit"] = function() running=false end
calc.functions["exit"] = calc.functions["quit"]
calc.functions["q"] = calc.functions["quit"]
print("Calc (v@VERSION@)")

-- Start the calculator<commit_msg>Catch missing settings file, and don't error out<commit_after>#!/usr/bin/env lua

-- over-ride or define stubs for functions
strfind = string.find
strsub = string.sub


function GetAddOnMetadata( )
	return "@VERSION@"
end
SlashCmdList = {}

-- import the addon file
package.path = "/usr/local/bin/?.lua;'" .. package.path
require "c"

-- find ~/.calc
pathSeparator = string.sub( package.config, 1, 1 ) -- first character of this string (http://www.lua.org/manual/5.2/manual.html#pdf-package.config)
settingsFilePath = {
	os.getenv( "HOME" ),
	".calc"
}
settingsFile = table.concat( settingsFilePath, pathSeparator )
-- load ~/.calc
function DoFile( filename )
	local f, err = loadfile( filename )
	if f then
		return f()
	else
		calc_macros = {}
	end
end
DoFile( settingsFile )

-- remove the WowSpecific commands
WowSpecific = {"gold","silver","copper","health","hp",
		"power","haste","mastery","honor","conquest",
		"cp","valor","vp","justice","jp","token"}
for _, fun in pairs(WowSpecific) do
	calc.functions[fun] = nil
end

-- over-ride some functions.
function calc.Print( msg )
	msg = "> "..msg;
	print( msg )
end

-- add a command to quit
calc.functions["quit"] = function() running=false end
calc.functions["exit"] = calc.functions["quit"]
calc.functions["q"] = calc.functions["quit"]
print("Calc (v@VERSION@)")

-- Start the calculator
{'fraction_non_alphanumeric': 0.17188693659281895, 'fraction_numerical': 0.0030557677616501145, 'mean_word_length': 4.422360248447205, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '1143203', 'n_tokens_mistral': 902, 'n_tokens_neox': 860, 'n_words': 228}