<commit_before>"""mist.io.socket

Here we define the socketio Connection and handlers.

When a user loads mist.io or comes back online, their browser will request a
new socket and the initialize function will be triggered on the server within a
greenlet.

"""

import uuid
import json
import socket
import random
from time import time

from sockjs.tornado import SockJSConnection, SockJSRouter
from mist.io.sockjs_mux import MultiplexConnection
import tornado.iostream

import requests

try:
    from mist.core.helpers import user_from_session_id
    from mist.core import config
    from mist.core.methods import get_stats
    multi_user = True
except ImportError:<commit_msg>Import get_user_from_session from mist.core.auth.methods<commit_after>"""mist.io.socket

Here we define the socketio Connection and handlers.

When a user loads mist.io or comes back online, their browser will request a
new socket and the initialize function will be triggered on the server within a
greenlet.

"""

import uuid
import json
import socket
import random
from time import time

from sockjs.tornado import SockJSConnection, SockJSRouter
from mist.io.sockjs_mux import MultiplexConnection
import tornado.iostream

import requests

try:
    from mist.core.auth.methods import user_from_session_id
    from mist.core import config
    from mist.core.methods import get_stats
    multi_user = True
except ImportError:
{'fraction_non_alphanumeric': 0.042796005706134094, 'fraction_numerical': 0.0, 'mean_word_length': 4.75, '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': '3471410', 'n_tokens_mistral': 388, 'n_tokens_neox': 382, 'n_words': 162}