<commit_before>/// gitter
/// http://github.com/samsonjs/gitter
/// @_sjs
///
/// Copyright 2010 <NAME> <<EMAIL>>
/// MIT License

// TODO:
//  - authentication and write APIs

(function() {
    var global = this
      , isBrowser = 'document' in global
      , ie

    if (isBrowser) {
        ie = (function() {
            var undef
              , v = 3
              , div = document.createElement('div')
              , all = div.getElementsByTagName('i')

            while (
              div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->',
              all[0]
            );

            return v > 4 ? v : undef
        }())
    }

    var inherits
    if ('create' in Object) {
        // util.inherits from node
        inherits = function(ctor, superCtor) {
            ctor.super_ = superCtor
            ctor.prototype = Object.create(superCtor.prototype, {
                constructor: {
                    value: ctor,
                    enumerable: false
                }
            })
        }
    } else if ([].__proto__) {
        inherits = function(ctor, superCtor) {
            ctor.super_ = superCtor
            ctor.prototype.__proto__ = superCtor.prototype
            ctor.prototype.constructor = ctor
        }
    } else { // ie8
        var __hasProp = Object.prototype.hasOwnProperty
        inherits = function(child, parent) {
            for (var key in parent) {
                if (__hasProp.call(parent, key)) child[key] = parent[key]
            }
            function ctor() { this.constructor = child }
            ctor.prototype = parent.prototype
            child.prototype = new ctor
            child.__super__ = parent.prototype
            return child
        }
    }

    // when running in the browser request is set later
    var request = isBrowser ? null : require('request')
      , Blob, Branch, Commit, Raw, Repo, Tree, User
      , api

    api = {
        blob: function(repo, sha, path, cb) {
            return new Blob(repo, sha, path, cb)
        },
        branch: function(repo, branch, cb) {
            return new Branch(repo, branch, cb)
        },
        commits: function(repo, branch, cb) {
            return new Branch(repo, branch).getCommits(cb)
        },
        commit: function(repo, sha, cb) {
            return new Commit(repo, sha, cb)
        },
        raw: function(repo, sha, cb) {
            return new Raw(repo, sha, cb)
        },
        repo: function(repo, cb) {
            return new Repo(repo, cb)
        },
        branches: function(repo, cb) {
            return new Repo(repo).getBranches(cb)
        },
        collaborators: function(repo, cb) {
            return new Repo(repo).getCollaborators(cb)
        },
        contributors: function(repo, cb) {
            return new Repo(repo).getContributors(cb)
        },
        languages: function(repo, cb) {
            return new Repo(repo).getLanguages(cb)
        },
        network: function(repo, cb) {
            return new Repo(repo).getNetwork(cb)
        },
        tags: function(repo, cb) {
            return new Repo(repo).getTags(cb)
        },
        watchers: function(repo, cb) {
            return new Repo(repo).getWatchers(cb)
        },
        tree: function(repo, sha, cb) {
            return new Tree(repo, sha, cb)
        },
        blobs: function(repo, sha, cb) {
            return new Tree(repo, sha).getBlobs(cb)
        },
        user: function(user, cb) {
            return new User(user, cb)
        },
        followers: function(user, cb) {
            return new User(user).getFollowers(cb)
        },
        following: function(user, cb) {
            return new User(user).getFollowing(cb)
        },
        repos: function(user, cb) {
            return new User(user).getRepos(cb)
        },
        watched: function(user, cb) {
            return new User(user).getWatched(cb)
        }
    }
    if (isBrowser) global.GITR = api
    else module.exports = api

    if (isBrowser) shim()

    // Define resources //

    Blob = createResource('blob/show/:repo/:tree/:path', {
        has: [ ['commits', 'commits/list/:repo/:tree/:path'] ]
    })
    Branch = createResource('commits/show/:repo/:branch', {
        has: [ ['commits', 'commits/list/:repo/:branch'] ]
    })
    Commit = createResource('commits/show/:repo/:sha')
    Raw = createResource('blob/show/:repo/:sha')
    Repo = createResource('repos/show/:repo', {
        has: [ 'branches'
             , 'collaborators'
             , 'contributors'
             , 'languages'
             , 'network'
             , 'tags'
             , 'watchers'
             ]
    })<commit_msg>raw does not work with jsonp in the browser, disable it<commit_after>/// gitter
/// http://github.com/samsonjs/gitter
/// @_sjs
///
/// Copyright 2010 <NAME> <<EMAIL>>
/// MIT License

// TODO:
//  - authentication and write APIs

(function() {
    var global = this
      , isBrowser = 'document' in global
      , ie

    if (isBrowser) {
        ie = (function() {
            var undef
              , v = 3
              , div = document.createElement('div')
              , all = div.getElementsByTagName('i')

            while (
              div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->',
              all[0]
            );

            return v > 4 ? v : undef
        }())
    }

    var inherits
    if ('create' in Object) {
        // util.inherits from node
        inherits = function(ctor, superCtor) {
            ctor.super_ = superCtor
            ctor.prototype = Object.create(superCtor.prototype, {
                constructor: {
                    value: ctor,
                    enumerable: false
                }
            })
        }
    } else if ([].__proto__) {
        inherits = function(ctor, superCtor) {
            ctor.super_ = superCtor
            ctor.prototype.__proto__ = superCtor.prototype
            ctor.prototype.constructor = ctor
        }
    } else { // ie8
        var __hasProp = Object.prototype.hasOwnProperty
        inherits = function(child, parent) {
            for (var key in parent) {
                if (__hasProp.call(parent, key)) child[key] = parent[key]
            }
            function ctor() { this.constructor = child }
            ctor.prototype = parent.prototype
            child.prototype = new ctor
            child.__super__ = parent.prototype
            return child
        }
    }

    // when running in the browser request is set later
    var request = isBrowser ? null : require('request')
      , Blob, Branch, Commit, Raw, Repo, Tree, User
      , api

    api = {
        blob: function(repo, sha, path, cb) {
            return new Blob(repo, sha, path, cb)
        },
        branch: function(repo, branch, cb) {
            return new Branch(repo, branch, cb)
        },
        commits: function(repo, branch, cb) {
            return new Branch(repo, branch).getCommits(cb)
        },
        commit: function(repo, sha, cb) {
            return new Commit(repo, sha, cb)
        },
        // raw doesn't work with jsonp ... cors?
        raw: isBrowser ? undefined : function(repo, sha, cb) {
            return new Raw(repo, sha, cb)
        },
        repo: function(repo, cb) {
            return new Repo(repo, cb)
        },
        branches: function(repo, cb) {
            return new Repo(repo).getBranches(cb)
        },
        collaborators: function(repo, cb) {
            return new Repo(repo).getCollaborators(cb)
        },
        contributors: function(repo, cb) {
            return new Repo(repo).getContributors(cb)
        },
        languages: function(repo, cb) {
            return new Repo(repo).getLanguages(cb)
        },
        network: function(repo, cb) {
            return new Repo(repo).getNetwork(cb)
        },
        tags: function(repo, cb) {
            return new Repo(repo).getTags(cb)
        },
        watchers: function(repo, cb) {
            return new Repo(repo).getWatchers(cb)
        },
        tree: function(repo, sha, cb) {
            return new Tree(repo, sha, cb)
        },
        blobs: function(repo, sha, cb) {
            return new Tree(repo, sha).getBlobs(cb)
        },
        user: function(user, cb) {
            return new User(user, cb)
        },
        followers: function(user, cb) {
            return new User(user).getFollowers(cb)
        },
        following: function(user, cb) {
            return new User(user).getFollowing(cb)
        },
        repos: function(user, cb) {
            return new User(user).getRepos(cb)
        },
        watched: function(user, cb) {
            return new User(user).getWatched(cb)
        }
    }
    if (isBrowser) global.GITR = api
    else module.exports = api

    if (isBrowser) shim()

    // Define resources //

    Blob = createResource('blob/show/:repo/:tree/:path', {
        has: [ ['commits', 'commits/list/:repo/:tree/:path'] ]
    })
    Branch = createResource('commits/show/:repo/:branch', {
        has: [ ['commits', 'commits/list/:repo/:branch'] ]
    })
    Commit = createResource('commits/show/:repo/:sha')
    // raw doesn't work with jsonp ... cors?
    if (!isBrowser) Raw = createResource('blob/show/:repo/:sha')
    Repo = createResource('repos/show/:repo', {
        has: [ 'branches'
             , 'collaborators'
             , 'contributors'
             , 'languages'
             , 'network'
             , 'tags'
             , 'watchers'
             ]
    })
{'fraction_non_alphanumeric': 0.12893742125157498, 'fraction_numerical': 0.0016799664006719867, 'mean_word_length': 1.5890187550964936, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 19, 'https://': 0, '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': '2426705', 'n_tokens_mistral': 2783, 'n_tokens_neox': 2758, 'n_words': 656}