<commit_before>from twisted.internet import reactor, defer
from txjsonrpc.netstring.jsonrpc import Proxy
import sys, pprint
sys.path.append('../lib')
import config_hci, lru
 
config = config_hci.load_config()
if not config:
    exit()
 
def printValue(value):
    print pprint.pprint(value)

def printError(error):
    print ' !! ERROR: ', error
 
def shutDown(data):
    print " -> Shutting down reactor..."
    reactor.stop()

command = sys.argv[1]
proxy = Proxy('127.0.0.1', config['twisted']['port'])
dl = []
if len(sys.argv) == 3 :
    d = proxy.callRemote(command, sys.argv[2])
elif len(sys.argv) == 7 :
    d = proxy.callRemote(command, sys.argv[2], sys.argv[3], sys.argv[4], sys.argv[5], sys.argv[6])
else :
    d = proxy.callRemote(command)
d.addCallback(printValue).addErrback(printError)
dl.append(d)
 
dl = defer.DeferredList(dl)
dl.addCallback(shutDown)
reactor.run()
<commit_msg>simplier<commit_after>from twisted.internet import reactor, defer
from txjsonrpc.netstring.jsonrpc import Proxy
import sys, pprint
sys.path.append('../lib')
import config_hci, lru
 
config = config_hci.load_config()
if not config:
    exit()
 
def printValue(value):
    pprint.pprint(value)

def printError(error):
    print ' !! ERROR: ', error
 
def shutDown(data):
#    print " -> Shutting down reactor..."
    reactor.stop()

proxy = Proxy('127.0.0.1', config['twisted']['port'])
d = proxy.callRemote(sys.argv[1], *sys.argv[2:])
d.addCallback(printValue).addErrback(printError)
d.addCallback(shutDown)
reactor.run()

{'fraction_non_alphanumeric': 0.15918097754293262, 'fraction_numerical': 0.015191545574636724, 'mean_word_length': 4.529197080291971, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5243842', 'n_tokens_mistral': 558, 'n_tokens_neox': 538, 'n_words': 115}