<commit_before>/*! amdclean - v0.2.2 - 2013-10-13 
* http://gregfranko.com/amdclean
* Copyright (c) 2013 <NAME>; Licensed MIT*/

(function (root, factory, undefined) {
    'use strict';
    // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js,
    // and plain browser loading,
    if (typeof define === 'function' && define.amd) {
        if(typeof exports !== 'undefined') {
            factory.env = 'node';
        } else {
            factory.env = 'web';
        }
        define([], function() {
            return factory();
        });
    } else if (typeof exports !== 'undefined') {
        factory.env = 'node';
        factory();
    } else {
        factory.env = 'web';
        root.amdclean = factory();
    }
}(this, function cleanamd() {
    // Environment - either node or web
    var codeEnv = cleanamd.env,
        // Third-Party Dependencies
        esprima = codeEnv === 'node' ? require('esprima'): window.esprima,
        estraverse = codeEnv === 'node' ? require('estraverse'): window.estraverse,
        escodegen = codeEnv === 'node' ? require('escodegen'): window.escodegen,
        _ = codeEnv === 'node' ? require('lodash'): window._,
        fs = codeEnv === 'node' ? require('fs'): {}, // End Third-Party Dependencies
        // The Public API object
        publicAPI = {
            // Current project version number
            VERSION: '0.2.2',
            // Environment - either node or web
            env: codeEnv,
            // Object that keeps track of module ids/names that are used
            moduleNamesStore: {},
            // All of the error messages presented to users
            errorMsgs: {
                // A module is defined more than one time
                'uniqueModuleName': {
                    'error': function(moduleName) {
                        return 'Error: ' + 'Not a unique module name: ' + moduleName + '\n';
                    },
                    'fix': 'Fix: ' + 'Make sure that you assign unique module paths using the require.config() method.  Take a look at http://requirejs.org/docs/api.html#config for more details\n',
                    'exiting': 'Result: Did not complete and exiting...'
                },
                // The user has not supplied the cliean method with any code
                'emptyCode': 'There is no code to generate the AST with',
                // An AST has not been correctly returned by Esprima
                'emptyAst': function(methodName) {
                    return 'An AST is not being passed to the ' + methodName + '() method';
                },
                // A parameter is not an object literal (which is expected)
                'invalidObject': function(methodName) {
                    return 'An object is not being passed as the first parameter to the ' + methodName + '() method';
                },
                // Third-party dependencies have not been included on the page
                'lodash': 'There is not an _.isPlainObject() method.  Make sure you have included lodash (https://github.com/lodash/lodash).',
                'esprima': 'There is not an esprima.parse() method.  Make sure you have included esprima (https://github.com/ariya/esprima).',
                'estraverse': 'There is not an estraverse.replace() method.  Make sure you have included estraverse (https://github.com/Constellation/estraverse).',
                'escodegen': 'There is not an escodegen.generate() method.  Make sure you have included escodegen (https://github.com/Constellation/escodegen).'
            },
            // readFile
            // --------
            //  Synchronous file reading for node
            readFile: function(path) {
                if(publicAPI.env !== 'node') {
                    return '';
                }
                return fs.readFileSync(path, 'utf8');
            },
            // isDefine
            // --------
            //  Returns if the current AST node is a define() method call
            isDefine: function(node) {
                var expression = node.expression || {},
                    callee = expression.callee;
                return node.type === 'ExpressionStatement' &&
                    !_.isUndefined(expression) &&
                    expression.type === 'CallExpression' &&
                    callee.type === 'Identifier' &&
                    callee.name === 'define';
            },
            // isRequire
            // ---------
            //  Returns if the current AST node is a require() method call
            isRequire: function(node) {
                var expression = node.expression || {},
                    callee = expression.callee;
                return node.type === 'ExpressionStatement' &&
                    !_.isUndefined(expression) &&
                    expression.type === 'CallExpression' &&
                    callee.type === 'Identifier' &&
                    callee.name === 'require';
            },
            // isObjectExpression
            // ------------------
            //  Returns if the current AST node is an object literal
            isObjectExpression: function(expression) {
                return expression && _.isPlainObject(expression) && expression.type === 'ObjectExpression';
            },
            // isFunctionExpression
            // --------------------
            //  Returns if the current AST node is a function
            isFunctionExpression: function(expression) {
                return expression && _.isPlainObject(expression) && expression.type === 'FunctionExpression';
            },
            // normalizeModuleName
            // -------------------
            //  Returns a normalized module name (removes relative file path urls)
            normalizeModuleName: function(name) {
                name = name || '';
                var moduleName = name,
                    folderName,
                    fileName,
                    lastIndex = name.lastIndexOf('/'),
                    containsRelativePath = name.lastIndexOf('/') !== -1;
                if(containsRelativePath) {
                    moduleName = moduleName.substring(0, lastIndex);
                    folderName = moduleName.substring((moduleName.lastIndexOf('/') + 1), moduleName.length);
                    fileName = name.substring((lastIndex + 1), name.length);
                    return folderName + '_' + fileName;
                } else {
                    return name;
                }
            },
            // hasUniqueModelName
            // ------------------
            //  Returns if the current module id/name has already been used
            hasUniqueModuleName: function(node) {
                var moduleName;
                if( node.expression['arguments'] &&
                    Array.isArray(node.expression['arguments']) &&
                    _.isPlainObject(node.expression['arguments'][0]) &&
                    node.expression['arguments'][0].value ) {
                        moduleName = node.expression['arguments'][0].value;
                        if(_.isString(moduleName) && moduleName.length > 0 && !publicAPI.moduleNamesStore[moduleName]) {
                            publicAPI.moduleNamesStore[moduleName] = true;
                            return true;
                        }
                        else {
                            throw new Error(publicAPI.errorMsgs.uniqueModuleName.error(moduleName) + publicAPI.errorMsgs.uniqueModuleName.fix + publicAPI.errorMsgs.uniqueModuleName.exiting);
                        }
                } else {
                    return true;
                }
            },
            // convertToObjectDeclaration
            // --------------------------
            //  Returns an object variable declaration
            //  ( e.g. var example = { exampleProp: true } )
            convertToObjectDeclaration: function(obj) {
                var node = obj.node,
                    moduleName  = obj.moduleName,
                    moduleReturnValue = obj.moduleReturnValue;
                return {
                    'type': 'VariableDeclaration',
                    'declarations': [
                        {
                            'type': 'VariableDeclarator',
                            'id': {
                                'type': 'Identifier',
                                'name': moduleName
                            },
                            'init': moduleReturnValue
                        }
                    ],
                    'kind': 'var'
                };
            },
            // convertToIIFE
            // -------------
            //  Returns an IIFE
            //  ( e.g. (function() { }()) )
            convertToIIFE: function(obj) {
                var callbackFuncParams = obj.callbackFuncParams,
                    callbackFunc = obj.callbackFunc,
                    dependencyNames = obj.dependencyNames;
                // console.log('dependencyNames', dependencyNames);
                return {
                    'type': 'ExpressionStatement',
                    'expression': {<commit_msg>Removed commented out console.log statement<commit_after>/*! amdclean - v0.2.2 - 2013-10-13 
* http://gregfranko.com/amdclean
* Copyright (c) 2013 <NAME>; Licensed MIT*/

(function (root, factory, undefined) {
    'use strict';
    // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js,
    // and plain browser loading,
    if (typeof define === 'function' && define.amd) {
        if(typeof exports !== 'undefined') {
            factory.env = 'node';
        } else {
            factory.env = 'web';
        }
        define([], function() {
            return factory();
        });
    } else if (typeof exports !== 'undefined') {
        factory.env = 'node';
        factory();
    } else {
        factory.env = 'web';
        root.amdclean = factory();
    }
}(this, function cleanamd() {
    // Environment - either node or web
    var codeEnv = cleanamd.env,
        // Third-Party Dependencies
        esprima = codeEnv === 'node' ? require('esprima'): window.esprima,
        estraverse = codeEnv === 'node' ? require('estraverse'): window.estraverse,
        escodegen = codeEnv === 'node' ? require('escodegen'): window.escodegen,
        _ = codeEnv === 'node' ? require('lodash'): window._,
        fs = codeEnv === 'node' ? require('fs'): {}, // End Third-Party Dependencies
        // The Public API object
        publicAPI = {
            // Current project version number
            VERSION: '0.2.2',
            // Environment - either node or web
            env: codeEnv,
            // Object that keeps track of module ids/names that are used
            moduleNamesStore: {},
            // All of the error messages presented to users
            errorMsgs: {
                // A module is defined more than one time
                'uniqueModuleName': {
                    'error': function(moduleName) {
                        return 'Error: ' + 'Not a unique module name: ' + moduleName + '\n';
                    },
                    'fix': 'Fix: ' + 'Make sure that you assign unique module paths using the require.config() method.  Take a look at http://requirejs.org/docs/api.html#config for more details\n',
                    'exiting': 'Result: Did not complete and exiting...'
                },
                // The user has not supplied the cliean method with any code
                'emptyCode': 'There is no code to generate the AST with',
                // An AST has not been correctly returned by Esprima
                'emptyAst': function(methodName) {
                    return 'An AST is not being passed to the ' + methodName + '() method';
                },
                // A parameter is not an object literal (which is expected)
                'invalidObject': function(methodName) {
                    return 'An object is not being passed as the first parameter to the ' + methodName + '() method';
                },
                // Third-party dependencies have not been included on the page
                'lodash': 'There is not an _.isPlainObject() method.  Make sure you have included lodash (https://github.com/lodash/lodash).',
                'esprima': 'There is not an esprima.parse() method.  Make sure you have included esprima (https://github.com/ariya/esprima).',
                'estraverse': 'There is not an estraverse.replace() method.  Make sure you have included estraverse (https://github.com/Constellation/estraverse).',
                'escodegen': 'There is not an escodegen.generate() method.  Make sure you have included escodegen (https://github.com/Constellation/escodegen).'
            },
            // readFile
            // --------
            //  Synchronous file reading for node
            readFile: function(path) {
                if(publicAPI.env !== 'node') {
                    return '';
                }
                return fs.readFileSync(path, 'utf8');
            },
            // isDefine
            // --------
            //  Returns if the current AST node is a define() method call
            isDefine: function(node) {
                var expression = node.expression || {},
                    callee = expression.callee;
                return node.type === 'ExpressionStatement' &&
                    !_.isUndefined(expression) &&
                    expression.type === 'CallExpression' &&
                    callee.type === 'Identifier' &&
                    callee.name === 'define';
            },
            // isRequire
            // ---------
            //  Returns if the current AST node is a require() method call
            isRequire: function(node) {
                var expression = node.expression || {},
                    callee = expression.callee;
                return node.type === 'ExpressionStatement' &&
                    !_.isUndefined(expression) &&
                    expression.type === 'CallExpression' &&
                    callee.type === 'Identifier' &&
                    callee.name === 'require';
            },
            // isObjectExpression
            // ------------------
            //  Returns if the current AST node is an object literal
            isObjectExpression: function(expression) {
                return expression && _.isPlainObject(expression) && expression.type === 'ObjectExpression';
            },
            // isFunctionExpression
            // --------------------
            //  Returns if the current AST node is a function
            isFunctionExpression: function(expression) {
                return expression && _.isPlainObject(expression) && expression.type === 'FunctionExpression';
            },
            // normalizeModuleName
            // -------------------
            //  Returns a normalized module name (removes relative file path urls)
            normalizeModuleName: function(name) {
                name = name || '';
                var moduleName = name,
                    folderName,
                    fileName,
                    lastIndex = name.lastIndexOf('/'),
                    containsRelativePath = name.lastIndexOf('/') !== -1;
                if(containsRelativePath) {
                    moduleName = moduleName.substring(0, lastIndex);
                    folderName = moduleName.substring((moduleName.lastIndexOf('/') + 1), moduleName.length);
                    fileName = name.substring((lastIndex + 1), name.length);
                    return folderName + '_' + fileName;
                } else {
                    return name;
                }
            },
            // hasUniqueModelName
            // ------------------
            //  Returns if the current module id/name has already been used
            hasUniqueModuleName: function(node) {
                var moduleName;
                if( node.expression['arguments'] &&
                    Array.isArray(node.expression['arguments']) &&
                    _.isPlainObject(node.expression['arguments'][0]) &&
                    node.expression['arguments'][0].value ) {
                        moduleName = node.expression['arguments'][0].value;
                        if(_.isString(moduleName) && moduleName.length > 0 && !publicAPI.moduleNamesStore[moduleName]) {
                            publicAPI.moduleNamesStore[moduleName] = true;
                            return true;
                        }
                        else {
                            throw new Error(publicAPI.errorMsgs.uniqueModuleName.error(moduleName) + publicAPI.errorMsgs.uniqueModuleName.fix + publicAPI.errorMsgs.uniqueModuleName.exiting);
                        }
                } else {
                    return true;
                }
            },
            // convertToObjectDeclaration
            // --------------------------
            //  Returns an object variable declaration
            //  ( e.g. var example = { exampleProp: true } )
            convertToObjectDeclaration: function(obj) {
                var node = obj.node,
                    moduleName  = obj.moduleName,
                    moduleReturnValue = obj.moduleReturnValue;
                return {
                    'type': 'VariableDeclaration',
                    'declarations': [
                        {
                            'type': 'VariableDeclarator',
                            'id': {
                                'type': 'Identifier',
                                'name': moduleName
                            },
                            'init': moduleReturnValue
                        }
                    ],
                    'kind': 'var'
                };
            },
            // convertToIIFE
            // -------------
            //  Returns an IIFE
            //  ( e.g. (function() { }()) )
            convertToIIFE: function(obj) {
                var callbackFuncParams = obj.callbackFuncParams,
                    callbackFunc = obj.callbackFunc,
                    dependencyNames = obj.dependencyNames;
                return {
                    'type': 'ExpressionStatement',
                    'expression': {
{'fraction_non_alphanumeric': 0.11959370904325033, 'fraction_numerical': 0.002948885976408912, 'mean_word_length': 1.3175145532776513, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 8, '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': '3462901', 'n_tokens_mistral': 4325, 'n_tokens_neox': 4102, 'n_words': 1132}