<commit_before>'use strict';

var sql = require('sql');
sql.setDialect('postgres');
var databaseP = require('../management/databaseClientP');
var getRandomName = require('pokemon-names').random;

var sensorTable = require('../management/declarations.js').sensors;
var outputTable = require('../management/declarations.js').outputs;

module.exports = {
    create: function (data) {

        var types = data.outputs ||[];
        var sensorData = Object.keys(sensorTable).reduce(function(acc, k){
            if (data[k])
                acc[k] = data[k];
            return acc;
        }, {});

        console.log('BLA======', sensorData.sim, types);

        // first create the sensor
        return databaseP.then(function (db) {

            if (typeof(sensorData.sim) !== 'string' && sensorData.sim.length === 0) {
                throw 'Cannot create sensor : no SIM';
            }<commit_msg>cleaning<commit_after>'use strict';

var sql = require('sql');
sql.setDialect('postgres');
var databaseP = require('../management/databaseClientP');
var getRandomName = require('pokemon-names').random;

var sensorTable = require('../management/declarations.js').sensors;
var outputTable = require('../management/declarations.js').outputs;

module.exports = {
    create: function (data) {

        var types = data.outputs ||[];
        var sensorData = Object.keys(sensorTable).reduce(function(acc, k){
            if (data[k])
                acc[k] = data[k];
            return acc;
        }, {});

        // first create the sensor
        return databaseP.then(function (db) {

            if (typeof(sensorData.sim) !== 'string' && sensorData.sim.length === 0) {
                throw 'Cannot create sensor : no SIM';
            }
{'fraction_non_alphanumeric': 0.1589213998852553, 'fraction_numerical': 0.0011474469305794606, 'mean_word_length': 2.625779625779626, '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': '2853224', 'n_tokens_mistral': 505, 'n_tokens_neox': 487, 'n_words': 111}