<commit_before># linux-lib.pl
# Active interface functions for all flavours of linux

# active_interfaces([include-no-address])
# Returns a list of currently ifconfig'd interfaces
sub active_interfaces
{
local ($empty) = @_;
local(@rv, @lines, $l);
&clean_language();
&open_execute_command(IFC, "ifconfig -a", 1, 1);
while(<IFC>) {
	s/\r|\n//g;
	if (/^\S+/) { push(@lines, $_); }
	else { $lines[$#lines] .= $_; }
	}
close(IFC);
&reset_environment();
my $ethtool = &has_command("ethtool");
foreach $l (@lines) {
	local %ifc;
	$l =~ /^([^:\s]+)/; $ifc{'name'} = $1;
	$l =~ /^(\S+)/; $ifc{'fullname'} = $1; $ifc{'fullname'} =~ s/:$//;
	if ($l =~ /^(\S+):(\d+)/) { $ifc{'virtual'} = $2; }
	if ($l =~ /^(\S+)\.(\d+)/) { $ifc{'vlanid'} = $2; }
	if ($l =~ /inet addr:(\S+)/) { $ifc{'address'} = $1; }
	elsif ($l =~ /inet (\S+)/) { $ifc{'address'} = $1; }
	elsif (!$empty) { next; }
	if ($l =~ /Mask:(\S+)/) { $ifc{'netmask'} = $1; }
	elsif ($l =~ /netmask (\S+)/) { $ifc{'netmask'} = $1; }
	if ($l =~ /Bcast:(\S+)/) { $ifc{'broadcast'} = $1; }
	elsif ($l =~ /broadcast (\S+)/) { $ifc{'broadcast'} = $1; }
	if ($l =~ /HWaddr (\S+)/) { $ifc{'ether'} = $1; }
	elsif ($l =~ /ether (\S+)/) { $ifc{'ether'} = $1; }
	if ($l =~ /MTU:(\d+)/) { $ifc{'mtu'} = $1; }
	elsif ($l =~ /mtu (\d+)/) { $ifc{'mtu'} = $1; }
	if ($l =~ /P-t-P:(\S+)/) { $ifc{'ptp'} = $1; }
	elsif ($l =~ /ptp (\S+)/) { $ifc{'ptp'} = $1; }
	$ifc{'up'}++ if ($l =~ /\sUP\s|<\S*UP\S*>/);
	$ifc{'promisc'}++ if ($l =~ /\sPROMISC\s/);
	local (@address6, @netmask6, @scope6);
	while($l =~ s/inet6 addr:\s*(\S+)\/(\d+)\s+Scope:(Global)//i) {
		local ($address6, $netmask6, $scope6) = ($1, $2, $3);
		push(@address6, $address6);
		push(@netmask6, $netmask6);
		push(@scope6, $scope6);
		}
	while($l =~ s/inet6 (\S+)\s+prefixlen (\d+)\s+scopeid\s+(\S+)<global>//i) {
		local ($address6, $netmask6, $scope6) = ($1, $2, $3);
		push(@address6, $address6);
		push(@netmask6, $netmask6);
		push(@scope6, $scope6);
		}
	$ifc{'address6'} = \@address6;
	$ifc{'netmask6'} = \@netmask6;
	$ifc{'scope6'} = \@scope6;
	$ifc{'edit'} = ($ifc{'name'} !~ /^ppp/);
	$ifc{'index'} = scalar(@rv);

	# Get current status for ethtool
	if ($ifc{'fullname'} =~ /^(eth|em|eno|ens|enp|enx)(\d+)$/ && $ethtool) {
		my $out = &backquote_command(
			"$ethtool $ifc{'fullname'} 2>/dev/null");
		if ($out =~ /Speed:\s+(\S+)/i) {
			$ifc{'speed'} = $1;
			}
		if ($out =~ /Duplex:\s+(\S+)/i) {
			$ifc{'duplex'} = $1;
			}
		if ($out =~ /Link\s+detected:\s+(\S+)/i) {
			$ifc{'link'} = lc($1) eq 'yes' ? 1 : 0;
			}
		}
	push(@rv, \%ifc);
	}
return @rv;
}
<commit_msg>Move ethtool data outside of main loop<commit_after># linux-lib.pl
# Active interface functions for all flavours of linux

# active_interfaces([include-no-address])
# Returns a list of currently ifconfig'd interfaces
sub active_interfaces
{
local ($empty) = @_;
local(@rv, @lines, $l);
&clean_language();
&open_execute_command(IFC, "ifconfig -a", 1, 1);
while(<IFC>) {
	s/\r|\n//g;
	if (/^\S+/) { push(@lines, $_); }
	else { $lines[$#lines] .= $_; }
	}
close(IFC);
&reset_environment();
my $ethtool = &has_command("ethtool");
foreach $l (@lines) {
	local %ifc;
	$l =~ /^([^:\s]+)/; $ifc{'name'} = $1;
	$l =~ /^(\S+)/; $ifc{'fullname'} = $1; $ifc{'fullname'} =~ s/:$//;
	if ($l =~ /^(\S+):(\d+)/) { $ifc{'virtual'} = $2; }
	if ($l =~ /^(\S+)\.(\d+)/) { $ifc{'vlanid'} = $2; }
	if ($l =~ /inet addr:(\S+)/) { $ifc{'address'} = $1; }
	elsif ($l =~ /inet (\S+)/) { $ifc{'address'} = $1; }
	elsif (!$empty) { next; }
	if ($l =~ /Mask:(\S+)/) { $ifc{'netmask'} = $1; }
	elsif ($l =~ /netmask (\S+)/) { $ifc{'netmask'} = $1; }
	if ($l =~ /Bcast:(\S+)/) { $ifc{'broadcast'} = $1; }
	elsif ($l =~ /broadcast (\S+)/) { $ifc{'broadcast'} = $1; }
	if ($l =~ /HWaddr (\S+)/) { $ifc{'ether'} = $1; }
	elsif ($l =~ /ether (\S+)/) { $ifc{'ether'} = $1; }
	if ($l =~ /MTU:(\d+)/) { $ifc{'mtu'} = $1; }
	elsif ($l =~ /mtu (\d+)/) { $ifc{'mtu'} = $1; }
	if ($l =~ /P-t-P:(\S+)/) { $ifc{'ptp'} = $1; }
	elsif ($l =~ /ptp (\S+)/) { $ifc{'ptp'} = $1; }
	$ifc{'up'}++ if ($l =~ /\sUP\s|<\S*UP\S*>/);
	$ifc{'promisc'}++ if ($l =~ /\sPROMISC\s/);
	local (@address6, @netmask6, @scope6);
	while($l =~ s/inet6 addr:\s*(\S+)\/(\d+)\s+Scope:(Global)//i) {
		local ($address6, $netmask6, $scope6) = ($1, $2, $3);
		push(@address6, $address6);
		push(@netmask6, $netmask6);
		push(@scope6, $scope6);
		}
	while($l =~ s/inet6 (\S+)\s+prefixlen (\d+)\s+scopeid\s+(\S+)<global>//i) {
		local ($address6, $netmask6, $scope6) = ($1, $2, $3);
		push(@address6, $address6);
		push(@netmask6, $netmask6);
		push(@scope6, $scope6);
		}
	$ifc{'address6'} = \@address6;
	$ifc{'netmask6'} = \@netmask6;
	$ifc{'scope6'} = \@scope6;
	$ifc{'edit'} = ($ifc{'name'} !~ /^ppp/);
	$ifc{'index'} = scalar(@rv);
	push(@rv, \%ifc);
	}

foreach my $ifc (@rv) {
	# Get current status for ethtool
	if (&iface_type($ifc->{'fullname'}) eq 'Ethernet' &&
	    $ifc->{'virtual'} eq '' && $ethtool) {
		my $out = &backquote_command(
			"$ethtool $ifc->{'fullname'} 2>/dev/null");
		if ($out =~ /Speed:\s+(\S+)/i) {
			$ifc->{'speed'} = $1;
			}
		if ($out =~ /Duplex:\s+(\S+)/i) {
			$ifc->{'duplex'} = $1;
			}
		if ($out =~ /Link\s+detected:\s+(\S+)/i) {
			$ifc->{'link'} = lc($1) eq 'yes' ? 1 : 0;
			}
		}
	}
return @rv;
}

{'fraction_non_alphanumeric': 0.32717225609756095, 'fraction_numerical': 0.022484756097560975, 'mean_word_length': 3.556423611111111, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 17, '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': '3464434', 'n_tokens_mistral': 2639, 'n_tokens_neox': 2541, 'n_words': 479}