<commit_before>#!/usr/bin/python
# -*- coding: utf-8 -*-

import re
from datetime import timedelta
from decimal import Decimal
from math import floor

from .paperdoll import Paperdoll


def case_insensitive(lower):
	upper = [k.upper() for k in lower]
	lower.extend(upper)

booleans = "gl"
functions = ["cond", "eq", "floor", "gt", "max", "min"]
case_insensitive(functions)
macros = "AFMRSabderfhimnoqrstuvxz"
variables = ["pbhd", "spfi", "spfr", "bc2", "hnd", "mwb", "mws", "pbh", "pfi", "pfr", "rap", "rwb", "spa", "sph", "spi", "spn", "sps", "mwb", "rwb", "ap", "ar", "bh", "mw", "mw", "pa", "pl", "ph", "pn", "ps", "sp"]
case_insensitive(variables)
functions_s = "|".join(functions)
macros_s = "|".join(macros)
variables_s = "|".join(variables)

sre_function = re.compile(r"(%s)\(([^,]+),([^,)]+),?([^)]?)\)" % "|".join(functions)) # cond|eq|max|min(arg1, arg2[, arg3])
# (cond|eq|max|min) # NO EMBEDDED FUNCTION SUPPORT
# \(                # opening parenthese
#   ([^,]+),        # grab anything except a "," followed by a ","
#   ([^,)]+)        # grab anything except ",)"
#         ,?        # followed by , (optional if third arg exists)
#   ([^)]?)         # grab anything but a parenthese (optional)
# \)                # closing parenthese

sre_boolean = re.compile(r"(%s)([^:]+):([^;]+);" % "|".join(booleans)) # g|lFirst String:Second String;
sre_braces = re.compile(r"\{([^}]+)\}\.?(\d+)?") # ${} not supported
sre_learned = re.compile(r"\?(%s)(\d+)\[([^\]]*)\]\[([^\]]*)\]" % macros_s)
sre_operator = re.compile(r"[*/](\d+);(\d*)(%s)([123]?)" % macros_s) # /1000;54055o2
sre_macro = re.compile(r"(\d*)(%s)([123]?)" % macros_s)
sre_variables = re.compile(r"(%s)" % variables_s)


variabledict = {
	"ap":   "ATTACK_POWER",
	"ar":   "ARMOR",
	"bc2":  "PERCENT_BC2",
	"bh":   "BONUS_HEALING",
	"hnd":  "MAIN_WPN_HANDS",
	"mw":   "MAIN_WPN_DMG",
	"mws":  "MAIN_WPN_SPEED",
	"pa":   "PERCENT_ARCANE",
	"pfi":  "PERCENT_FIRE",
	"pfr":  "PERCENT_FROST",
	"ph":   "PERCENT_HOLY",
	"pn":   "PERCENT_NATURE",
	"ps":   "PERCENT_SHADOW",
	"pbh":  "PERCENT_BONUS_HEALING",
	"pbhd": "PERCENT_BONUS_HEALING_DAMAGE",
	"pl":   "PLAYER_LEVEL",
	"rap":  "RANGED_ATTACK_POWER",
	"rwb":  "RANGED_WPN_BASEDMG",
	"sp":   "SPELL_POWER",
	"spa":  "SPELL_POWER_ARCANE",
	"spfi": "SPELL_POWER_FIRE",
	"spfr": "SPELL_POWER_FROST",
	"sph":  "SPELL_POWER_HOLY",
	"spi":  "SPIRIT",
	"spn":  "SPELL_POWER_NATURE",
	"sps":  "SPELL_POWER_SHADOW",	
}
	

class WSMLSyntaxError(SyntaxError):
	pass


def getarglist(obj):
	"Finds arguments given to a function"
	parens = 1
	values = []
	buffer = ""<commit_msg>spellstrings: Fix some paperdoll mismatches<commit_after>#!/usr/bin/python
# -*- coding: utf-8 -*-

import re
from datetime import timedelta
from decimal import Decimal
from math import floor

from .paperdoll import Paperdoll


def case_insensitive(lower):
	upper = [k.upper() for k in lower]
	lower.extend(upper)

booleans = "gl"
functions = ["cond", "eq", "floor", "gt", "max", "min"]
case_insensitive(functions)
macros = "AFMRSabderfhimnoqrstuvxz"
variables = ["pbhd", "spfi", "spfr", "bc2", "hnd", "mwb", "mws", "pbh", "pfi", "pfr", "rap", "rwb", "spa", "sph", "spi", "spn", "sps", "mwb", "rwb", "ap", "ar", "bh", "mw", "mw", "pa", "pl", "ph", "pn", "ps", "sp"]
case_insensitive(variables)
functions_s = "|".join(functions)
macros_s = "|".join(macros)
variables_s = "|".join(variables)

sre_function = re.compile(r"(%s)\(([^,]+),([^,)]+),?([^)]?)\)" % "|".join(functions)) # cond|eq|max|min(arg1, arg2[, arg3])
# (cond|eq|max|min) # NO EMBEDDED FUNCTION SUPPORT
# \(                # opening parenthese
#   ([^,]+),        # grab anything except a "," followed by a ","
#   ([^,)]+)        # grab anything except ",)"
#         ,?        # followed by , (optional if third arg exists)
#   ([^)]?)         # grab anything but a parenthese (optional)
# \)                # closing parenthese

sre_boolean = re.compile(r"(%s)([^:]+):([^;]+);" % "|".join(booleans)) # g|lFirst String:Second String;
sre_braces = re.compile(r"\{([^}]+)\}\.?(\d+)?") # ${} not supported
sre_learned = re.compile(r"\?(%s)(\d+)\[([^\]]*)\]\[([^\]]*)\]" % macros_s)
sre_operator = re.compile(r"[*/](\d+);(\d*)(%s)([123]?)" % macros_s) # /1000;54055o2
sre_macro = re.compile(r"(\d*)(%s)([123]?)" % macros_s)
sre_variables = re.compile(r"(%s)" % variables_s)


variabledict = {
	"ap":   "ATTACK_POWER",
	"ar":   "ARMOR",
	"bc2":  "PERCENT_BC2",
	"bh":   "BONUS_HEALING",
	"hnd":  "MAIN_WPN_HANDS",
	"mw":   "MAIN_WPN_DMG",
	"mwb":  "MAIN_WPN_BASEDMG",
	"mws":  "MAIN_WPN_SPEED",
	"pa":   "PERCENT_ARCANE",
	"pfi":  "PERCENT_FIRE",
	"pfr":  "PERCENT_FROST",
	"ph":   "PERCENT_HOLY",
	"pn":   "PERCENT_NATURE",
	"ps":   "PERCENT_SHADOW",
	"pbh":  "PERCENT_BONUS_HEALING",
	"pbhd": "PERCENT_BONUS_HEALING_DAMAGE",
	"pl":   "PLAYER_LVL",
	"rap":  "RANGED_ATTACK_POWER",
	"rwb":  "RANGED_WPN_BASEDMG",
	"sp":   "SPELL_POWER",
	"spa":  "SPELL_POWER_ARCANE",
	"spfi": "SPELL_POWER_FIRE",
	"spfr": "SPELL_POWER_FROST",
	"sph":  "SPELL_POWER_HOLY",
	"spi":  "SPIRIT",
	"spn":  "SPELL_POWER_NATURE",
	"sps":  "SPELL_POWER_SHADOW",	
}
	

class WSMLSyntaxError(SyntaxError):
	pass


def getarglist(obj):
	"Finds arguments given to a function"
	parens = 1
	values = []
	buffer = ""
{'fraction_non_alphanumeric': 0.24220990250430127, 'fraction_numerical': 0.009176065761804627, 'mean_word_length': 4.536507936507936, 'pattern_counts': {'":': 53, '<': 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': '1035314', 'n_tokens_mistral': 2387, 'n_tokens_neox': 2305, 'n_words': 424}