<commit_before># -*- coding: utf-8 -*-
"""
Display if a connection to the internet is established.

Configuration parameters:
    cache_timeout: how often to run the check
    format_offline: what to display when offline
    format_online: what to display when online
    timeout: how long before deciding we're offline
    url: connect to this url to check the connection status

@author obb
"""

from time import time
import os
import re
try:
    # python3
    from urllib.request import urlopen
except:
    from urllib2 import urlopen


class Py3status:
    """
    """
    # available configuration parameters
    cache_timeout = 10
    format_offline = u'■'
    format_online = u'●'
    timeout = 2
    url = 'uranus'

    def _connection_present(self):
        if re.search('://', self.url):
            try:
                urlopen(self.url, timeout=self.timeout)
            except:
                return False
            else:
                return True
        else:
            if os.system("ping -c 1 " + self.url + ">> /dev/null 2>&1") == 0:
                return True
            else:
                return False

    def online_status(self, i3s_output_list, i3s_config):
        response = {
            'cached_until': time() + self.cache_timeout
        }

        connected = self._connection_present()
        if connected:
            response['full_text'] = self.format_online
            response['color'] = i3s_config['color_good']
        else:
            response['full_text'] = self.format_offline
            response['color'] = i3s_config['color_bad']

        return response

if __name__ == "__main__":<commit_msg>Change url back to www.google.com<commit_after># -*- coding: utf-8 -*-
"""
Display if a connection to the internet is established.

Configuration parameters:
    cache_timeout: how often to run the check
    format_offline: what to display when offline
    format_online: what to display when online
    timeout: how long before deciding we're offline
    url: connect to this url to check the connection status

@author obb
"""

from time import time
import os
import re
try:
    # python3
    from urllib.request import urlopen
except:
    from urllib2 import urlopen


class Py3status:
    """
    """
    # available configuration parameters
    cache_timeout = 10
    format_offline = u'■'
    format_online = u'●'
    timeout = 2
    url = 'http://www.google.com'

    def _connection_present(self):
        if re.search('://', self.url):
            try:
                urlopen(self.url, timeout=self.timeout)
            except:
                return False
            else:
                return True
        else:
            if os.system("ping -c 1 " + self.url + ">> /dev/null 2>&1") == 0:
                return True
            else:
                return False

    def online_status(self, i3s_output_list, i3s_config):
        response = {
            'cached_until': time() + self.cache_timeout
        }

        connected = self._connection_present()
        if connected:
            response['full_text'] = self.format_online
            response['color'] = i3s_config['color_good']
        else:
            response['full_text'] = self.format_offline
            response['color'] = i3s_config['color_bad']

        return response

if __name__ == "__main__":
{'fraction_non_alphanumeric': 0.09379682349415643, 'fraction_numerical': 0.008990110878034162, 'mean_word_length': 2.087881591119334, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3203936', 'n_tokens_mistral': 957, 'n_tokens_neox': 919, 'n_words': 283}