<commit_before>import requests
import json
import datetime
import re
import math
from ..resource_bases import Downloader


class Mojang(Downloader):

    url = 'http://s3.amazonaws.com/Minecraft.Download/versions/versions.json'
    download_url_base = 'https://s3.amazonaws.com/Minecraft.Download/versions/{0}/minecraft_server.{0}.jar'

    descriptions = {
        'release': 'An official release of a Minecraft version.',
        'snapshot': 'The latest testing snapshot of Minecraft. It may be unstable!'
    }

    def __init__(self):
        pass

    def load_pack(self, path, url):
        r = requests.get(url, stream=True)
        with open(path, 'wb') as f:
            for chunk in r.iter_content(chunk_size=1024):
                if chunk:
                    f.write(chunk)
                    f.flush()

    def get_description(self, t):
        if t in self.descriptions:
            return self.descriptions[t]

        return ''

    def parse_version(self, version):

        if version['type'].startswith('old_'):
            return

        url = self.download_url_base.format(version['id'])
        released = datetime.datetime.strptime(re.sub(r'\+[0-9]{2}:[0-9]{2}$', '',
                                                     version['releaseTime']), '%Y-%m-%dT%H:%M:%S')
        return {
            '$parents': [
                {
                    '$id': 'minecraft',
                    'resource': 'game',
                    'name': 'Minecraft'
                }, {
                    '$id': version['type'],
                    'resource': 'type',
                    'name': ' '.join([n.capitalize() for n in version['type'].split('_')]),
                    'author': 'Mojang',
                    'description': self.get_description(version['type'])
                }, {
                    '$id': version['id'],
                    'resource': 'version',
                    'version': version['id']
                }
            ],
            '$id': version['id'],
            '$load': lambda path: self.download(url, path),
            '$patched': False,
            'resource': 'build',
            'created': released,<commit_msg>Load snapshot/release into dedicated channels<commit_after>import requests
import json
import datetime
import re
import math
from ..resource_bases import Downloader


class Mojang(Downloader):

    url = 'http://s3.amazonaws.com/Minecraft.Download/versions/versions.json'
    download_url_base = 'https://s3.amazonaws.com/Minecraft.Download/versions/{0}/minecraft_server.{0}.jar'

    def __init__(self):
        pass

    def load_pack(self, path, url):
        r = requests.get(url, stream=True)
        with open(path, 'wb') as f:
            for chunk in r.iter_content(chunk_size=1024):
                if chunk:
                    f.write(chunk)
                    f.flush()

    def get_description(self, t):
        if t in self.descriptions:
            return self.descriptions[t]

        return ''

    def parse_version(self, version):

        if version['type'].startswith('old_'):
            return

        url = self.download_url_base.format(version['id'])
        released = datetime.datetime.strptime(re.sub(r'\+[0-9]{2}:[0-9]{2}$', '',
                                                     version['releaseTime']), '%Y-%m-%dT%H:%M:%S')
        return {
            '$parents': [
                {
                    '$id': 'minecraft',
                    'resource': 'game',
                    'name': 'Minecraft'
                }, {
                    '$id': 'vanilla',
                    'resource': 'type',
                    'name': 'Vanilla Minecraft',
                    'author': 'Mojang',
                    'description': ''
                }, {
                    '$id': version['type'],
                    'resource': 'channel',
                    'name': ' '.join([n.capitalize() for n in version['type'].split('_')])
                }, {
                    '$id': version['id'],
                    'resource': 'version',
                    'version': version['id']
                }
            ],
            '$id': version['id'],
            '$load': lambda path: self.download(url, path),
            '$patched': False,
            'resource': 'build',
            'created': released,
{'fraction_non_alphanumeric': 0.14481318171269436, 'fraction_numerical': 0.006498027384543977, 'mean_word_length': 1.5204678362573099, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 18, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7536987', 'n_tokens_mistral': 1189, 'n_tokens_neox': 1133, 'n_words': 241}