<commit_before>#!/usr/bin/env python

import sys
import os
import argparse
import time
sys.path += os.path.abspath(os.path.join(os.path.split(__file__)[0], "../pylib")),
import simplerpc

def main():
    argparser = argparse.ArgumentParser(prog=sys.argv[0])
    argparser.add_argument("-c")
    argparser.add_argument("-s")
    opt = argparser.parse_args(sys.argv[1:])
    if opt.c:
        c = simplerpc.Client()
        c.connect(opt.c)
        for i in range(1, 100001):
            c.sync_call(1987, 1, 2)
            if i % 1000 == 0:
                print "%d requests done" % i
    elif opt.s:
        s = simplerpc.Server()

        def a_add_b(a, b):
            return a + b

        s.reg_func(1987, a_add_b)

        s.start(opt.s)
        while True:
            time.sleep(1)

if __name__ == "__main__":
    main()<commit_msg>python and c can talk with plain types<commit_after>#!/usr/bin/env python

import sys
import os
import argparse
import time
sys.path += os.path.abspath(os.path.join(os.path.split(__file__)[0], "../pylib")),
import simplerpc
from benchmark_service import *

def main():
    argparser = argparse.ArgumentParser(prog=sys.argv[0])
    argparser.add_argument("-c")
    argparser.add_argument("-s")
    opt = argparser.parse_args(sys.argv[1:])
    if opt.c:
        c = simplerpc.Client()
        c.connect(opt.c)
        bp = BenchmarkProxy(c)
        counter = 0
        last_time = time.time()
        while True:
            now = time.time()
            if now - last_time > 1.0:
                print "qps=%d" % (counter / (now - last_time))
                last_time = now
                counter = 0
            bp.sync_nop("")
            counter += 1

    elif opt.s:
        s = simplerpc.Server()

        class MyBenchmarkService(BenchmarkService):
            def nop(self, in0):
                pass

        s.reg_svc(MyBenchmarkService())

        s.start(opt.s)
        while True:
            time.sleep(1)

if __name__ == "__main__":
    main()
{'fraction_non_alphanumeric': 0.13213213213213212, 'fraction_numerical': 0.018018018018018018, 'mean_word_length': 1.9970014992503748, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 4, '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': '6464104', 'n_tokens_mistral': 704, 'n_tokens_neox': 668, 'n_words': 147}