<commit_before>unit class App::Nopaste:version<1.001001>;

use Pastebin::Gist;
use Pastebin::Shadowcat;

subset ValidPastebins of Str where any <gist shadow>;
method paste ( @files ) returns Str {
    if ( %*ENV<PASTEBIN_GIST_TOKEN> ) {
        my %paste;
        %paste{$_.IO.basename}<content> = $_.IO.slurp for @files;
        return Pastebin::Gist.new.paste(%paste);
    }
    else {
        my $content = @files.elems == 1
            ?? @files[0].IO.slurp
            !! join "\n\n\n", map { "#### File: $_\n" ~ $_.IO.slurp }, @files;

        return Pastebin::Shadowcat.new.paste($content);
    }
}

multi method fetch (Str $url where /gist/ ) returns List {
    my ( $files, $desc ) = Pastebin::Gist.new.fetch($url);
    my Str $paste; $paste ~= "#### File: $_\n$files{$_}" for $files.keys;
    return ( $paste, $desc.chars ?? $desc !! 'N/A' );
}

multi method fetch (Str $url where /fpaste/) returns List {
    my ( $paste, $desc ) = Pastebin::Shadowcat.new.fetch($url);
    return ( $paste, $desc.chars ?? $desc !! 'N/A' );
}<commit_msg>Use correct :ver adverb for version<commit_after>unit class App::Nopaste:ver<1.001001>;

use Pastebin::Gist;
use Pastebin::Shadowcat;

subset ValidPastebins of Str where any <gist shadow>;
method paste ( @files ) returns Str {
    if ( %*ENV<PASTEBIN_GIST_TOKEN> ) {
        my %paste;
        %paste{$_.IO.basename}<content> = $_.IO.slurp for @files;
        return Pastebin::Gist.new.paste(%paste);
    }
    else {
        my $content = @files.elems == 1
            ?? @files[0].IO.slurp
            !! join "\n\n\n", map { "#### File: $_\n" ~ $_.IO.slurp }, @files;

        return Pastebin::Shadowcat.new.paste($content);
    }
}

multi method fetch (Str $url where /gist/ ) returns List {
    my ( $files, $desc ) = Pastebin::Gist.new.fetch($url);
    my Str $paste; $paste ~= "#### File: $_\n$files{$_}" for $files.keys;
    return ( $paste, $desc.chars ?? $desc !! 'N/A' );
}

multi method fetch (Str $url where /fpaste/) returns List {
    my ( $paste, $desc ) = Pastebin::Shadowcat.new.fetch($url);
    return ( $paste, $desc.chars ?? $desc !! 'N/A' );
}
{'fraction_non_alphanumeric': 0.18797348484848486, 'fraction_numerical': 0.008522727272727272, 'mean_word_length': 2.9421641791044775, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '6094928', 'n_tokens_mistral': 802, 'n_tokens_neox': 768, 'n_words': 183}