<commit_before>import re

from . import Event, get_timestamp

# input/output
output_exp = re.compile(
        r'^(?:\d{4}-\d{2}-\d{2} |)\[?(\d{2}:\d{2}:\d{2})\]? \[?(?:[^\]]+?/|)([A-Z]+)\]:? (.*)')

class ServerInput(Event):
    """Send data to the server's stdin. In plugins, a shortcut
    is available: self.send("say hello")"""
    
    line         = Event.Arg(required=True)


class ServerOutput(Event):
    """Issued when the server gives us a line on stdout. Note
    that to handle this, you must specify both the 'level'
    (e.g. INFO or SEVERE) and a regex pattern to match"""
    
    line  = Event.Arg(required=True)
    time  = Event.Arg()
    level = Event.Arg()
    data  = Event.Arg()
    
    def setup(self):
        m = output_exp.match(self.line)
        if m:
            g = m.groups()
            self.time = g[0]
            self.level= g[1]
            self.data = g[2]
        else:
            self.level= "???"
            self.data = self.line.strip()
        
        self.time = get_timestamp(self.time)
    
    def prefilter(self, pattern, level=None):
        if level and level != self.level:
            return False
        
        m = re.match(pattern, self.data)
        if not m:
            return False
        
        self.match = m
        
        return True
    
# start

<commit_msg>BungeeCord Support and Other Changes<commit_after>import re

from . import Event, get_timestamp

# input/output
output_exp = re.compile(
        r'^(?:\W|)+(?:\d{4}-\d{2}-\d{2} |)\[?(\d{2}:\d{2}:\d{2})\]? \[?(?:[^\]]+?/|)([A-Z]+)\]:? (.*)')

class ServerInput(Event):
    """Send data to the server's stdin. In plugins, a shortcut
    is available: self.send("say hello")"""
    
    line         = Event.Arg(required=True)


class ServerOutput(Event):
    """Issued when the server gives us a line on stdout. Note
    that to handle this, you must specify both the 'level'
    (e.g. INFO or SEVERE) and a regex pattern to match"""
    
    line  = Event.Arg(required=True)
    time  = Event.Arg()
    level = Event.Arg()
    data  = Event.Arg()
    
    def setup(self):
        m = output_exp.match(self.line)
        if m:
            g = m.groups()
            self.time = g[0]
            self.level= g[1]
            self.data = g[2]
        else:
            self.level= "RAW"
            self.data = self.line
        
        self.time = get_timestamp(self.time)
    
    def prefilter(self, pattern, level=None):
        if level and level != self.level:
            return False
        
        m = re.match(pattern, self.data.strip())
        if not m:
            return False
        
        self.match = m
        
        return True
    
# start


{'fraction_non_alphanumeric': 0.1495742317660126, 'fraction_numerical': 0.006664198445020363, 'mean_word_length': 1.7855670103092784, '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': '3786304', 'n_tokens_mistral': 898, 'n_tokens_neox': 883, 'n_words': 235}