<commit_before>require 'autoproj'
require 'autoproj/cli/inspection_tool'
require 'tty-table'

module Autoproj
    module CLI
        class Git < InspectionTool
            def cleanup(user_selection, options = Hash.new)
                initialize_and_load
                source_packages, * =
                    finalize_setup(user_selection,
                                   ignore_non_imported_packages: true)
                git_packages = source_packages.map do |pkg_name|
                    pkg = ws.manifest.find_autobuild_package(pkg_name)
                    pkg if pkg.importer.kind_of?(Autobuild::Git)
                end.compact

                git_packages.each_with_index do |pkg, i|
                    cleanup_package(pkg, "[#{i}/#{git_packages.size}] ",
                                    local: options[:local],
                                    remove_obsolete_remotes: options[:remove_obsolete_remotes])
                end
            end

            def git_gc(pkg, progress)
                pkg.progress_start "#{progress}%s: gc", done_message: "#{progress}%s: gc" do
                    pkg.importer.run_git_bare(pkg, 'gc')
                end
            end<commit_msg>update for the 2.0 final API<commit_after>require 'autoproj'
require 'autoproj/cli/inspection_tool'
require 'tty-table'

module Autoproj
    module CLI
        class Git < InspectionTool
            def cleanup(user_selection, options = Hash.new)
                initialize_and_load
                source_packages, * =
                    finalize_setup(user_selection,
                                   non_imported_packages: :ignore)
                git_packages = source_packages.map do |pkg_name|
                    pkg = ws.manifest.find_autobuild_package(pkg_name)
                    pkg if pkg.importer.kind_of?(Autobuild::Git)
                end.compact

                git_packages.each_with_index do |pkg, i|
                    cleanup_package(pkg, "[#{i}/#{git_packages.size}] ",
                                    local: options[:local],
                                    remove_obsolete_remotes: options[:remove_obsolete_remotes])
                end
            end

            def git_gc(pkg, progress)
                pkg.progress_start "#{progress}%s: gc", done_message: "#{progress}%s: gc" do
                    pkg.importer.run_git_bare(pkg, 'gc')
                end
            end
{'fraction_non_alphanumeric': 0.0819197352089367, 'fraction_numerical': 0.0008274720728175424, 'mean_word_length': 1.5109034267912773, 'pattern_counts': {'":': 0, '<': 5, '<?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': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3479211', 'n_tokens_mistral': 690, 'n_tokens_neox': 626, 'n_words': 120}