<commit_before>(function() {
  'use strict';

  let sensor = require('node-dht-sensor');
  let readout = {
    temperature: 0,
    humidity: 0
  };

  const GPIO_PIN = 4;

  class DHT22 {

    constructor() {
      let initialised = sensor.initialize(22, GPIO_PIN);
      if(!initialised) {
        console.log('Failed to initialise sensor');
      }
    }

    read() {
      readout = sensor.read();
      return readout;
    }

    temperature() {
      return readout.temperature;
    }

    humidity() {
      return readout.humidity;
    }
  }
  module.exports = new DHT22();
})();<commit_msg>Added roundhalf method<commit_after>(function() {
  'use strict';

  let sensor = require('node-dht-sensor');
  let readout = {
    temperature: 0,
    humidity: 0
  };

  const GPIO_PIN = 4;

  class DHT22 {

    constructor() {
      let initialised = sensor.initialize(22, GPIO_PIN);
      if(!initialised) {
        console.log('Failed to initialise sensor');
      }
    }

    read() {
      readout = sensor.read();
      return readout;
    }

    temperature() {
      return this.roundHalf(readout.temperature);
    }

    humidity() {
      return this.roundHalf(readout.humidity);
    }

    /**
    * roundHalf
    * Rounds a given floating number to it's closes .5 value
    * @param num {float} Floating number
    * @return {float} Floating number rounded to closest .5 value
    **/
    roundHalf(num) {
      return Math.round(num * 2) / 2;
    }

  }
  module.exports = new DHT22();
})();
{'fraction_non_alphanumeric': 0.13213811420982735, 'fraction_numerical': 0.014608233731739707, 'mean_word_length': 2.297592997811816, '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': '858849', 'n_tokens_mistral': 514, 'n_tokens_neox': 469, 'n_words': 114}