<commit_before>'use strict';

var async = require('async');
var githubLib = require('github');

var shouldDeleteFork = require('./shouldDeleteFork');

var githubFactory = function(token){
	var res = new githubLib({
		version: '3.0.0'
	});
	res.authenticate({
		type: 'oauth',
		token: token
	});
	return res;
};

var api = function(token, cb){
	api.get(token, function(err, repos){
		if (err) return cb(err);
		api.remove(token, repos, cb);
	});
};

api.get = function(token, cb){
	var github = githubFactory(token);
	async.waterfall([
		// Get all repositories
		function(cb){
			github.repos.getAll({}, cb);
		},

		// Keep only forks
		function(repos, cb){
			var forks = repos.filter(function(repo){
				return repo.fork;
			});
			cb(null, forks);
		},

		// Keep only useless forks
		function(forks, cb){
			async.filter(forks, shouldDeleteFork(github), function(forksToDelete){
				cb(null, forksToDelete);
			});
		},

		// Map to our simple objects
		function(forks, cb){
			var res = forks.map(function(fork){
				return {
					user: fork.owner.login,
					repo: fork.name
				};
			});
			cb(null, res);
		}
	], cb);
};

api.remove = function(token, repos, cb){
	var github = githubFactory(token);
	async.each(repos, function(repo, cb){
		github.repos['delete'](repo, cb);
	}, cb);
};

module.exports = api;
<commit_msg>get 100 repos at a time, instead of 30<commit_after>'use strict';

var async = require('async');
var githubLib = require('github');

var shouldDeleteFork = require('./shouldDeleteFork');

var githubFactory = function(token){
	var res = new githubLib({
		version: '3.0.0'
	});
	res.authenticate({
		type: 'oauth',
		token: token
	});
	return res;
};

var api = function(token, cb){
	api.get(token, function(err, repos){
		if (err) return cb(err);
		api.remove(token, repos, cb);
	});
};

api.get = function(token, cb){
	var github = githubFactory(token);
	async.waterfall([
		// Get all repositories
		function(cb){
			github.repos.getAll({ per_page : 100, type: "public"}, cb);
		},

		// Keep only forks
		function(repos, cb){
			var forks = repos.filter(function(repo){
				return repo.fork;
			});
			cb(null, forks);
		},

		// Keep only useless forks
		function(forks, cb){
			async.filter(forks, shouldDeleteFork(github), function(forksToDelete){
				cb(null, forksToDelete);
			});
		},

		// Map to our simple objects
		function(forks, cb){
			var res = forks.map(function(fork){
				return {
					user: fork.owner.login,
					repo: fork.name
				};
			});
			cb(null, res);
		}
	], cb);
};

api.remove = function(token, repos, cb){
	var github = githubFactory(token);
	async.each(repos, function(repo, cb){
		github.repos['delete'](repo, cb);
	}, cb);
};

module.exports = api;

{'fraction_non_alphanumeric': 0.17071376011773362, 'fraction_numerical': 0.0051508462104488595, 'mean_word_length': 3.6241496598639458, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2901660', 'n_tokens_mistral': 1129, 'n_tokens_neox': 953, 'n_words': 232}