<commit_before>from __future__ import print_function
import serial
import json

class NanodeError(Exception):
    """Base class for errors from the Nanode."""


class Nanode(object):
    """Used to manage a Nanode running the rfm_edf_ecomanager code."""
    
    def __init__(self, args, port="/dev/ttyUSB0"):
        self.port = port
        self._open_port()
        self.send_command("m") # manual pairing mode
        self.send_command("d") # delete all TXs
        self.send_command("D") # delete all TRXs
        if args.promiscuous:
            self.send_command("u") # print data from all valid transmitters
        else:
            self.send_command("k") # Only print data from known transmitters
        
    def readjson(self):
        line = self.serial.readline()
        print(line, end="")
        json_line = json.loads(line)         <commit_msg>Turn off debugging log messages<commit_after>from __future__ import print_function
import serial
import json

class NanodeError(Exception):
    """Base class for errors from the Nanode."""


class Nanode(object):
    """Used to manage a Nanode running the rfm_edf_ecomanager code."""
    
    def __init__(self, args, port="/dev/ttyUSB0"):
        self.port = port
        self._open_port()
        self.send_command("v", 4) # don't show any debug log messages
        self.send_command("m") # manual pairing mode
        self.send_command("d") # delete all TXs
        self.send_command("D") # delete all TRXs
        if args.promiscuous:
            self.send_command("u") # print data from all valid transmitters
        else:
            self.send_command("k") # Only print data from known transmitters
        
    def readjson(self):
        line = self.serial.readline()
        print(line, end="")
        json_line = json.loads(line)         
{'fraction_non_alphanumeric': 0.10253583241455347, 'fraction_numerical': 0.0016538037486218302, 'mean_word_length': 2.6083499005964215, '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': '3450900', 'n_tokens_mistral': 534, 'n_tokens_neox': 520, 'n_words': 156}