<commit_before>package Mojo::File;
use Mojo::Base -strict;
use overload
  '@{}'    => sub { shift->to_array },
  bool     => sub {1},
  '""'     => sub { ${$_[0]} },
  fallback => 1;

use Carp 'croak';
use Cwd 'getcwd';
use Exporter 'import';
use File::Basename ();
use File::Copy qw(copy move);
use File::Find 'find';
use File::Path ();
use File::Spec::Functions
  qw(abs2rel canonpath catfile file_name_is_absolute rel2abs splitdir);
use File::stat ();
use File::Temp ();
use IO::File   ();
use Mojo::Collection;

our @EXPORT_OK = ('curfile', 'path', 'tempdir', 'tempfile');

sub basename { File::Basename::basename ${shift()}, @_ }

sub child { $_[0]->new(${shift()}, @_) }

sub chmod {
  my ($self, $mode) = @_;
  chmod $mode, $$self or croak qq{Can't chmod file "$$self": $!};
  return $self;
}

sub copy_to {
  my ($self, $to) = @_;
  copy($$self, $to) or croak qq{Can't copy file "$$self" to "$to": $!};
  return $self->new(-d $to ? ($to, File::Basename::basename $self) : $to);
}

sub curfile { __PACKAGE__->new((caller)[1])->realpath }

sub dirname { $_[0]->new(scalar File::Basename::dirname ${$_[0]}) }

sub is_abs { file_name_is_absolute ${shift()} }<commit_msg>Only create one Mojo::File object for curfile<commit_after>package Mojo::File;
use Mojo::Base -strict;
use overload
  '@{}'    => sub { shift->to_array },
  bool     => sub {1},
  '""'     => sub { ${$_[0]} },
  fallback => 1;

use Carp 'croak';
use Cwd 'getcwd';
use Exporter 'import';
use File::Basename ();
use File::Copy qw(copy move);
use File::Find 'find';
use File::Path ();
use File::Spec::Functions
  qw(abs2rel canonpath catfile file_name_is_absolute rel2abs splitdir);
use File::stat ();
use File::Temp ();
use IO::File   ();
use Mojo::Collection;

our @EXPORT_OK = ('curfile', 'path', 'tempdir', 'tempfile');

sub basename { File::Basename::basename ${shift()}, @_ }

sub child { $_[0]->new(${shift()}, @_) }

sub chmod {
  my ($self, $mode) = @_;
  chmod $mode, $$self or croak qq{Can't chmod file "$$self": $!};
  return $self;
}

sub copy_to {
  my ($self, $to) = @_;
  copy($$self, $to) or croak qq{Can't copy file "$$self" to "$to": $!};
  return $self->new(-d $to ? ($to, File::Basename::basename $self) : $to);
}

sub curfile { __PACKAGE__->new(Cwd::realpath((caller)[1])) }

sub dirname { $_[0]->new(scalar File::Basename::dirname ${$_[0]}) }

sub is_abs { file_name_is_absolute ${shift()} }
{'fraction_non_alphanumeric': 0.2188679245283019, 'fraction_numerical': 0.007547169811320755, 'mean_word_length': 4.708133971291866, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 22, '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': '2174862', 'n_tokens_mistral': 920, 'n_tokens_neox': 911, 'n_words': 236}