<commit_before>class CompUnit::PrecompilationId {
    has $.id;

    method new(str $id --> CompUnit::PrecompilationId:D) {
        nqp::atpos(nqp::radix_I(16,$id,0,0,Int),2) == 40
          ?? nqp::p6bindattrinvres(nqp::create(self),
               CompUnit::PrecompilationId,'$!id',$id)
          !! die "Invalid precompilation id: '$id'"
    }

    method new-from-string(str $id --> CompUnit::PrecompilationId:D) {
        nqp::p6bindattrinvres(nqp::create(self),
          CompUnit::PrecompilationId,'$!id',nqp::sha1($id))
    }

    method new-without-check(str $id --> CompUnit::PrecompilationId:D) {
        nqp::p6bindattrinvres(nqp::create(self),
          CompUnit::PrecompilationId,'$!id',$id)
    }

    multi method WHICH(CompUnit::PrecompilationId:D: --> ValueObjAt:D) {
        nqp::box_s(
          nqp::concat('CompUnit::PrecompilationId|',$!id),
          ValueObjAt
        )
    }

    method Str()      { $!id }
    method IO()       { $!id.IO }
    method substr(|c) { $!id.substr(|c) }
}

# vim: expandtab shiftwidth=4<commit_msg>Simplify CompUnit::PrecompilationId<commit_after>class CompUnit::PrecompilationId {
    has Str $.id is built(False) handles <Str IO substr>;

    method new(str $id --> CompUnit::PrecompilationId:D) {
        nqp::atpos(nqp::radix_I(16,$id,0,0,Int),2) == 40
          ?? nqp::p6bindattrinvres(nqp::create(self),
               CompUnit::PrecompilationId,'$!id',$id)
          !! die "Invalid precompilation id: '$id'"
    }

    method new-from-string(str $id --> CompUnit::PrecompilationId:D) {
        nqp::p6bindattrinvres(nqp::create(self),
          CompUnit::PrecompilationId,'$!id',nqp::sha1($id))
    }

    method new-without-check(str $id --> CompUnit::PrecompilationId:D) {
        nqp::p6bindattrinvres(nqp::create(self),
          CompUnit::PrecompilationId,'$!id',$id)
    }

    multi method WHICH(CompUnit::PrecompilationId:D: --> ValueObjAt:D) {
        nqp::box_s(
          nqp::concat('CompUnit::PrecompilationId|',$!id),
          ValueObjAt
        )
    }
}

# vim: expandtab shiftwidth=4
{'fraction_non_alphanumeric': 0.17231364956437561, 'fraction_numerical': 0.011616650532429816, 'mean_word_length': 3.1175298804780875, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 12, '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': '3093119', 'n_tokens_mistral': 753, 'n_tokens_neox': 733, 'n_words': 94}