<commit_before>'use strict';
function Repo(options) {
    const tools  = require(__dirname + '/../tools.js');
    const extend = require('node.extend');
    const defaultSystemRepo = {
        common: {
            name: 'System repositories',
            dontDelete: true
        },
        native: {
            repositories: {
                default: {
                    link: 'http://download.iobroker.net/sources-dist.json',
                    json: null
                },
                latest: {
                    link: 'http://download.iobroker.net/sources-dist-latest.json',
                    json: null
                }
            }
        },
        _id: 'system.repositories',
        type: 'config'
    };

    options = options || {};

    if (!options.objects) {
        throw 'Invalid arguments: objects is missing';
    }
    if (!options.states) {
        throw 'Invalid arguments: states is missing';
    }

    const objects = options.objects;
    const states  = options.states;

    function download(downloads, sources, result, sourcesHash, callback) {
        if (downloads.length < 1) {
            console.log('update done');
            callback && callback(result, sourcesHash);
        } else {
            const name = downloads.pop();

            if (sources[name].version) {
                result[name] = sources[name];
            } else if (sources[name].meta) {
                return tools.getJson(sources[name].meta, ioPack => {
                    if (ioPack && ioPack.common) {
                        result[name] = extend(true, sources[name], ioPack.common);
                    }
                    setImmediate(downloads, sources, result, sourcesHash, callback);
                });
            } else if (sources[name].url) {
                console.log('Cannot get version of "' + name + '".');
                result[name] = sources[name];
            } else {
                console.log('Cannot get any information of "' + name + '". Ignored.');
            }
            setImmediate(downloads, sources, result, sourcesHash, callback);
        }
    }

    function updateRepo(repoUrl, sourcesHash, callback) {<commit_msg>Fix error introduced by 23f02c1<commit_after>'use strict';
function Repo(options) {
    const tools  = require(__dirname + '/../tools.js');
    const extend = require('node.extend');
    const defaultSystemRepo = {
        common: {
            name: 'System repositories',
            dontDelete: true
        },
        native: {
            repositories: {
                default: {
                    link: 'http://download.iobroker.net/sources-dist.json',
                    json: null
                },
                latest: {
                    link: 'http://download.iobroker.net/sources-dist-latest.json',
                    json: null
                }
            }
        },
        _id: 'system.repositories',
        type: 'config'
    };

    options = options || {};

    if (!options.objects) {
        throw 'Invalid arguments: objects is missing';
    }
    if (!options.states) {
        throw 'Invalid arguments: states is missing';
    }

    const objects = options.objects;
    const states  = options.states;

    function download(downloads, sources, result, sourcesHash, callback) {
        if (downloads.length < 1) {
            console.log('update done');
            callback && callback(result, sourcesHash);
        } else {
            const name = downloads.pop();

            if (sources[name].version) {
                result[name] = sources[name];
            } else if (sources[name].meta) {
                return tools.getJson(sources[name].meta, ioPack => {
                    if (ioPack && ioPack.common) {
                        result[name] = extend(true, sources[name], ioPack.common);
                    }
                    setImmediate(download, downloads, sources, result, sourcesHash, callback);
                });
            } else if (sources[name].url) {
                console.log('Cannot get version of "' + name + '".');
                result[name] = sources[name];
            } else {
                console.log('Cannot get any information of "' + name + '". Ignored.');
            }
            setImmediate(download, downloads, sources, result, sourcesHash, callback);
        }
    }

    function updateRepo(repoUrl, sourcesHash, callback) {
{'fraction_non_alphanumeric': 0.12103354487760652, 'fraction_numerical': 0.001586582048957389, 'mean_word_length': 1.5582608695652174, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, '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': '6474287', 'n_tokens_mistral': 1154, 'n_tokens_neox': 1098, 'n_words': 258}