<commit_before>class Panda::Reporter;

has $.bone is rw;

method submit {
    if %*ENV<PANDA_SUBMIT_TESTREPORTS> {
        my $s;
        my $to-send = '';
        if %*ENV<http_proxy> {
            my ($host, $port) = %*ENV<http_proxy>.split('/').[2].split(':');
            $s                = IO::Socket::INET.new( :$host, :port($port.Int) );
            $to-send          = "POST http://127.0.0.1:3000/report HTTP/1.1\nHost: localhost\nConnection: Close";
        }
        else {
            $s       = IO::Socket::INET.new(:host<127.0.0.1>, :port(3000));
            $to-send = "POST /report HTTP/1.0";
        }

        my $buf = Buf.new(self.to-json.ords);
        $s.send("$to-send\nContent-Type: application/json\r\nContent-Length: $buf.elems()\r\n\r\n");
        $s.write($buf);

        CATCH {
            die "Could not submit test report: {$_.message}"
        }
    }
}

method to-json {
    to-json {
        :name($!bone.name),
        :version($!bone.version),
        :dependencies($!bone.dependencies),
        :metainfo($!bone.metainfo),
        :build-output($!bone.build-output),
        :build-passed($!bone.build-passed),
        :test-output($!bone.test-output),
        :test-passed($!bone.test-passed),
        :distro({
            :name($*DISTRO.name),
            :version($*DISTRO.version.Str),
            :auth($*DISTRO.auth),<commit_msg>add ip of publi cpandatesters server<commit_after>class Panda::Reporter;

has $.bone is rw;

method submit {
    if %*ENV<PANDA_SUBMIT_TESTREPORTS> {
        my $s;
        my $to-send = '';
        if %*ENV<http_proxy> {
            my ($host, $port) = %*ENV<http_proxy>.split('/').[2].split(':');
            $s                = IO::Socket::INET.new( :$host, :port($port.Int) );
            $to-send          = "POST http://192.168.127.12/report HTTP/1.1\nHost: localhost\nConnection: Close";
        }
        else {
            $s       = IO::Socket::INET.new(:host<192.168.127.12>, :port(80));
            $to-send = "POST /report HTTP/1.0";
        }

        my $buf = Buf.new(self.to-json.ords);
        $s.send("$to-send\nContent-Type: application/json\r\nContent-Length: $buf.elems()\r\n\r\n");
        $s.write($buf);

        CATCH {
            die "Could not submit test report: {$_.message}"
        }
    }
}

method to-json {
    to-json {
        :name($!bone.name),
        :version($!bone.version),
        :dependencies($!bone.dependencies),
        :metainfo($!bone.metainfo),
        :build-output($!bone.build-output),
        :build-passed($!bone.build-passed),
        :test-output($!bone.test-output),
        :test-passed($!bone.test-passed),
        :distro({
            :name($*DISTRO.name),
            :version($*DISTRO.version.Str),
            :auth($*DISTRO.auth),
{'fraction_non_alphanumeric': 0.1928622927180966, 'fraction_numerical': 0.01946647440519106, 'mean_word_length': 1.9272151898734178, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, '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': '7281096', 'n_tokens_mistral': 1018, 'n_tokens_neox': 965, 'n_words': 140}