<commit_before>#!/usr/bin/env python
"""Baseclass for RuuviTracker testcases, since we need DBUS we will use glib mainloop as our eventloop"""
import sys,os
import gobject
import dbus
import dbus.service
import dbus.mainloop.glib
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
from exceptions import NotImplementedError,RuntimeError
from scpi.devices import hp6632b
from dbushelpers.call_cached import call_cached as dbus_call_cached
import time, datetime
import signal
import io
#import unicodecsv as csv
import csv
import subprocess
import timeout_decorator
import pyudev
import shutil


RT_DFU_DEVICEID = '0483:df11'
RT_SERIAL_DEVICEID = '0483:5740'
HP_SERIALPORT_DEVICEID = '067b:2303' # TODO: Make configurable in yaml or something
COMPILE_TIMEOUT = 120  # seconds
FLASH_TIMEOUT = 120 # seconds

class rt_testcase(object):
    def __init__(self, *args, **kwargs):
        super(rt_testcase, self).__init__(*args, **kwargs)
        self.testname = '' # This should be the testcase class


        self.loop = gobject.MainLoop()
        self.bus = dbus.SessionBus()
        # Make sure the HP is powered
        dbus_call_cached(self.arduino_path, 'set_alias', 'hp_power', True)
        self.hp6632b = hp6632b.rs232(self.get_serialport_tty(HP_SERIALPORT_DEVICEID))
        self.usb_device_present_timeout = 10.0
        self.arduino_path = "/fi/hacklab/ardubus/ruuvitracker_tester"
        # Currently our only input is the pulse so the method name is apt even though we trap all alias signals (also dio_change:s)
        self.bus.add_signal_receiver(self.pulse_received, dbus_interface = "fi.hacklab.ardubus", signal_name = "alias_change", path=self.arduino_path)
        self.pulse_trains = []
        self._active_pulse_train = False
        self.logger = None<commit_msg>we need this defined earlier<commit_after>#!/usr/bin/env python
"""Baseclass for RuuviTracker testcases, since we need DBUS we will use glib mainloop as our eventloop"""
import sys,os
import gobject
import dbus
import dbus.service
import dbus.mainloop.glib
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
from exceptions import NotImplementedError,RuntimeError
from scpi.devices import hp6632b
from dbushelpers.call_cached import call_cached as dbus_call_cached
import time, datetime
import signal
import io
#import unicodecsv as csv
import csv
import subprocess
import timeout_decorator
import pyudev
import shutil


RT_DFU_DEVICEID = '0483:df11'
RT_SERIAL_DEVICEID = '0483:5740'
HP_SERIALPORT_DEVICEID = '067b:2303' # TODO: Make configurable in yaml or something
COMPILE_TIMEOUT = 120  # seconds
FLASH_TIMEOUT = 120 # seconds

class rt_testcase(object):
    def __init__(self, *args, **kwargs):
        super(rt_testcase, self).__init__(*args, **kwargs)
        self.testname = '' # This should be the testcase class


        self.arduino_path = "/fi/hacklab/ardubus/ruuvitracker_tester"
        self.loop = gobject.MainLoop()
        self.bus = dbus.SessionBus()
        # Make sure the HP is powered
        dbus_call_cached(self.arduino_path, 'set_alias', 'hp_power', True)
        self.hp6632b = hp6632b.rs232(self.get_serialport_tty(HP_SERIALPORT_DEVICEID))
        self.usb_device_present_timeout = 10.0
        # Currently our only input is the pulse so the method name is apt even though we trap all alias signals (also dio_change:s)
        self.bus.add_signal_receiver(self.pulse_received, dbus_interface = "fi.hacklab.ardubus", signal_name = "alias_change", path=self.arduino_path)
        self.pulse_trains = []
        self._active_pulse_train = False
        self.logger = None
{'fraction_non_alphanumeric': 0.0803347280334728, 'fraction_numerical': 0.02510460251046025, 'mean_word_length': 4.328380386329866, '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': '1249778', 'n_tokens_mistral': 1233, 'n_tokens_neox': 1166, 'n_words': 307}