<commit_before>package Pakket::Types;
# ABSTRACT: Type definitions for Pakket

use strict;
use warnings;

use Moose::Util::TypeConstraints;
use Carp     qw< croak >;
use Log::Any qw< $log >;
use Ref::Util qw< is_ref is_arrayref is_hashref >;
use Safe::Isa;
use Module::Runtime qw< require_module >;
use Pakket::Constants qw<
    PAKKET_DEFAULT_RELEASE
    PAKKET_VALID_PHASES
>;

# PakketRepositoryBackend

sub _coerce_backend_from_str {
    my $uri = shift;
    $uri = lc($uri);

    my ($scheme) = $uri =~ m{^ ( [a-zA-Z0-9_]+ ) :// }xms;
    my $class    = "Pakket::Repository::Backend::$scheme";

    eval { require_module($class); 1; } or do {
        croak( $log->critical("Failed to load backend '$class': $@") );
    };
<commit_msg>Use http backend for https urls<commit_after>package Pakket::Types;
# ABSTRACT: Type definitions for Pakket

use strict;
use warnings;

use Moose::Util::TypeConstraints;
use Carp     qw< croak >;
use Log::Any qw< $log >;
use Ref::Util qw< is_ref is_arrayref is_hashref >;
use Safe::Isa;
use Module::Runtime qw< require_module >;
use Pakket::Constants qw<
    PAKKET_DEFAULT_RELEASE
    PAKKET_VALID_PHASES
>;

# PakketRepositoryBackend

sub _coerce_backend_from_str {
    my $uri = shift;
    $uri = lc($uri);

    my ($scheme) = $uri =~ m{^ ( [a-zA-Z0-9_]+ ) :// }xms;
    $scheme = "http" if ($scheme eq "https");
    my $class    = "Pakket::Repository::Backend::$scheme";

    eval { require_module($class); 1; } or do {
        croak( $log->critical("Failed to load backend '$class': $@") );
    };

{'fraction_non_alphanumeric': 0.15304798962386512, 'fraction_numerical': 0.0038910505836575876, 'mean_word_length': 3.9614147909967845, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, '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': '1734226', 'n_tokens_mistral': 582, 'n_tokens_neox': 561, 'n_words': 143}