<commit_before>package me.footlights.core;

import java.io.*;
import java.net.URI;
import java.util.*;
import java.util.Map.Entry;
import java.util.logging.Logger;

import com.google.common.collect.Maps;

import me.footlights.core.crypto.Keychain;
import me.footlights.core.plugin.PluginLoadException;
import me.footlights.core.plugin.PluginLoader;
import me.footlights.core.plugin.PluginWrapper;


public class Core implements Footlights
{
	public Core()
	{
		String configDirName = "~/.footlights/";

		File configDir = new File(configDirName);
		configDir.mkdir();

		keychain = new Keychain();
		final String keychainFileName = configDirName + "/keychain";

		try { keychain.importKeystoreFile(new FileInputStream(new File(keychainFileName))); }
		catch (Exception e)
		{
			Logger.getLogger(Core.class.getName())
				.warning("Unable to open keychain: " + e.getLocalizedMessage());
		}

		plugins          = Maps.newHashMap();
		uis              = new LinkedList<UI>();
	}


	public void registerUI(UI ui) { uis.add(ui); }
	public void deregisterUI(UI ui) { uis.remove(ui); }

	public Collection<PluginWrapper> plugins() { return plugins.values(); }


	/** Load a plugin and wrap it up in a convenient wrapper */
	public PluginWrapper loadPlugin(String name, URI uri) throws PluginLoadException
	{
		if(plugins.containsKey(uri)) return plugins.get(uri);
<commit_msg>Clean up imports, etc., prepare to use File.<commit_after>package me.footlights.core;

import java.io.FileInputStream;
import java.net.URI;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.logging.Logger;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;

import me.footlights.core.crypto.Keychain;
import me.footlights.core.plugin.PluginLoadException;
import me.footlights.core.plugin.PluginLoader;
import me.footlights.core.plugin.PluginWrapper;


public class Core implements Footlights
{
	public Core()
	{
		String configDirName = "~/.footlights/";

		java.io.File configDir = new java.io.File(configDirName);
		configDir.mkdir();

		keychain = new Keychain();
		final String keychainFileName = configDirName + "/keychain";

		try
		{
			keychain.importKeystoreFile(
				new FileInputStream(
					new java.io.File(keychainFileName)));
		}
		catch (Exception e)
		{
			Logger.getLogger(Core.class.getName())
				.warning("Unable to open keychain: " + e.getLocalizedMessage());
		}

		plugins          = Maps.newHashMap();
		uis              = Lists.newArrayList();
	}


	public void registerUI(UI ui) { uis.add(ui); }
	public void deregisterUI(UI ui) { uis.remove(ui); }

	public Collection<PluginWrapper> plugins() { return plugins.values(); }


	/** Load a plugin and wrap it up in a convenient wrapper */
	public PluginWrapper loadPlugin(String name, URI uri) throws PluginLoadException
	{
		if(plugins.containsKey(uri)) return plugins.get(uri);

{'fraction_non_alphanumeric': 0.12110845022237428, 'fraction_numerical': 0.0, 'mean_word_length': 4.258992805755396, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, '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': '5624413', 'n_tokens_mistral': 965, 'n_tokens_neox': 886, 'n_words': 214}