<commit_before>package be.fluid_it.µs.bundle.guice;

import com.google.inject.Module;

import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.ServiceLoader;

public class Modules {
  private static final String DISABLED = "disabled";

  public static List<Module> find(Class<? extends Module> moduleClass) {
    List<Module> modules = new LinkedList<Module>();
    Iterator<? extends Module> moduleIterator = ServiceLoader.load(moduleClass).iterator();
    while (moduleIterator.hasNext()) {
      Module module = moduleIterator.next();
      if (!isDisabled(module.getClass())) {
        modules.add(module);
      }
    }
    return modules;
  }

  public static boolean isDisabled(Class<? extends Module> moduleClass) {
    String moduleKey = moduleClass.getName();
    if (System.getProperties().containsKey(moduleKey)) {
      String moduleValue = System.getProperty(moduleKey);
      if (moduleValue != null) {
        return DISABLED.equals(moduleValue);
      }
    }
    return false;
  }

  public static void disable(Class<? extends Module> moduleClass) {
    if (moduleClass != null) {
      System.setProperty(moduleClass.getName(), DISABLED);
    }
  }

  public static void resetDisabled() {<commit_msg>Added logging for disabled modules<commit_after>package be.fluid_it.µs.bundle.guice;

import com.google.inject.Module;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.ServiceLoader;

public class Modules {
  private static final Logger logger = LoggerFactory.getLogger(Modules.class);

  private static final String DISABLED = "disabled";

  public static List<Module> find(Class<? extends Module> moduleClass) {
    List<Module> modules = new LinkedList<Module>();
    Iterator<? extends Module> moduleIterator = ServiceLoader.load(moduleClass).iterator();
    while (moduleIterator.hasNext()) {
      Module module = moduleIterator.next();
      if (!isDisabled(module.getClass())) {
        modules.add(module);
      } else {
        logger.info(module.getClass().getSimpleName() +  " is disabled.");
      }
    }
    return modules;
  }

  public static boolean isDisabled(Class<? extends Module> moduleClass) {
    String moduleKey = moduleClass.getName();
    if (System.getProperties().containsKey(moduleKey)) {
      String moduleValue = System.getProperty(moduleKey);
      if (moduleValue != null) {
        return DISABLED.equals(moduleValue);
      }
    }
    return false;
  }

  public static void disable(Class<? extends Module> moduleClass) {
    if (moduleClass != null) {
      System.setProperty(moduleClass.getName(), DISABLED);
    }
  }

  public static void resetDisabled() {
{'fraction_non_alphanumeric': 0.11601423487544484, 'fraction_numerical': 0.0007117437722419929, 'mean_word_length': 3.7969283276450514, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '1467275', 'n_tokens_mistral': 794, 'n_tokens_neox': 786, 'n_words': 192}