<commit_before>
__author__ = '<NAME> <<EMAIL>>'

import datetime
import json
import logging
import requests
import os
import shelve

APIVERSION = '1'
REPORT_COLUMNS = (
    'auxHeat1', 'auxHeat2', 'auxHeat3',
    'compCool1', 'compCool2', 'compHeat1', 'compHeat2',
    'dehumidifier', 'dmOffset', 'economizer', 'fan', 'humidifier',
    'outdoorHumidity', 'outdoorTemp', 'sky', 'ventilator', 'wind',
    'zoneAveTemp', 'zoneCalendarEvent', 'zoneCoolTemp', 'zoneHeatTemp',
    'zoneHumidity', 'zoneHumidityHigh', 'zoneHumidityLow', 'zoneHvacMode', 'zoneOccupancy'
)


class EcobeeException(Exception):
    """Ecobee error"""
    pass


class Ecobee(object):
    """Ecobee thermostat.

       eapi = Ecobee(apikey, themostat_ids)

    """
    def __init__(self, apikey, thermostat_ids, scope='smartWrite', authfile=None):
        """
          apikey:         your API key in the 'Developer' panel on ecobee.com
          thermostat_ids: IDs of your thermostats
          authfile:       Store authentication in this file.
                          Default=$HOME/.config/ecobee
          scope:          Default: smartWrite

        """

        self.log = logging.getLogger(__name__)
        self.scope = scope
        self.apikey = apikey
        if isinstance(thermostat_ids, list):
            self.thermostat_ids = thermostat_ids
        else:
            self.thermostat_ids = [thermostat_ids]

        self.url_base = 'https://api.ecobee.com/'
        self.url_api = self.url_base + APIVERSION + '/{endpoint}'


        # Map of thermostat ID to the last revision seen.
        self.lastSeen = {}

        # Map of most recent data
        self.data = {}
        for tid in self.thermostat_ids:
            self.data[tid] = {}

        # setup authentication storage
        self.auth = {}
        if authfile:
            self.auth = shelve.open(authfile)
        else:
            self.auth = shelve.open(os.path.join(os.getenv('HOME'), '.config', 'ecobee'))

        # authorize on start
        self.authorize_refresh()


    @property
    def authentication_required(self):
        return self.auth.get('required', True)


    def authorize_start(self):<commit_msg>Make sure we have string IDs<commit_after>
__author__ = '<NAME> <<EMAIL>>'

import datetime
import json
import logging
import requests
import os
import shelve

APIVERSION = '1'
REPORT_COLUMNS = (
    'auxHeat1', 'auxHeat2', 'auxHeat3',
    'compCool1', 'compCool2', 'compHeat1', 'compHeat2',
    'dehumidifier', 'dmOffset', 'economizer', 'fan', 'humidifier',
    'outdoorHumidity', 'outdoorTemp', 'sky', 'ventilator', 'wind',
    'zoneAveTemp', 'zoneCalendarEvent', 'zoneCoolTemp', 'zoneHeatTemp',
    'zoneHumidity', 'zoneHumidityHigh', 'zoneHumidityLow', 'zoneHvacMode', 'zoneOccupancy'
)


class EcobeeException(Exception):
    """Ecobee error"""
    pass


class Ecobee(object):
    """Ecobee thermostat.

       eapi = Ecobee(apikey, themostat_ids)

    """
    def __init__(self, apikey, thermostat_ids, scope='smartWrite', authfile=None):
        """
          apikey:         your API key in the 'Developer' panel on ecobee.com
          thermostat_ids: IDs of your thermostats
          authfile:       Store authentication in this file.
                          Default=$HOME/.config/ecobee
          scope:          Default: smartWrite

        """

        self.log = logging.getLogger(__name__)
        self.scope = scope
        self.apikey = apikey
        if isinstance(thermostat_ids, list):
            self.thermostat_ids = thermostat_ids
        else:
            self.thermostat_ids = [thermostat_ids]

        # make sure we have strings here
        self.thermostat_ids = list(str(tid) for tid in self.thermostat_ids)

        self.url_base = 'https://api.ecobee.com/'
        self.url_api = self.url_base + APIVERSION + '/{endpoint}'


        # Map of thermostat ID to the last revision seen.
        self.lastSeen = {}

        # Map of most recent data
        self.data = {}
        for tid in self.thermostat_ids:
            self.data[tid] = {}

        # setup authentication storage
        self.auth = {}
        if authfile:
            self.auth = shelve.open(authfile)
        else:
            self.auth = shelve.open(os.path.join(os.getenv('HOME'), '.config', 'ecobee'))

        # authorize on start
        self.authorize_refresh()


    @property
    def authentication_required(self):
        return self.auth.get('required', True)


    def authorize_start(self):
{'fraction_non_alphanumeric': 0.1173845123856282, 'fraction_numerical': 0.0035706315554563713, 'mean_word_length': 2.4879377431906615, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1411695', 'n_tokens_mistral': 1442, 'n_tokens_neox': 1363, 'n_words': 324}