<commit_before>import logging
import socket
import json
from queue import Queue


log = logging.getLogger('Connection')
conn = None
ip = None
port = 9999
command_queue = Queue()
signal_handlers = {}

def establish(host):
    global conn, port, log, ip

    log.info('establishing Connection to %s', host)
    conn = socket.create_connection( (host, port) )
    log.debug('Connection successful \o/')

    ip = conn.getpeername()[0]
    log.debug('Remote-IP is %s', ip)

def fetchServerConfig():
    global conn, log

    log.info('reading server-config')
    fd = conn.makefile('rw')
    fd.write("get_config\n")
    fd.flush()

    while True:
        line = fd.readline()
        words = line.split(' ')

        signal = words[0]
        args = words[1:]

        if signal != 'server_config':
            continue

        server_config_json = " ".join(args)
        server_config = json.loads(server_config_json)
        return server_config<commit_msg>Further PEP-8-ification<commit_after>from queue import Queue
import json
import logging
import socket


log = logging.getLogger('Connection')
conn = None
ip = None
port = 9999
command_queue = Queue()
signal_handlers = {}


def establish(host):
    global conn, port, log, ip

    log.info('establishing Connection to %s', host)
    conn = socket.create_connection((host, port))
    log.debug('Connection successful \o/')

    ip = conn.getpeername()[0]
    log.debug('Remote-IP is %s', ip)


def fetchServerConfig():
    global conn, log

    log.info('reading server-config')
    fd = conn.makefile('rw')
    fd.write("get_config\n")
    fd.flush()

    while True:
        line = fd.readline()
        words = line.split(' ')

        signal = words[0]
        args = words[1:]

        if signal != 'server_config':
            continue

        server_config_json = " ".join(args)
        server_config = json.loads(server_config_json)
        return server_config
{'fraction_non_alphanumeric': 0.122533748701973, 'fraction_numerical': 0.00778816199376947, 'mean_word_length': 2.8234126984126986, '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': '7415306', 'n_tokens_mistral': 615, 'n_tokens_neox': 584, 'n_words': 153}