<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-

import base64
import json
import os
import random
import socket
import string
import time
import uuid

import docker

import tornado
import tornado.options
from tornado.log import app_log
from tornado.web import RequestHandler

from tornado import gen, web
from tornado import ioloop

from tornado.httputil import url_concat
from tornado.httpclient import HTTPRequest, AsyncHTTPClient

class RandomHandler(RequestHandler):

    def sample_with_replacement(a, size=12):
        '''Get a random path. If Python had sampling with replacement built in,
        I would use that. The other alternative is numpy.random.choice, but
        numpy is overkill for this tiny bit of random pathing.'''
        return "".join([random.choice(a) for x in range(size)])

    @gen.coroutine
    def get(self):
        random_path = "user-" + sample_with_replacement(string.ascii_letters +
                                                        string.digits)

        self.write("Initializing {}".format(random_path))

        port = self.create_notebook_server(random_path)<commit_msg>Namespaces are a thing<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

import base64
import json
import os
import random
import socket
import string
import time
import uuid

import docker

import tornado
import tornado.options
from tornado.log import app_log
from tornado.web import RequestHandler

from tornado import gen, web
from tornado import ioloop

from tornado.httputil import url_concat
from tornado.httpclient import HTTPRequest, AsyncHTTPClient

def sample_with_replacement(a, size=12):
    '''Get a random path. If Python had sampling with replacement built in,
    I would use that. The other alternative is numpy.random.choice, but
    numpy is overkill for this tiny bit of random pathing.'''
    return "".join([random.choice(a) for x in range(size)])

class RandomHandler(RequestHandler):


    @gen.coroutine
    def get(self):
        random_path = "user-" + sample_with_replacement(string.ascii_letters +
                                                        string.digits)

        self.write("Initializing {}".format(random_path))

        port = self.create_notebook_server(random_path)
{'fraction_non_alphanumeric': 0.07624113475177305, 'fraction_numerical': 0.004432624113475178, 'mean_word_length': 3.250470809792844, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7158682', 'n_tokens_mistral': 631, 'n_tokens_neox': 597, 'n_words': 214}