<commit_before>#!/usr/bin/env python
# vim: fileencoding=utf8:et:sta:ai:sw=4:ts=4:sts=4

import traceback

import greenhouse
from junction import Node

HOST = "127.0.0.1"
PORT = 9100

SERVICE_HOST = HOST
SERVICE_PORT = 9000

BDHOST = HOST
BDPORT = 9101

FRONT_SERVICE = 2
BACK_SERVICE = 1

greenhouse.add_exception_handler(traceback.print_exception)

node = Node((HOST, PORT), [(SERVICE_HOST, SERVICE_PORT)])


def handler(x):
    return ["forwarded %s" % r for r in
            node.rpc(BACK_SERVICE, "echo", 0, (x,), {})]


def main():
    node.accept_rpc(FRONT_SERVICE, "echo", 0, 0, handler)

    node.start()
    node.wait_on_connections()

    greenhouse.schedule(greenhouse.run_backdoor,
            args=((BDHOST, BDPORT), {'node': node}))

    try:
        greenhouse.Event().wait()
    except KeyboardInterrupt:
        pass


if __name__ == '__main__':
    main()
<commit_msg>service->relayer only needs 1 result<commit_after>#!/usr/bin/env python
# vim: fileencoding=utf8:et:sta:ai:sw=4:ts=4:sts=4

import traceback

import greenhouse
from junction import Node

HOST = "127.0.0.1"
PORT = 9100

SERVICE_HOST = HOST
SERVICE_PORT = 9000

BDHOST = HOST
BDPORT = 9101

FRONT_SERVICE = 2
BACK_SERVICE = 1

greenhouse.add_exception_handler(traceback.print_exception)

node = Node((HOST, PORT), [(SERVICE_HOST, SERVICE_PORT)])


def handler(x):
    return "forwarded %s" % node.rpc(BACK_SERVICE, "echo", 0, (x,), {})[0]


def main():
    node.accept_rpc(FRONT_SERVICE, "echo", 0, 0, handler)

    node.start()
    node.wait_on_connections()

    greenhouse.schedule(greenhouse.run_backdoor,
            args=((BDHOST, BDPORT), {'node': node}))

    try:
        greenhouse.Event().wait()
    except KeyboardInterrupt:
        pass


if __name__ == '__main__':
    main()

{'fraction_non_alphanumeric': 0.13859154929577464, 'fraction_numerical': 0.031549295774647886, 'mean_word_length': 3.8524590163934427, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '2192943', 'n_tokens_mistral': 689, 'n_tokens_neox': 649, 'n_words': 141}