<commit_before>package fr.openwide.core.imports.excel.poi.scanner;

import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import java.io.InputStream;
import java.util.Map;

import org.apache.commons.io.filefilter.FileFilterUtils;
import org.apache.commons.lang.Validate;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.apache.poi.ss.util.CellReference;

import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableMap;

import de.schlichtherle.truezip.file.TFileInputStream;
import fr.openwide.core.commons.util.functional.SerializablePredicate;
import fr.openwide.core.imports.excel.event.exception.ExcelImportException;
import fr.openwide.core.imports.excel.event.exception.ExcelImportFileException;
import fr.openwide.core.imports.excel.poi.location.ApachePoiExcelImportNavigator;
import fr.openwide.core.imports.excel.scanner.IExcelImportFileScanner;

public class ApachePoiExcelImportFileScanner implements IExcelImportFileScanner<Workbook, Sheet, Row, Cell, CellReference> {
	
	private static final String HIDDEN_FILE_PREFIX = ".";

	// Default is to scan all files except hidden files and files in hidden directories.
	public static final FileFilter DEFAULT_DIRECTORY_CHILD_FILTER = FileFilterUtils.notFileFilter(FileFilterUtils.prefixFileFilter(HIDDEN_FILE_PREFIX));
	
	protected FileFilter getDirectoryChildFilter() {
		return DEFAULT_DIRECTORY_CHILD_FILTER;
	}
	<commit_msg>Correction de ApachePoiExcelImportFileScanner pour ignorer les fichiers Thumbs.db.<commit_after>package fr.openwide.core.imports.excel.poi.scanner;

import static org.apache.commons.io.filefilter.FileFilterUtils.and;
import static org.apache.commons.io.filefilter.FileFilterUtils.fileFileFilter;
import static org.apache.commons.io.filefilter.FileFilterUtils.nameFileFilter;
import static org.apache.commons.io.filefilter.FileFilterUtils.notFileFilter;
import static org.apache.commons.io.filefilter.FileFilterUtils.or;
import static org.apache.commons.io.filefilter.FileFilterUtils.prefixFileFilter;

import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import java.io.InputStream;
import java.util.Map;

import org.apache.commons.lang.Validate;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.apache.poi.ss.util.CellReference;

import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableMap;

import de.schlichtherle.truezip.file.TFileInputStream;
import fr.openwide.core.commons.util.functional.SerializablePredicate;
import fr.openwide.core.imports.excel.event.exception.ExcelImportException;
import fr.openwide.core.imports.excel.event.exception.ExcelImportFileException;
import fr.openwide.core.imports.excel.poi.location.ApachePoiExcelImportNavigator;
import fr.openwide.core.imports.excel.scanner.IExcelImportFileScanner;

public class ApachePoiExcelImportFileScanner implements IExcelImportFileScanner<Workbook, Sheet, Row, Cell, CellReference> {
	
	private static final String HIDDEN_FILE_PREFIX = ".";
	private static final String THUMBS_DB_NAME = "Thumbs.db";

	// Default is to scan all files except: hidden files, files in hidden directories and files named "Thumbs.db".
	public static final FileFilter DEFAULT_DIRECTORY_CHILD_FILTER = notFileFilter(or(
			prefixFileFilter(HIDDEN_FILE_PREFIX),
			and(
				fileFileFilter(),
				nameFileFilter(THUMBS_DB_NAME)
			)
	));
	
	protected FileFilter getDirectoryChildFilter() {
		return DEFAULT_DIRECTORY_CHILD_FILTER;
	}
	
{'fraction_non_alphanumeric': 0.09502598366740905, 'fraction_numerical': 0.0004949269982677555, 'mean_word_length': 6.3893967093235835, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '5942352', 'n_tokens_mistral': 1332, 'n_tokens_neox': 1277, 'n_words': 210}