<commit_before>package ws.gazebo.util.ontTool.shp;

import java.io.File;
import java.io.IOException;
import java.io.Serializable;
import java.net.MalformedURLException;
import java.util.Collections;
import java.util.Map;

import org.geotools.data.DataStore;
import org.geotools.data.FeatureSource;
import org.geotools.data.FileDataStoreFactorySpi;
import org.geotools.data.FileDataStoreFinder;
import org.geotools.feature.FeatureCollection;
import org.geotools.feature.FeatureIterator;
import org.opengis.feature.Feature;

public class OntToolShp {

	public static FileDataStoreFactorySpi SHP_FACTORY = FileDataStoreFinder
			.getDataStoreFactory("shp");

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

	public static DataStore openShpDataStore(File f) {
		Map<String, Serializable> m = null;
		try {
			m = Collections.singletonMap("url", (Serializable) f.toURI()
					.toURL());
		} catch (MalformedURLException e) {
			// TODO Auto-generated catch block (should not be reached)
			e.printStackTrace();
		}
		DataStore ds = null;
		try {
			ds = SHP_FACTORY.createDataStore(m);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			if (ds != null) {
				ds.dispose();
			}
		}
		return ds;
	}

	public static FeatureIterator<Feature> getFeatures(String typeName,
			DataStore ds) throws IOException {
		FeatureSource<?, ?> fs = ds.getFeatureSource(typeName);
		FeatureCollection col = fs.getFeatures();
		FeatureIterator<Feature> it = col.features();
		return it;
	}
}
<commit_msg>add method openShpDataStore(String)<commit_after>package ws.gazebo.util.ontTool.shp;

import java.io.File;
import java.io.IOException;
import java.io.Serializable;
import java.net.MalformedURLException;
import java.util.Collections;
import java.util.Map;

import org.geotools.data.DataStore;
import org.geotools.data.FeatureSource;
import org.geotools.data.FileDataStoreFactorySpi;
import org.geotools.data.FileDataStoreFinder;
import org.geotools.feature.FeatureCollection;
import org.geotools.feature.FeatureIterator;
import org.opengis.feature.Feature;

public class OntToolShp {

	public static FileDataStoreFactorySpi SHP_FACTORY = FileDataStoreFinder
			.getDataStoreFactory("shp");

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

	public static DataStore openShpDataStore(String pathname) {
		File f = new File(pathname);
		return openShpDataStore(f);
	}
	
	public static DataStore openShpDataStore(File f) {
		Map<String, Serializable> m = null;
		try {
			m = Collections.singletonMap("url", (Serializable) f.toURI()
					.toURL());
		} catch (MalformedURLException e) {
			// TODO Auto-generated catch block (should not be reached)
			e.printStackTrace();
		}
		DataStore ds = null;
		try {
			ds = SHP_FACTORY.createDataStore(m);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			if (ds != null) {
				ds.dispose();
			}
		}
		return ds;
	}

	public static FeatureIterator<Feature> getFeatures(String typeName,
			DataStore ds) throws IOException {
		FeatureSource<?, ?> fs = ds.getFeatureSource(typeName);
		FeatureCollection col = fs.getFeatures();
		FeatureIterator<Feature> it = col.features();
		return it;
	}
}

{'fraction_non_alphanumeric': 0.10988674625038261, 'fraction_numerical': 0.0, 'mean_word_length': 4.529610829103215, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '830811', 'n_tokens_mistral': 1140, 'n_tokens_neox': 1046, 'n_words': 239}