<commit_before># Configuration module for the dev-shell bootstrap
package My::ConfigFile;
use strict;
use warnings;

require Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(read_config);

sub read_config {
  # this sub will read in the provided configuration file and return a hash of the config values.
  # Parameter 1 : $config_file - full path to the configuration file.
  # RETURNS : hash containing each setting => value from the file.
  my ($config_file) = @_;
  # read everything into an array...
  my @config_lines = read_file($config_file);
  my %hash= ();

  foreach my $line (@config_lines) {
    my @tokens = split('=', $line);
    if (!$tokens[0] =~ /^\s*\#/) { # ignore any comments
      # remove leading and trailing spaces...
      $tokens[0] =~ s/^\s+|\s+$//g;
      $tokens[1] =~ s/^\s+|\s+$//g;
      $hash{$tokens[0]} = $tokens[1];
    }
  }
  return %hash;
}

sub read_file {
  my ($text_file) = @_;
  open my $handle, '<', $text_file or die "Cant open $text_file";
  chomp(my @lines = <$handle>);
  close $handle;
  return @lines;<commit_msg>ConfigFile.pm : Fix error introduced by last commit<commit_after># Configuration module for the dev-shell bootstrap
package My::ConfigFile;
use strict;
use warnings;

require Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(read_config);

sub read_config {
  # this sub will read in the provided configuration file and return a hash of the config values.
  # Parameter 1 : $config_file - full path to the configuration file.
  # RETURNS : hash containing each setting => value from the file.
  my ($config_file) = @_;
  # read everything into an array...
  my @config_lines = read_file($config_file);
  my %hash= ();

  foreach my $line (@config_lines) {
    my @tokens = split('=', $line);
    if (not $tokens[0] =~ /^\s*\#/) { # ignore any comments
      # remove leading and trailing spaces...
      $tokens[0] =~ s/^\s+|\s+$//g;
      $tokens[1] =~ s/^\s+|\s+$//g;
      $hash{$tokens[0]} = $tokens[1];
    }
  }
  return %hash;
}

sub read_file {
  my ($text_file) = @_;
  open my $handle, '<', $text_file or die "Cant open $text_file";
  chomp(my @lines = <$handle>);
  close $handle;
  return @lines;
{'fraction_non_alphanumeric': 0.15557595227168425, 'fraction_numerical': 0.005507113354749885, 'mean_word_length': 3.3951612903225805, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '657703', 'n_tokens_mistral': 745, 'n_tokens_neox': 730, 'n_words': 240}