<commit_before>package javax.util;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.net.URL;
import java.util.concurrent.Callable;

import javax.lang.Try;
import javax.net.Urls;

@SuppressWarnings("serial")
public class Properties extends java.util.Properties {

	public Properties() {}
	
	public Properties(String key, String value) {
		this.put(key, value);
	}
	
	public Properties(java.util.Properties properties) {
		this.set(properties);
	}
	
	@SuppressWarnings("unchecked")
	public Properties(Map.Entry<Object, Object>... values) {
		this.set(values);
	}
	
	public Properties(Property... properties) {
		this.set(properties);
	}
	
	public Properties(Map<Object, Object> values) {
		this.set(values);
	}

	public Properties(File file) {
		this(file, Map.map());
	}
	
	public Properties(File file, Properties defaultValues) {
		this(() -> new FileInputStream(file), defaultValues);
	}
	
	public Properties(File file, Map<Object, Object> defaultValues) {
		this(() -> new FileInputStream(file), defaultValues);
	}
	
	@SuppressWarnings("unchecked")
	public Properties(File file, Map.Entry<Object, Object>... defaultValues) {
		this(file, Map.map(defaultValues));
	}
	
	public Properties(File file, Property... defaultValues) {
		this(file, properties(defaultValues));
	}

	public Properties(String url) {
		this(Urls.url(url));
	}
	
	public Properties(URL url) {
		this(url, Map.map());
	}
	
	public Properties(URL url, Map<Object, Object> defaultValues) {
		this(url, properties(defaultValues));
	}
	
	public Properties(URL url, Properties defaultValues) {
		this(() -> url.openStream(), defaultValues);
	}
	
	@SuppressWarnings("unchecked")
	public Properties(URL url, Map.Entry<Object, Object>... defaultValues) {
		this(url, Map.map(defaultValues));
	}
	
	public Properties(URL url, Property... defaultValues) {
		this(url, properties(defaultValues));
	}
	
	public Properties(InputStream stream) {
		this(stream, Map.map());
	}
	
	public Properties(InputStream stream, Properties defaultValues) {
		this.load(stream, defaultValues);
	}
	
	public Properties(InputStream stream, Map<Object, Object> defaultValues) {
		this.load(stream, defaultValues);
	}	
	
	@SuppressWarnings("unchecked")
	public Properties(InputStream stream, Map.Entry<Object, Object>... defaultValues) {
		this.load(stream, properties(defaultValues));
	}

	public Properties(InputStream stream, Property... defaultValues) {
		this.load(stream, properties(defaultValues));
	}
	
	public Properties(Callable<InputStream> stream, Map<Object, Object> defaultValues) {
		this(stream, properties(defaultValues));
	}

	public Properties(Callable<InputStream> stream, Properties defaultValues) {
		Try.attempt(() -> this.load(stream.call()), () -> this.set(defaultValues));
	}

	
	@SuppressWarnings("unchecked")
	public Properties(Callable<InputStream> stream, Map.Entry<Object, Object>... defaultValues) {
		this(stream, Map.map(defaultValues));
	}

	public Properties(Callable<InputStream> stream, Property... defaultValues) {
		this(stream, properties(defaultValues));
	}

	public Properties empty() {
		this.clear();
		return this;
	}
	
	public Properties set(Map<Object, Object> values) {
		for (Object key : values.keySet())
			this.put(key, values.get(key));
		
		return this;
	}
	
	@SuppressWarnings("unchecked")
	public Properties set(Map.Entry<Object, Object>... values) {
		return this.set(Map.map(values));
	}
	
	public Properties set(Property... properties) {
		for (Property property : properties)
			this.put(property.key, property.value);
		
		return this;
	}
		
	public Properties set(java.util.Properties properties) {
		for (Object key : properties.keySet())
			this.put(key, properties.get(key));
		
		return this;
	}
	
	public Properties load(InputStream stream, Properties defaultValues) {
		Try.attempt(() -> this.load(stream), () -> this.set(defaultValues));
		return this;
	}
	
	public Properties load(InputStream stream, Map<Object, Object> defaultValues) {
		return load(stream, properties(defaultValues));
	}
	
	@SuppressWarnings("unchecked")
	public Properties load(InputStream stream, Map.Entry<Object, Object>... defaultValues) {
		return load(stream, properties(defaultValues));
	}
	
	public Properties load(InputStream stream, Property... defaultValues) {
		return load(stream, properties(defaultValues));
	}
	
	public Properties load(File file, Properties defaultValues) {
		return this.load(() -> new FileInputStream(file), defaultValues);
	}
	
	public Properties load(Callable<InputStream> stream, Properties defaultValues) {
		Try.attempt(() -> this.load(stream.call()), () -> this.set(defaultValues));
		return this;
	}
	
	public static Properties properties() {
		return new Properties();
	}
	
	public static Properties properties(java.util.Properties properties) {
		return new Properties(properties);<commit_msg>updating javax.util.Properties to support javax.io.File<commit_after>package javax.util;

import java.io.FileInputStream;
import java.io.InputStream;
import java.net.URL;
import java.util.concurrent.Callable;

import javax.lang.Try;
import javax.net.Urls;
import javax.io.File;

@SuppressWarnings("serial")
public class Properties extends java.util.Properties {

	public Properties() {}
	
	public Properties(String key, String value) {
		this.put(key, value);
	}
	
	public Properties(java.util.Properties properties) {
		this.set(properties);
	}
	
	@SuppressWarnings("unchecked")
	public Properties(Map.Entry<Object, Object>... values) {
		this.set(values);
	}
	
	public Properties(Property... properties) {
		this.set(properties);
	}
	
	public Properties(Map<Object, Object> values) {
		this.set(values);
	}

	public Properties(File file) {
		this(file, Map.map());
	}
	
	public Properties(File file, Properties defaultValues) {
		this(file.toFile(), defaultValues);
	}
	
	public Properties(File file, Map<Object, Object> defaultValues) {
		this(file.toFile(), defaultValues);
	}
	
	public Properties(java.io.File file, Properties defaultValues) {
		this(() -> new FileInputStream(file), defaultValues);
	}
	
	public Properties(java.io.File file, Map<Object, Object> defaultValues) {
		this(() -> new FileInputStream(file), defaultValues);
	}
	
	@SuppressWarnings("unchecked")
	public Properties(File file, Map.Entry<Object, Object>... defaultValues) {
		this(file, Map.map(defaultValues));
	}
	
	public Properties(File file, Property... defaultValues) {
		this(file, properties(defaultValues));
	}

	public Properties(String url) {
		this(Urls.url(url));
	}
	
	public Properties(URL url) {
		this(url, Map.map());
	}
	
	public Properties(URL url, Map<Object, Object> defaultValues) {
		this(url, properties(defaultValues));
	}
	
	public Properties(URL url, Properties defaultValues) {
		this(() -> url.openStream(), defaultValues);
	}
	
	@SuppressWarnings("unchecked")
	public Properties(URL url, Map.Entry<Object, Object>... defaultValues) {
		this(url, Map.map(defaultValues));
	}
	
	public Properties(URL url, Property... defaultValues) {
		this(url, properties(defaultValues));
	}
	
	public Properties(InputStream stream) {
		this(stream, Map.map());
	}
	
	public Properties(InputStream stream, Properties defaultValues) {
		this.load(stream, defaultValues);
	}
	
	public Properties(InputStream stream, Map<Object, Object> defaultValues) {
		this.load(stream, defaultValues);
	}	
	
	@SuppressWarnings("unchecked")
	public Properties(InputStream stream, Map.Entry<Object, Object>... defaultValues) {
		this.load(stream, properties(defaultValues));
	}

	public Properties(InputStream stream, Property... defaultValues) {
		this.load(stream, properties(defaultValues));
	}
	
	public Properties(Callable<InputStream> stream, Map<Object, Object> defaultValues) {
		this(stream, properties(defaultValues));
	}

	public Properties(Callable<InputStream> stream, Properties defaultValues) {
		Try.attempt(() -> this.load(stream.call()), () -> this.set(defaultValues));
	}

	
	@SuppressWarnings("unchecked")
	public Properties(Callable<InputStream> stream, Map.Entry<Object, Object>... defaultValues) {
		this(stream, Map.map(defaultValues));
	}

	public Properties(Callable<InputStream> stream, Property... defaultValues) {
		this(stream, properties(defaultValues));
	}

	public Properties empty() {
		this.clear();
		return this;
	}
	
	public Properties set(Map<Object, Object> values) {
		for (Object key : values.keySet())
			this.put(key, values.get(key));
		
		return this;
	}
	
	@SuppressWarnings("unchecked")
	public Properties set(Map.Entry<Object, Object>... values) {
		return this.set(Map.map(values));
	}
	
	public Properties set(Property... properties) {
		for (Property property : properties)
			this.put(property.key, property.value);
		
		return this;
	}
		
	public Properties set(java.util.Properties properties) {
		for (Object key : properties.keySet())
			this.put(key, properties.get(key));
		
		return this;
	}
	
	public Properties load(InputStream stream, Properties defaultValues) {
		Try.attempt(() -> this.load(stream), () -> this.set(defaultValues));
		return this;
	}
	
	public Properties load(InputStream stream, Map<Object, Object> defaultValues) {
		return load(stream, properties(defaultValues));
	}
	
	@SuppressWarnings("unchecked")
	public Properties load(InputStream stream, Map.Entry<Object, Object>... defaultValues) {
		return load(stream, properties(defaultValues));
	}
	
	public Properties load(InputStream stream, Property... defaultValues) {
		return load(stream, properties(defaultValues));
	}
	
	public Properties load(File file, Properties defaultValues) {
		return load(file.toFile(), defaultValues);
	}
	
	public Properties load(java.io.File file, Properties defaultValues) {
		return load(() -> new FileInputStream(file), defaultValues);
	}
	
	public Properties load(Callable<InputStream> stream, Properties defaultValues) {
		Try.attempt(() -> load(stream.call()), () -> this.set(defaultValues));
		return this;
	}
	
	public static Properties properties() {
		return new Properties();
	}
	
	public static Properties properties(java.util.Properties properties) {
		return new Properties(properties);
{'fraction_non_alphanumeric': 0.13564856040368062, 'fraction_numerical': 0.0, 'mean_word_length': 5.002375296912114, 'pattern_counts': {'":': 0, '<': 42, '<?xml version=': 0, '>': 62, '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': '238590', 'n_tokens_mistral': 3142, 'n_tokens_neox': 2898, 'n_words': 683}