<commit_before>#!/usr/bin/env python
import pika
import sys
import json

sys.path.append('../core')
sys.path.append('../agent_types')
sys.path.append('../helper_functions')

# stream is in core
#from stream import Stream, run
# sink is in agent_types
from sink import sink_list
# print_stream is in helper_functions
#from print_stream import print_stream
#from recent_values import recent_values

class PikaPublisher(object):
    def __init__(self, routing_key, exchange='publications', host='localhost'):
        self.routing_key = routing_key
        self.exchange = exchange
        self.host = host
        self.connection = pika.BlockingConnection(
            pika.ConnectionParameters(host=self.host))
        self.channel = self.connection.channel()
        self.channel.exchange_declare(
            exchange=self.exchange, exchange_type='direct')
    def publish_list(self, stream_segment):
        self.channel.basic_publish(
            exchange=self.exchange, routing_key=self.routing_key,
            body=json.dumps(stream_segment))
    def close(self):
        self.connection.close()
    def publish(self, stream):
        sink_list(self.publish_list, stream)<commit_msg>Removed unnecessary lines.<commit_after>#!/usr/bin/env python
import pika
import sys
import json

sys.path.append('../agent_types')
# sink is in agent_types
from sink import sink_list

class PikaPublisher(object):
    def __init__(self, routing_key, exchange='publications', host='localhost'):
        self.routing_key = routing_key
        self.exchange = exchange
        self.host = host
        self.connection = pika.BlockingConnection(
            pika.ConnectionParameters(host=self.host))
        self.channel = self.connection.channel()
        self.channel.exchange_declare(
            exchange=self.exchange, exchange_type='direct')
    def publish_list(self, stream_segment):
        self.channel.basic_publish(
            exchange=self.exchange, routing_key=self.routing_key,
            body=json.dumps(stream_segment))
    def close(self):
        self.connection.close()
    def publish(self, stream):
        sink_list(self.publish_list, stream)
{'fraction_non_alphanumeric': 0.10269516728624535, 'fraction_numerical': 0.0, 'mean_word_length': 3.3938775510204082, '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': '3859239', 'n_tokens_mistral': 621, 'n_tokens_neox': 603, 'n_words': 130}