<commit_before>import sys
import functools
import asyncio

from PyQt5.QtCore import pyqtSignal
from PyQt5.QtWidgets import QMainWindow, QApplication, QPushButton, QWidget, QLineEdit, QGridLayout

from autobahn.asyncio.wamp import ApplicationRunner
from autobahn.asyncio.wamp import ApplicationSession

from quamash import QEventLoop


def wrap_in_future(func):
    @functools.wraps(func)
    def wrapper(*args, **kw):
        asyncio.async(func(*args, **kw))
    return wrapper


class MainWindow(ApplicationSession, QMainWindow):

    def __init__(self, config=None):
        ApplicationSession.__init__(self, config)
        QMainWindow.__init__(self)
        self.bla = "hh"

        self.the_widget = MainWidget(parent=self)
        self.statusBar()
        self.main_window_init()

    def time_event_handler(self, time):
        self.statusBar().showMessage("Time: " + time, msecs=2000)

    @asyncio.coroutine
    def onJoin(self, details):
        print("session ready")
        yield from self.subscribe(self.time_event_handler, 'com.myapp.the_time')

    def main_window_init(self):
        self.setCentralWidget(self.the_widget)

        #                 x    y  x_size y_size
        self.setGeometry(300, 300, 300, 200)
        self.setWindowTitle('PyQt5-Wamp')
        self.show()
<commit_msg>Function is registered with @wamp.register decorator<commit_after>import sys
import functools
import asyncio

from PyQt5.QtWidgets import QMainWindow, QApplication, QPushButton, QWidget, QLineEdit, QGridLayout

from autobahn.asyncio.wamp import ApplicationRunner
from autobahn.asyncio.wamp import ApplicationSession
from autobahn import wamp

from quamash import QEventLoop


def wrap_in_future(func):
    @functools.wraps(func)
    def wrapper(*args, **kw):
        asyncio.async(func(*args, **kw))
    return wrapper


class MainWindow(ApplicationSession, QMainWindow):

    def __init__(self, config=None):
        ApplicationSession.__init__(self, config)
        QMainWindow.__init__(self)
        self.bla = "hh"

        self.the_widget = MainWidget(parent=self)
        self.statusBar()
        self.main_window_init()

    @wamp.subscribe('com.myapp.the_time')
    def time_event_handler(self, time):
        self.statusBar().showMessage("Time: " + time, msecs=2000)

    @asyncio.coroutine
    def onJoin(self, details):
        print("session ready")
        try:
            res = yield from self.subscribe(self)
            print("Subscribed to {0} procedure(s)".format(len(res)))
        except Exception as e:
            print("could not subscribe to procedure: {0}".format(e))

    def main_window_init(self):
        self.setCentralWidget(self.the_widget)

        #                 x    y  x_size y_size
        self.setGeometry(300, 300, 300, 200)
        self.setWindowTitle('PyQt5-Wamp')
        self.show()

{'fraction_non_alphanumeric': 0.09901338971106413, 'fraction_numerical': 0.013742071881606765, 'mean_word_length': 3.193500738552437, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7605484', 'n_tokens_mistral': 913, 'n_tokens_neox': 867, 'n_words': 191}