<commit_before>
import sys
import logging

from os.path import join, dirname

from wsgiref.simple_server import make_server

import muntjac

from muntjac.demo.util import InMemorySession

from muntjac.terminal.gwt.server.application_servlet import ApplicationServlet

from muntjac.demo.HelloWorld import HelloWorld
from muntjac.demo.Calc import Calc
from muntjac.demo.SimpleAddressBook import SimpleAddressBook
from muntjac.demo.MuntjacTunesLayout import MuntjacTunesLayout
from muntjac.demo.sampler.SamplerApplication import SamplerApplication

from paste.urlmap import URLMap
from paste.session import SessionMiddleware
from paste.fileapp import DirectoryApp


hello = ApplicationServlet(HelloWorld)

calc = ApplicationServlet(Calc)

address = ApplicationServlet(SimpleAddressBook)

tunes = ApplicationServlet(MuntjacTunesLayout)

sampler = ApplicationServlet(SamplerApplication,
        widgetset='com.vaadin.demo.sampler.gwt.SamplerWidgetSet')


urlmap = URLMap({})
urlmap['/hello'] = hello
urlmap['/calc'] = calc
urlmap['/address'] = address
urlmap['/tunes'] = tunes
urlmap['/sampler'] = sampler

ws_app = DirectoryApp(join(dirname(muntjac.__file__), 'public', 'VAADIN'))
urlmap['/VAADIN'] = ws_app


def main():
    logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)

    url_map = SessionMiddleware(urlmap, session_class=InMemorySession)

    print 'Serving on port: 8080'
    make_server('localhost', 8080, url_map).serve_forever()


if __name__ == '__main__':
    ## $ python -m cProfile -o /tmp/demo.prof muntjac/demo/main.py
    #pstats.Stats("/tmp/demo.prof").sort_stats('time').print_stats(20)
    main()<commit_msg>Adding addon demos to entry point.<commit_after>
import sys
import logging

from os.path import join, dirname

from wsgiref.simple_server import make_server

import muntjac

from muntjac.demo.util import InMemorySession

from muntjac.terminal.gwt.server.application_servlet import ApplicationServlet

from muntjac.demo.HelloWorld import HelloWorld
from muntjac.demo.Calc import Calc
from muntjac.demo.SimpleAddressBook import SimpleAddressBook
from muntjac.demo.MuntjacTunesLayout import MuntjacTunesLayout
from muntjac.demo.sampler.SamplerApplication import SamplerApplication

from muntjac.addon.colorpicker.color_picker_application \
    import ColorPickerApplication

from muntjac.addon.codemirror.code_mirror_application \
    import CodeMirrorApplication

from muntjac.addon.google_maps.google_map_app \
    import GoogleMapWidgetApp

from paste.urlmap import URLMap
from paste.session import SessionMiddleware
from paste.fileapp import DirectoryApp


hello = ApplicationServlet(HelloWorld)

calc = ApplicationServlet(Calc)

address = ApplicationServlet(SimpleAddressBook)

tunes = ApplicationServlet(MuntjacTunesLayout)

sampler = ApplicationServlet(SamplerApplication,
        widgetset='com.vaadin.demo.sampler.gwt.SamplerWidgetSet')

colorpicker = ApplicationServlet(ColorPickerApplication)

codemirror = ApplicationServlet(CodeMirrorApplication)

googlemaps = ApplicationServlet(GoogleMapWidgetApp)


urlmap = URLMap({})
urlmap['/hello'] = hello
urlmap['/calc'] = calc
urlmap['/address'] = address
urlmap['/tunes'] = tunes
urlmap['/sampler'] = sampler
urlmap['/colorpicker'] = colorpicker
urlmap['/codemirror'] = codemirror
urlmap['/googlemaps'] = googlemaps

ws_app = DirectoryApp(join(dirname(muntjac.__file__), 'public', 'VAADIN'))
urlmap['/VAADIN'] = ws_app


def main():
    logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)

    url_map = SessionMiddleware(urlmap, session_class=InMemorySession)

    print 'Serving on port: 8080'
    make_server('localhost', 8080, url_map).serve_forever()


if __name__ == '__main__':
    ## $ python -m cProfile -o /tmp/demo.prof muntjac/demo/main.py
    #pstats.Stats("/tmp/demo.prof").sort_stats('time').print_stats(20)
    main()
{'fraction_non_alphanumeric': 0.09809548656404905, 'fraction_numerical': 0.0052178450300026085, 'mean_word_length': 6.009140767824498, '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': '6303355', 'n_tokens_mistral': 1258, 'n_tokens_neox': 1189, 'n_words': 250}