def test_module_name_scenario_2(): class TestClass2: pass info = PluginInfo("renderer", custom="property") info.cls = TestClass2 eq_(info.module_name, "test_plugin_info")
def test_module_name_scenario_2(): class TestClass2: pass info = PluginInfo('renderer', custom='property') info.cls = TestClass2 eq_(info.module_name, 'test_plugin_info')
def test_plugin_info(): info = PluginInfo('renderer', abs_class_path='good.plugin.path', custom='property') assert info.custom == 'property' keys = list(info.tags()) assert len(keys) == 1 assert keys[0] == 'renderer' assert info.module_name == 'good' expected = { "path": "good.plugin.path", "plugin_type": "renderer", "custom": "property" } eq_(json.loads(info.__repr__()), expected)
def test_plugin_info(): info = PluginInfo("renderer", abs_class_path="good.plugin.path", custom="property") assert info.custom == "property" keys = list(info.tags()) assert len(keys) == 1 assert keys[0] == "renderer" assert info.module_name == "good" expected = { "path": "good.plugin.path", "plugin_type": "renderer", "custom": "property", } eq_(json.loads(info.__repr__()), expected)
def test_dict_as_plugin_payload(): manager = PluginManager("test plugin3") plugin = PluginInfo("test plugin3", tags=["primary key", "key 1", "key 2"]) plugin(dict(B=1)) instance = manager.load_me_now("key 1") eq_(instance, dict(B=1))
# flake8: noqa from lml.plugin import PluginInfo, PluginInfoChain import moban.constants as constants from moban_template_toolkit._version import __version__ from moban_template_toolkit._version import __author__ PluginInfoChain(__name__).add_a_plugin_instance( PluginInfo( constants.TEMPLATE_ENGINE_EXTENSION, "%s.engine.EngineTemplateToolkit" % __name__, tags=["template_toolkit", "tt"] ) )
def make_me_a_plugin_info(plugin_name): return PluginInfo(plugin_name, 'abs_path', custom='property')
def make_me_a_plugin_info(plugin_name): return PluginInfo(plugin_name, "abs_path", custom="property")
# flake8: noqa import moban.constants as constants from lml.plugin import PluginInfo, PluginInfoChain from moban_anyconfig._version import __author__, __version__ PluginInfoChain(__name__).add_a_plugin_instance( PluginInfo( constants.DATA_LOADER_EXTENSION, "%s.adapter.loads" % __name__, tags=[ "toml", "pickle", "xml", "ini", "properties", "shellvars", "ion", "bson", "cbor", "configobj", "msgpack", ], ) )
def register_partial(identifier, partial): plugin = PluginInfo(PARTIALS_EXTENSION, tags=[identifier]) partial = Compiler().compile(partial) plugin({identifier: partial})
def __init__(self, absolute_import_path, **keywords): PluginInfo.__init__(self, "source", absolute_import_path, **keywords)
# flake8: noqa import moban.constants as constants from lml.plugin import PluginInfo, PluginInfoChain from moban_handlebars._version import __author__, __version__ PluginInfoChain(__name__).add_a_plugin_instance( PluginInfo( constants.TEMPLATE_ENGINE_EXTENSION, "%s.engine.EngineHandlebars" % __name__, tags=["handlebars", "hbs"], ) )
# flake8: noqa from lml.plugin import PluginInfo, PluginInfoChain import moban.constants as constants from moban_haml._version import __version__ from moban_haml._version import __author__ PluginInfoChain(__name__).add_a_plugin_instance( PluginInfo( constants.TEMPLATE_ENGINE_EXTENSION, "%s.engine.EngineHaml" % __name__, tags=[ "Haml", "haml", ], ))
from lml.plugin import PluginInfo, PluginInfoChain EXTENSION_TYPE = "pyecharts_environment" PluginInfoChain(__name__).add_a_plugin_instance( PluginInfo( EXTENSION_TYPE, "%s.environment.SnapshotEnvironment" % __name__, tags=["png", "svg", "jpeg", "gif", "pdf"], ) )
def __init__(self, absolute_import_path, **keywords): PluginInfo.__init__(self, "source", absolute_import_path, **keywords)
from lml.plugin import PluginInfo, PluginInfoChain EXTENSION_TYPE = 'pyecharts_environment' PluginInfoChain(__name__).add_a_plugin_instance( PluginInfo( EXTENSION_TYPE, '%s.environment.SnapshotEnvironment' % __name__, tags=['png', 'svg', 'jpeg', 'gif', 'pdf'] ) )
def jinja_global(identifier, dict_obj): plugin = PluginInfo(constants.JINJA_GLOBALS_EXTENSION, tags=[identifier]) plugin(dict_obj)
# flake8: noqa import moban.constants as constants from lml.plugin import PluginInfo, PluginInfoChain from moban_velocity._version import __author__, __version__ PluginInfoChain(__name__).add_a_plugin_instance( PluginInfo( constants.TEMPLATE_ENGINE_EXTENSION, "%s.engine.EngineVelocity" % __name__, tags=[ "velocity", "vtl", ], ))