def load_extension(self, extension):
        """
        Loads an extension to the tax and benefit system.

        :param string extension: The extension to load. Can be an absolute path pointing to an extension directory, or the name of an OpenFisca extension installed as a pip package.

        """
        # Load extension from installed pip package
        try:
            package = importlib.import_module(extension)
            extension_directory = package.__path__[0]
        except ImportError:
            message = linesep.join([traceback.format_exc(),
                                    'Error loading extension: `{}` is neither a directory, nor a package.'.format(extension),
                                    'Are you sure it is installed in your environment? If so, look at the stack trace above to determine the origin of this error.',
                                    'See more at <https://github.com/openfisca/openfisca-extension-template#installing>.'])
            raise ValueError(message)

        self.add_variables_from_directory(extension_directory)
        param_dir = path.join(extension_directory, 'parameters')
        if path.isdir(param_dir):
            extension_parameters = ParameterNode(directory_path = param_dir)
            self.parameters.merge(extension_parameters)
def load_extension ( self , extension ) : try : package = importlib . import_module ( extension ) extension_directory = package . __path__ [ 0 ] except ImportError : message = linesep . join ( [ traceback . format_exc ( ) , 'Error loading extension: `{}` is neither a directory, nor a package.' . format ( extension ) , 'Are you sure it is installed in your environment? If so, look at the stack trace above to determine the origin of this error.' , 'See more at <https://github.com/openfisca/openfisca-extension-template#installing>.' ] ) raise ValueError ( message ) self . add_variables_from_directory ( extension_directory ) param_dir = path . join ( extension_directory , 'parameters' ) if path . isdir ( param_dir ) : extension_parameters = ParameterNode ( directory_path = param_dir ) self . parameters . merge ( extension_parameters )
Loads an extension to the tax and benefit system.

        :param string extension: The extension to load. Can be an absolute path pointing to an extension directory, or the name of an OpenFisca extension installed as a pip package.