def __init__(self, template_dirs, context_dirs): scan_plugins_regex(MOBAN_ALL, "moban", None, BUILTIN_EXENSIONS) template_dirs = list(expand_template_directories(template_dirs)) verify_the_existence_of_directories(template_dirs) context_dirs = expand_template_directory(context_dirs) template_loader = FileSystemLoader(template_dirs) self.jj2_environment = Environment( loader=template_loader, keep_trailing_newline=True, trim_blocks=True, lstrip_blocks=True, ) for filter_name, filter_function in _FILTERS.get_all(): self.jj2_environment.filters[filter_name] = filter_function for test_name, test_function in _TESTS.get_all(): self.jj2_environment.tests[test_name] = test_function for global_name, dict_obj in _GLOBALS.get_all(): self.jj2_environment.globals[global_name] = dict_obj self.context = Context(context_dirs) self.template_dirs = template_dirs self.__file_count = 0 self.__templated_count = 0
def load_plugins(plugin_name_patterns, path, black_list, white_list): """Try to discover all pyexcel-io plugins""" scan_plugins_regex( plugin_name_patterns=plugin_name_patterns, pyinstaller_path=path, black_list=black_list, white_list=white_list, )
def load_plugins(plugin_name_patterns, path, black_list, white_list): """Try to discover all pyexcel-io plugins""" scan_plugins_regex( plugin_name_patterns=plugin_name_patterns, pyinstaller_path=path, black_list=black_list, white_list=white_list )
def load_jinja2_extensions(): scan_plugins_regex(JINJA2_LIBRARIES, "moban", None, JINJA2_EXENSIONS)
def make_sure_all_pkg_are_loaded(): scan_plugins_regex(constants.MOBAN_ALL, "moban", None, BUILTIN_EXENSIONS)
:license: New BSD License """ from pyexcel.internal.plugins import PARSER, RENDERER # noqa from pyexcel.internal.generators import BookStream, SheetStream # noqa from pyexcel.internal.source_plugin import SOURCE # noqa from lml.loader import scan_plugins_regex BLACK_LIST = [ "pyexcel_io", "pyexcel_webio", "pyexcel_xlsx", "pyexcel_xls", "pyexcel_ods3", "pyexcel_ods", "pyexcel_odsr", "pyexcel_xlsxw", ] WHITE_LIST = [ "pyexcel.plugins.parsers", "pyexcel.plugins.renderers", "pyexcel.plugins.sources", ] scan_plugins_regex( plugin_name_patterns="^pyexcel_.+$", pyinstaller_path="pyexcel", black_list=BLACK_LIST, white_list=WHITE_LIST, )
# flake8: noqa from lml.loader import scan_plugins_regex from moban_ansible._version import __author__, __version__ ANSIBLE_LIBRARIES = "^moban_ansible_.+$" ANSIBLE_EXTENSIONS = [ "moban_ansible.tests.files", "moban_ansible.engines.line_in_file", ] scan_plugins_regex(ANSIBLE_LIBRARIES, "moban", None, ANSIBLE_EXTENSIONS)
def get_a_extension(self, name): if len(self.js_extensions) == 0: self.get_all_extensions() for extension in self.js_extensions: if extension.registry[REGISTRY_JS_FOLDER] == name: return extension return None EXTENSION_MANAGER = JsExtensionManager() # Load js & map file index into a dictionary. scan_plugins_regex( plugin_name_patterns=OPTIONAL_PLUGIN_PREFIX, pyinstaller_path="pyecharts", # <- useful for pyinstaller only white_list=MUST_LOAD_PLUGINS, ) def read_a_map_registry(registry_json): with codecs.open(registry_json, "r", "utf-8") as f: content = f.read() return json.loads(content) def _validate_registry(registry): _registry_keys = [ REGISTRY_JS_FOLDER, REGISTRY_FILE_MAP, REGISTRY_GITHUB_URL,