<commit_before>#!/usr/bin/env python
"""
Alphasense NDIR Driver for Apolline
"""
import argparse
import serial
import os
import time
import requests
import datetime
from influxdb import InfluxDBClient
from influxdb import SeriesHelper

class NDIRSensor:
    """
    ?  Alphasense NDIR
    N  1281.1
    T  26.6
    V  400
    """
    def __init__(self,database='apolline'):
        self.dbname = database
        self.parser = argparse.ArgumentParser(description='Apolline agent for Alphasense NDIR sensor')
        self.parser.add_argument('--host', type=str, required=False,
            default='apolline.lille.inria.fr', help='hostname of Apolline backend')
        self.parser.add_argument('--port', type=int, required=False,
            default=8086, help='port of Apolline backend')
        self.parser.add_argument('--device', type=str, required=False,
            default='/dev/ttyUSB0', help='serial device used to measure')
        self.parser.add_argument('--location', type=str, required=False,
            default='unknown', help='physical location of the sensor')
        self.parser.add_argument('--database', type=str, required=False,
            default='sandbox', help='remote database used to upload the measurements')
        self.parser.add_argument('--frequency', type=int, required=False,
            default=60, help='data retrieval frequency in seconds')
        self.parser.add_argument('--user', type=str, required=True,
            help='user login to upload data online')
        self.parser.add_argument('--password', type=str, required=True,
            help='user password to upload data online')

    def configure(self):
        args = self.parser.parse_args()
        self.host = args.host
        self.port = args.port
        self.location = args.location
        self.device = args.device
        self.frequency = args.frequency
        self.connection = InfluxDBClient(args.host, args.port, args.user, args.password, args.database)
        directory = os.path.dirname("data")
        if not os.path.exists(directory):
            os.makedir(directory)

    def run(self):
        self.configure()<commit_msg>Fixing indent<commit_after>#!/usr/bin/env python
"""
Alphasense NDIR Driver for Apolline
"""
import argparse
import serial
import os
import time
import requests
import datetime
from influxdb import InfluxDBClient
from influxdb import SeriesHelper

class NDIRSensor:
    """
    ?  Alphasense NDIR
    N  1281.1
    T  26.6
    V  400
    """
    def __init__(self,database='apolline'):
        self.dbname = database
        self.parser = argparse.ArgumentParser(description='Apolline agent for Alphasense NDIR sensor')
        self.parser.add_argument('--host', type=str, required=False,
            default='apolline.lille.inria.fr', help='hostname of Apolline backend')
        self.parser.add_argument('--port', type=int, required=False,
            default=8086, help='port of Apolline backend')
        self.parser.add_argument('--device', type=str, required=False,
            default='/dev/ttyUSB0', help='serial device used to measure')
        self.parser.add_argument('--location', type=str, required=False,
            default='unknown', help='physical location of the sensor')
        self.parser.add_argument('--database', type=str, required=False,
            default='sandbox', help='remote database used to upload the measurements')
        self.parser.add_argument('--frequency', type=int, required=False,
            default=60, help='data retrieval frequency in seconds')
        self.parser.add_argument('--user', type=str, required=True,
            help='user login to upload data online')
        self.parser.add_argument('--password', type=str, required=True,
            help='user password to upload data online')

    def configure(self):
        args = self.parser.parse_args()
        self.host = args.host
        self.port = args.port
        self.location = args.location
        self.device = args.device
        self.frequency = args.frequency
        self.connection = InfluxDBClient(args.host, args.port, args.user, args.password, args.database)
        if not os.path.exists('data'):
            os.makedir('data')

    def run(self):
        self.configure()
{'fraction_non_alphanumeric': 0.11757775683317626, 'fraction_numerical': 0.008482563619227144, 'mean_word_length': 2.9488372093023254, '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': '6948599', 'n_tokens_mistral': 1213, 'n_tokens_neox': 1186, 'n_words': 296}