<commit_before>#include <iostream>
#include <stdexcept>
#include <algorithm> /* For transform() */
#include <SocketInterface.h>

#define VERBOSE(x) std::cout << x << std::endl

using NetInterface  = Impact::NetInterface;
using InterfaceType = Impact::InterfaceType;

void printInterfaces(std::vector<NetInterface> list) {
	for(const auto& iface : list) {
		VERBOSE("Name:      " << iface.name);
		VERBOSE("Address:   " << iface.address);
		VERBOSE("Netmask:   " << iface.netmask);
		VERBOSE("Broadcast: " << iface.broadcast);
		VERBOSE("Flags:     " << iface.flags);
		VERBOSE("IPv4:      " << (iface.ipv4?"true":"false"));

		switch (iface.type) {
		case Impact::InterfaceType::OTHER:
			VERBOSE("Type:      Other"); break;
		case Impact::InterfaceType::ETHERNET:
			VERBOSE("Type:      Ethernet"); break;
		case Impact::InterfaceType::WIFI:
			VERBOSE("Type:      WiFi"); break;
		case Impact::InterfaceType::FIREWIRE:
			VERBOSE("Type:      Firewire");  break;
		case Impact::InterfaceType::PPP:
			VERBOSE("Type:      Point-to-Point Protocol");  break;
		case Impact::InterfaceType::ATM:
			VERBOSE("Type:      Asynchronous Transfer Mode"); break;
		default:
			VERBOSE("Type:      [unknown]"); break;
		}

		std::cout << std::endl;
	}
}

std::vector<NetInterface> filter(std::vector<NetInterface> list) {
	std::vector<NetInterface> table;

	// collect interfaces with the following characteristics
	for (const auto& interface : list) {
		if(!interface.ipv4) continue;
		if(!(interface.type == InterfaceType::WIFI ||
			interface.type == InterfaceType::ETHERNET)) continue;
		if(interface.address.size() == 0) continue;
		std::string name = interface.name;
		std::transform(name.begin(), name.end(), name.begin(), ::tolower);
		if(name.compare(0, 2, "en") == 0 ||
			name.compare(0, 3, "eth") == 0 ||
			name.compare(0, 4, "wlan") == 0 ||
			name.compare(0, 5, "wi-fi") == 0)
			table.push_back(interface);
	}

	return table;
}
<commit_msg>Dev Checkpoint 062520181251<commit_after>#include <iostream>
#include <stdexcept>
#include <algorithm> /* For transform() */
#include <SocketInterface.h>

#define VERBOSE(x) std::cout << x << std::endl

using NetInterface  = Impact::NetInterface;
using InterfaceType = Impact::InterfaceType;

void printInterfaces(std::vector<NetInterface> list) {
	for(const auto& iface : list) {
		VERBOSE("Name:      " << iface.name);
		VERBOSE("Address:   " << iface.address);
		VERBOSE("Netmask:   " << iface.netmask);
		VERBOSE("Broadcast: " << iface.broadcast);
		VERBOSE("Flags:     " << iface.flags);
		VERBOSE("IPv4:      " << (iface.ipv4?"true":"false"));

		switch (iface.type) {
		case Impact::InterfaceType::OTHER:
			VERBOSE("Type:      Other"); break;
		case Impact::InterfaceType::ETHERNET:
			VERBOSE("Type:      Ethernet"); break;
		case Impact::InterfaceType::WIFI:
			VERBOSE("Type:      WiFi"); break;
		case Impact::InterfaceType::FIREWIRE:
			VERBOSE("Type:      Firewire");  break;
		case Impact::InterfaceType::PPP:
			VERBOSE("Type:      Point-to-Point Protocol");  break;
		case Impact::InterfaceType::ATM:
			VERBOSE("Type:      Asynchronous Transfer Mode"); break;
		default:
			VERBOSE("Type:      [unknown]"); break;
		}

		std::cout << std::endl;
	}
}

std::vector<NetInterface> filter(std::vector<NetInterface> list) {
	std::vector<NetInterface> table;

	// collect interfaces with the following characteristics
	for (const auto& iface : list) {
		if(!iface.ipv4) continue;
		if(!(iface.type == InterfaceType::WIFI ||
			iface.type == InterfaceType::ETHERNET)) continue;
		if(iface.address.size() == 0) continue;
		std::string name = iface.name;
		std::transform(name.begin(), name.end(), name.begin(), ::tolower);
		if(name.compare(0, 2, "en") == 0 ||
			name.compare(0, 3, "eth") == 0 ||
			name.compare(0, 4, "wlan") == 0 ||
			name.compare(0, 5, "wi-fi") == 0)
			table.push_back(iface);
	}

	return table;
}

{'fraction_non_alphanumeric': 0.17759421786267424, 'fraction_numerical': 0.011357769747031492, 'mean_word_length': 4.404463040446304, 'pattern_counts': {'":': 2, '<': 55, '<?xml version=': 0, '>': 19, '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': '5072425', 'n_tokens_mistral': 1462, 'n_tokens_neox': 1344, 'n_words': 268}