<commit_before>from helpers import *

add_perm = "utils.tag.add"
check_perm = "utils.tag.check"

data = open_json_file("tag", {})

@hook.command("tag")
def command(sender, command, label, args):
    if len(args) > 0:
        if str(args[0]) == "add":
            if sender.hasPermission(add_perm):
                if len(args) > 2:
                    add(sender, args[1:])
                else:
                    msg(sender, "&a-&c Usage: /tag add <name> <reason>")
            else:
                noperm(sender)
        elif str(args[0]) == "check":
            if sender.hasPermission(check_perm):
                if len(args) == 2:
                    check(sender, args[1:])
                else:
                    msg(sender, "&a-&c Usage: /tag check <name>")
            else:
                noperm(sender)
        else:
            msg(sender, "&a-&c Unknown subcommand! (add, check)")
    else:
        msg(sender, "&a&c Usage: /tag add/check")
    return True

def add(sender, args):
    player = server.getPlayer(args[0])
    uuid = uid(player)
    try:
        if data[uuid] == None:
            pass
    except:
        data[uuid] = []
    data[uuid].append(" ".join(args[1:]))
    msg(sender, "&a-&e Note added")
    save_json_file("tag", data)

def check(sender, args):
    player = server.getPlayer(args[0])
    uuid = uid(player)
    try:
        for tag in data[uuid]:
            msg(sender, "&a-&e %s" % str(tag))
    except:
        msg(sender, "&a-&e There are no notes about this player")

<commit_msg>Added note deletion in tag<commit_after>from helpers import *

add_perm = "utils.tag.add"
del_perm = "utils.tag.del"
check_perm = "utils.tag.check"

data = open_json_file("tag", {})

@hook.command("tag")
def command(sender, command, label, args):
    if len(args) > 0:
        if str(args[0]) == "add":
            if sender.hasPermission(add_perm):
                if len(args) > 2:
                    add(sender, args[1:])
                else:
                    msg(sender, "&a-&c Usage: /tag add <name> <reason>")
            else:
                noperm(sender)
        elif str(args[0]) == "check":
            if sender.hasPermission(check_perm):
                if len(args) == 2:
                    check(sender, args[1:])
                else:
                    msg(sender, "&a-&c Usage: /tag check <name>")
            else:
                noperm(sender)
        elif str(args[0]) == "del":
            if sender.hasPermission(del_perm):
                if len(args) == 3:
                    delete(sender, args[1:])
                else:
                    msg(sender, "&a-&c Usage: /tag del <id>")
        else:
            msg(sender, "&a-&c Unknown subcommand! (add, check, del)")
    else:
        msg(sender, "&a&c Usage: /tag add/check")
    return True

def delete(sender, args):
    player = server.getPlayer(args[0])
    uuid = uid(player)
    try:
        if data[uuid] == None:
            pass
    except:
        msg(sender, "&a-&e There are no notes about this player")
        return
    if int(args[1]) - 1 >= len(data[uuid]):
        msg(sender, "&a-&c Id of note is out of range")
        return
    del (data[uuid])[int(args[1]) - 1]
    save_json_file("tag", data)
    msg(sender, "&a-&e Deleted note at %s" % args[1])

def add(sender, args):
    player = server.getPlayer(args[0])
    uuid = uid(player)
    try:
        if data[uuid] == None:
            pass
    except:
        data[uuid] = []
    data[uuid].append(" ".join(args[1:]))
    msg(sender, "&a-&e Note added")
    save_json_file("tag", data)

def check(sender, args):
    player = server.getPlayer(args[0])
    uuid = uid(player)
    try:
        num = 0
        for tag in data[uuid]:
            num += 1
            msg(sender, "&a-&e %s: %s" % (str(num), str(tag)))
    except:
        msg(sender, "&a-&e There are no notes about this player")


{'fraction_non_alphanumeric': 0.15252057613168724, 'fraction_numerical': 0.007973251028806584, 'mean_word_length': 1.797841726618705, 'pattern_counts': {'":': 5, '<': 10, '<?xml version=': 0, '>': 15, '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': '4896034', 'n_tokens_mistral': 1308, 'n_tokens_neox': 1263, 'n_words': 319}