<commit_before># coding=utf-8
__author__ = "<NAME> <<EMAIL>>"
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'

import weakref
import logging
import json

from astroprint.boxrouter.handlers.requesthandler import RequestHandler

class BoxRouterMessageHandler(object):
    ''' Message handler for messages coming from the cloud via websocket '''

    def __init__(self, weakRefBoxRouter, wsClient):
        self._weakRefBoxRouter = weakRefBoxRouter
        self._weakWs = weakref.ref(wsClient)
        self._logger = logging.getLogger(__name__)
        self._subscribers = 0

    def auth(self, msg):
        router = self._weakRefBoxRouter()
        if router:
            return router.processAuthenticate(msg['data'] if 'data' in msg else None)
        else:
            return None

    def ping_from_browser(self, msg):
        ''' Respond to ping message from web browser '''
        router = self._weakRefBoxRouter()
        if router:
            return router.pong_to_browser(msg['data'] if 'data' in msg else None)
        else:
            return None

    def set_temp(self, msg):<commit_msg>ws: fix TypeError, different args<commit_after># coding=utf-8
__author__ = "<NAME> <<EMAIL>>"
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'

import weakref
import logging
import json

from astroprint.boxrouter.handlers.requesthandler import RequestHandler

class BoxRouterMessageHandler(object):
    ''' Message handler for messages coming from the cloud via websocket '''

    def __init__(self, weakRefBoxRouter, wsClient):
        self._weakRefBoxRouter = weakRefBoxRouter
        self._weakWs = weakref.ref(wsClient)
        self._logger = logging.getLogger(__name__)
        self._subscribers = 0

    def auth(self, msg):
        router = self._weakRefBoxRouter()
        if router:
            return router.processAuthenticate(msg['data'] if 'data' in msg else None)
        else:
            return None

    def ping_from_browser(self, msg):
        ''' Respond to ping message from web browser '''
        router = self._weakRefBoxRouter()
        if router:
            return router.pong_to_browser()
        else:
            return None

    def set_temp(self, msg):
{'fraction_non_alphanumeric': 0.09098939929328621, 'fraction_numerical': 0.0017667844522968198, 'mean_word_length': 2.9528795811518322, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '361681', 'n_tokens_mistral': 651, 'n_tokens_neox': 622, 'n_words': 181}