<commit_before># -*- coding: utf-8 -*-

import requests
import logging
import json

from flask import Blueprint, g, url_for
from flask_restful import Api, Resource, reqparse

from drift.urlregistry import register_endpoints

bp = Blueprint("staticdata", __name__)
api = Api(bp)

log = logging.getLogger(__file__)


# Assumption: The static data CDN is here:
INDEX_URL = "https://s3-eu-west-1.amazonaws.com/directive-tiers.dg-api.com/static-data/"
DATA_URL = "https://static-data.dg-api.com/"

CDN_LIST = [
    ['cloudfront', DATA_URL],
    ['alicloud', 'http://directive-tiers.oss-cn-shanghai.aliyuncs.com/static-data/'],
]


def get_static_data_ids():
    revs = {}
    try:
        data = g.conf.tenant.get('static_data_refs_legacy')
        if data:
            origin = "Tenant config"
        else:
            data = {
                "repository": "directivegames/the-machines-static-data",
                "revision": "refs/heads/develop",
            }
            origin = "Hardcoded defaults"

        repo = data['repository']
        revs[repo] = data, origin
    except:
        log.error("Error getting static data. data='%s', origin='%s'" % (repr(data), origin))
        log.exception("Failed to get static data config.")

    return revs

<commit_msg>Removing silly default values in get_static_data_ids() function as they will simply cause an error somewhere else.<commit_after># -*- coding: utf-8 -*-

import requests
import logging
import json

from flask import Blueprint, g, url_for
from flask_restful import Api, Resource, reqparse

from drift.urlregistry import register_endpoints

bp = Blueprint("staticdata", __name__)
api = Api(bp)

log = logging.getLogger(__file__)


# Assumption: The static data CDN is here:
INDEX_URL = "https://s3-eu-west-1.amazonaws.com/directive-tiers.dg-api.com/static-data/"
DATA_URL = "https://static-data.dg-api.com/"

CDN_LIST = [
    ['cloudfront', DATA_URL],
    ['alicloud', 'http://directive-tiers.oss-cn-shanghai.aliyuncs.com/static-data/'],
]


def get_static_data_ids():
    data = g.conf.tenant.get('static_data_refs_legacy')
    if data:
        origin = "Tenant config"
        repo = data['repository']
        return {repo: (data, origin)}
    else:
        return {}


{'fraction_non_alphanumeric': 0.13276709879302637, 'fraction_numerical': 0.002682163611980331, 'mean_word_length': 3.1367837338262476, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, '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': '905764', 'n_tokens_mistral': 745, 'n_tokens_neox': 727, 'n_words': 170}