<commit_before>package Elasticsearch::Compat;

use Moo;
use Elasticsearch 0.73;

use Scalar::Util qw(openhandle);
use Elasticsearch::Util qw(parse_params);
use namespace::clean;

our $VERSION = '0.01';

#===================================
sub new {
#===================================
    my ( $class, $orig ) = parse_params(@_);
    my %params = (
        nodes           => delete $orig->{servers},
        request_timeout => delete $orig->{timeout},
        cxn_pool        => delete $orig->{no_refresh} ? 'Static' : 'Sniff',
        client          => 'Compat',
        deflate            => delete $orig->{deflate}            || 0,
        max_content_length => delete $orig->{max_content_length} || 0
    );

    # transport
    my $transport = delete $orig->{transport} || 'http';
    if ( $transport =~ /^(aehttp|aecurl|thrift)/ ) {
        die "Transport <$transport> is not supported";
    }
    if ( $transport eq 'httplite' ) {
        warn "Transport <httplite> is not supported. Using <httptiny>";
    }
    $params{cxn}
        = $transport eq 'httptiny' ? 'HTTPTiny'
        : $transport eq 'curl'     ? 'NetCurl'
        :                            'LWP';

    # trace_calls
    if ( my $trace = delete $orig->{trace_calls} ) {
        $params{trace_to}
            = $trace eq '1' ? 'Stderr'
            : !ref $trace        ? [ 'File',       $trace ]
            : openhandle($trace) ? [ 'FileHandle', $trace ]
            : ref($trace) eq 'CODE' ? [ 'Callback', { logging_cb => $trace } ]
            :   die "Unrecognised value for <trace_requests>";
    }

    return Elasticsearch->new( %params, %$orig );<commit_msg>Only set request_timeout if timeout specified<commit_after>package Elasticsearch::Compat;

use Moo;
use Elasticsearch 0.74;

use Scalar::Util qw(openhandle);
use Elasticsearch::Util qw(parse_params);
use namespace::clean;

our $VERSION = '0.01';

#===================================
sub new {
#===================================
    my ( $class, $orig ) = parse_params(@_);
    my %params = (
        nodes           => delete $orig->{servers},
        cxn_pool        => delete $orig->{no_refresh} ? 'Static' : 'Sniff',
        client          => 'Compat',
        deflate            => delete $orig->{deflate}            || 0,
        max_content_length => delete $orig->{max_content_length} || 0
    );

    $params{request_timeout} = delete $orig->{timeout}
        if $orig->{timeout};

    # transport
    my $transport = delete $orig->{transport} || 'http';
    if ( $transport =~ /^(aehttp|aecurl|thrift)/ ) {
        die "Transport <$transport> is not supported";
    }
    if ( $transport eq 'httplite' ) {
        warn "Transport <httplite> is not supported. Using <httptiny>";
    }
    $params{cxn}
        = $transport eq 'httptiny' ? 'HTTPTiny'
        : $transport eq 'curl'     ? 'NetCurl'
        :                            'LWP';

    # trace_calls
    if ( my $trace = delete $orig->{trace_calls} ) {
        $params{trace_to}
            = $trace eq '1' ? 'Stderr'
            : !ref $trace        ? [ 'File',       $trace ]
            : openhandle($trace) ? [ 'FileHandle', $trace ]
            : ref($trace) eq 'CODE' ? [ 'Callback', { logging_cb => $trace } ]
            :   die "Unrecognised value for <trace_requests>";
    }

    return Elasticsearch->new( %params, %$orig );
{'fraction_non_alphanumeric': 0.1894956729334527, 'fraction_numerical': 0.005371530886302597, 'mean_word_length': 2.279843444227006, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4303473', 'n_tokens_mistral': 1036, 'n_tokens_neox': 1030, 'n_words': 241}