<commit_before>import os,sys,traceback as tb,gevent,bottle,json
from geventwebsocket import WebSocketError
decode = json.loads ; encode = json.dumps
class Chat:
    @staticmethod
    def connect(wu, sid):
        print "XX CONNECT5", sid
        wu.add_user()
        d = {"method":"connect","params":wu.dict(),"id":wu.sid()}
        wu.send(d)
        print "XX CONNECT99999", sid
        pass
    @staticmethod
    def name(wu,name):
        print "XX @ NAME", name
        old_name = wu.name ; wu.name = name
        d = {"name":{"sid":wu.sid(),"name":name,
                     "oldName":old_name}}
        wu.wsend(d)
        pass
    @staticmethod
    def channel(wu,channel):
        print "XX @ CHANNEL", channel
        old_channel = wu.channel ; wu.channel = channel
        d = {"channel":{"channel":channel,"sid":wu.sid(),
                        "oldChannel":old_channel}}
        wu.send(d)
        pass
    @staticmethod
    def say(wu,msg,channel):
        print "XX @ SAY", msg, channel
        d = {"msg":msg,"channel":channel,"from":wu.dict()}
        d = {"method":"say","params":d}
        wu.send(d,channel)
        pass
    @staticmethod
    def yell(wu,msg):
        print "XX @ YELL", msg
        d = {"yell":{"sid":wu.sid(),"msg":msg}}
        wu.send(d)
        pass
    @staticmethod
    def whisper(wu,to,msg):
        print "XX @ WHISPER", to, msg
        d = {"whisper":{"sid":wu.sid(),"msg":msg,"to":to}}
        wu.send(d)
        pass
    @staticmethod
    def sys(wu,data,channel=None):
        print "XX @ SYS", data
        d = {"sys":data}
        wu.send(d,channel)
        pass
    @staticmethod
    def disconnect(wu,data):
        print "XX @ DISCONNECT", data
        d = {"disconnect":data,"sid":wu.sid()}
        wu.send(d)
        pass
    @staticmethod
    def whoList(wu,*a):
        print "XX @ WHO_LIST", a
        print "G", wu.G
        it = ((k,v.dict()) for k,v in wu.G.iteritems())
        d = {"whoList":{"resultMap":dict(it)}}
        wu.wsend(d)
        pass<commit_msg>clean up a little<commit_after>import os,sys,traceback as tb,gevent,bottle,json
from geventwebsocket import WebSocketError
decode = json.loads ; encode = json.dumps
class Chat:
    @staticmethod
    def connect(wu, sid):
        print "XX CONNECT5", sid
        wu.add_user()
        wu.send({"method":"connect",
                 "params":wu.dict(),"id":wu.sid()})
        print "XX CONNECT99999", sid
        pass
    @staticmethod
    def name(wu,name):
        print "XX @ NAME", name
        old_name = wu.name ; wu.name = name
        wu.send({"method":"name",
                 "params":{"from":wu.dict()
                           "oldName":old_name}})
        pass
    @staticmethod
    def channel(wu,channel):
        print "XX @ CHANNEL", channel
        old_channel = wu.channel ; wu.channel = channel
        wu.send({"method":"channel",
                 "params":{"from":wu.dict()
                           "oldChannel":old_channel}})
        pass
    @staticmethod
    def say(wu,msg,channel):
        print "XX @ SAY", msg, channel
        d = {"msg":msg,"channel":channel,"from":wu.dict()}
        wu.send({"method":"say","params":d},channel)
        pass
    @staticmethod
    def disconnect(wu,data):
        print "XX @ DISCONNECT", data
        d = {"disconnect":data,"sid":wu.sid()}
        wu.send(d)
        pass
    @staticmethod
    def whoList(wu,*a):
        print "XX @ WHO_LIST", a
        print "G", wu.G
        it = ((k,v.dict()) for k,v in wu.G.iteritems())
        d = {"whoList":{"resultMap":dict(it)}}
        wu.wsend(d)
        pass
{'fraction_non_alphanumeric': 0.15921089191442067, 'fraction_numerical': 0.0033342595165323703, 'mean_word_length': 2.0664395229982966, 'pattern_counts': {'":': 48, '<': 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': '3461398', 'n_tokens_mistral': 1233, 'n_tokens_neox': 1164, 'n_words': 247}