<commit_before>import time
import socket
import requests
# import datetime

ENDPOINTFILE = 'endpoints.txt'
GRAPHITEHOST = '127.0.0.1'
GRAPHITEPORT = 2003


def logSensor(logtime, sock, space, sensorname, value):
    name = 'sensors.' + space + '.' + sensorname
    data = '%s %s %s' % (name, value, logtime)
    print data
    # sock.send(data)


def logEndpoint(logtime, sock, url):
    data = requests.get(url).json()
    space = data['space']
    for sensor in data['sensors']['temperature']:
        location = sensor['location'].replace(' ', '')
        value = sensor['value']
        # unit = sensor['unit']  # assume degreeC
        logSensor(logtime, sock, space, location, value)


def init():
    now = time.time()
    logtime = int(now - (now % (15 * 60)))
    # print datetime.datetime.fromtimestamp(logtime).strftime('%H:%M:%S')
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    # sock.connect((GRAPHITEHOST, GRAPHITEPORT))
    return logtime, sock<commit_msg>disabled debuge mode for graphite logger<commit_after>import time
import socket
import requests
# import datetime

ENDPOINTFILE = 'endpoints.txt'
GRAPHITEHOST = '127.0.0.1'
GRAPHITEPORT = 2003


def logSensor(logtime, sock, space, sensorname, value):
    name = 'sensors.' + space + '.' + sensorname
    data = '%s %s %s' % (name, value, logtime)
    print data
    sock.send(data)


def logEndpoint(logtime, sock, url):
    data = requests.get(url).json()
    space = data['space']
    for sensor in data['sensors']['temperature']:
        location = sensor['location'].replace(' ', '')
        value = sensor['value']
        # unit = sensor['unit']  # assume degreeC
        logSensor(logtime, sock, space, location, value)


def init():
    now = time.time()
    logtime = int(now - (now % (15 * 60)))
    # print datetime.datetime.fromtimestamp(logtime).strftime('%H:%M:%S')
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    sock.connect((GRAPHITEHOST, GRAPHITEPORT))
    return logtime, sock
{'fraction_non_alphanumeric': 0.14992503748125938, 'fraction_numerical': 0.013993003498250875, 'mean_word_length': 3.5707762557077625, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5866636', 'n_tokens_mistral': 676, 'n_tokens_neox': 640, 'n_words': 160}