<commit_before># coding=utf-8
__author__ = "<NAME> <<EMAIL>>"
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'

import urllib2
import subprocess

from octoprint.settings import settings


class NetworkManager(object):
    def __init__(self):
        self.settings = settings()

    def isAstroprintReachable(self):
        try:
            urllib2.urlopen(
                "%s/check" % settings().get(['cloudSlicer', 'apiHost']),
                timeout=1
            )
            return True

        except urllib2.URLError:
            return False

    def checkOnline(self):
        timeout = 1
        # Google DNS(2), OpenDNS(2)
        addresses = ['8.8.8.8', '8.8.4.4', '208.67.222.222', '208.67.220.220']

        for addr in addresses:
            status = subprocess.call(
                "ping -W %d -c 1 %s > /dev/null 2>&1" % \
                (timeout, addr), shell=True)
            if status == 0:
                return True
            else:
                continue

        return False<commit_msg>change network endpoint to according to our api<commit_after># coding=utf-8
__author__ = "<NAME> <<EMAIL>>"
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'

import urllib2
import subprocess

from octoprint.settings import settings


class NetworkManager(object):
    def __init__(self):
        self.settings = settings()

    def isAstroprintReachable(self):
        try:
            urllib2.urlopen(
                "%s/api/check/" % settings().get(['cloudSlicer', 'apiHost']),
                timeout=1
            )
            return True

        except urllib2.URLError:
            return False

    def checkOnline(self):
        timeout = 1
        # Google DNS(2), OpenDNS(2)
        addresses = ['8.8.8.8', '8.8.4.4', '208.67.222.222', '208.67.220.220']

        for addr in addresses:
            status = subprocess.call(
                "ping -W %d -c 1 %s > /dev/null 2>&1" % \
                (timeout, addr), shell=True)
            if status == 0:
                return True
            else:
                continue

        return False
{'fraction_non_alphanumeric': 0.11949976841130153, 'fraction_numerical': 0.03890690134321445, 'mean_word_length': 1.7551020408163265, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 8, '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': '2345115', 'n_tokens_mistral': 714, 'n_tokens_neox': 647, 'n_words': 162}