<commit_before>"""
    gorilla.extensionsregistrar
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    Utility to find and register extensions.
    
    :copyright: Copyright 2014 by <NAME>.
    :license: MIT, see LICENSE for details.
"""

import pkgutil
import sys
import types

import gorilla._python
import gorilla._utils
import gorilla.utils
from gorilla.extensionset import ExtensionSet


class ExtensionsRegistrar(object):
    
    """Registrar for the extensions."""
    
    @classmethod
    def register_extensions(cls, packages_and_modules, patch=False):
        """Scan and register all the extensions found.
        
        The extensions are recursively scanned from the list of packages and
        modules provided.
        
        Parameters
        ----------
        packages_and_modules : list of modules
            List of packages and modules to scan recursively.
        patch : bool, optional
            True to also apply the patches.
        """
        if gorilla._python.PY3:
            def load_module(finder, name):
                loader, _ = finder.find_loader(name)
                return loader.load_module()
        else:
            def load_module(finder, name):<commit_msg>Add missing sections from the docstring.<commit_after>"""
    gorilla.extensionsregistrar
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    Utility to find and register extensions.
    
    :copyright: Copyright 2014 by <NAME>.
    :license: MIT, see LICENSE for details.
"""

import pkgutil
import sys
import types

import gorilla._python
import gorilla._utils
import gorilla.utils
from gorilla.extensionset import ExtensionSet


class ExtensionsRegistrar(object):
    
    """Registrar for the extensions."""
    
    @classmethod
    def register_extensions(cls, packages_and_modules, patch=False):
        """Scan and register all the extensions found.
        
        The extensions are recursively scanned from the list of packages and
        modules provided.
        
        Parameters
        ----------
        packages_and_modules : list of modules
            List of packages and modules to scan recursively.
        patch : bool, optional
            True to also apply the patches.
        
        Returns
        -------
        list of gorilla.extensionset.ExtensionSet
            Extensions gound, grouped within an extension set per directory
            level.
        
        Raises
        ------
        TypeError
            The input is not a valid package or module.
        """
        if gorilla._python.PY3:
            def load_module(finder, name):
                loader, _ = finder.find_loader(name)
                return loader.load_module()
        else:
            def load_module(finder, name):
{'fraction_non_alphanumeric': 0.08814923189465984, 'fraction_numerical': 0.0036576444769568397, 'mean_word_length': 2.069584736251403, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2950565', 'n_tokens_mistral': 694, 'n_tokens_neox': 654, 'n_words': 231}