<commit_before>import logging
import os.path
import sys
import tarfile
import zipfile
import shutil

logger = logging.getLogger(__name__)

if sys.version_info[0] >= 3:
    import urllib.request as urllib
    from urllib.error import URLError
    from urllib.error import HTTPError
else:
    import urllib
    from urllib2 import URLError
    from urllib2 import HTTPError

from fusesoc.provider.provider import Provider

class Url(Provider):

    def _checkout(self, local_dir):
        url = self.config.get('url')
        logger.info("Downloading...")
        user_agent = self.config.get('user-agent')
        if user_agent:
            opener = urllib.build_opener()
            opener.addheaders = [('User-agent', user_agent)]
            urllib.install_opener(opener)<commit_msg>Temporarily disable support for setting user-agent on python2<commit_after>import logging
import os.path
import sys
import tarfile
import zipfile
import shutil

logger = logging.getLogger(__name__)

if sys.version_info[0] >= 3:
    import urllib.request as urllib
    from urllib.error import URLError
    from urllib.error import HTTPError
else:
    import urllib
    from urllib2 import URLError
    from urllib2 import HTTPError

from fusesoc.provider.provider import Provider

class Url(Provider):

    def _checkout(self, local_dir):
        url = self.config.get('url')
        logger.info("Downloading...")
        user_agent = self.config.get('user-agent')
        if user_agent and sys.version_info[0] >= 3:
            opener = urllib.build_opener()
            opener.addheaders = [('User-agent', user_agent)]
            urllib.install_opener(opener)
{'fraction_non_alphanumeric': 0.0862173649058895, 'fraction_numerical': 0.006678809957498482, 'mean_word_length': 3.204081632653061, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, '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': '625641', 'n_tokens_mistral': 527, 'n_tokens_neox': 518, 'n_words': 133}