def names() -> List[str]: """List the names of the available parsers Returns: Names of the available parsers """ return plugins.names(package_name=__name__)
def names() -> List[str]: """List the names of the available writers Returns: List of strings with the names of the available writers. """ return plugins.names(package_name=__name__)
def names(): """List the names of the available parsers Returns: List: List of strings with the names of the available parsers """ return plugins.names(package_name=__name__)
def satellites(): """Available satellites and where they are defined Returns: Dict: For each satellite, a tuple describing which satellite plug-in defines the satellite. """ return {p.lower(): (s, p) for s in plugins.names(__name__) for p in plugins.parts(__name__, s)}
def test_load_plugin_with_prefix(): """Test that a plugin can be called using a prefix""" package_name = "midgard.parsers" plugin_name = [p for p in plugins.names(package_name) if "_" in p][0] prefix, _, plugin = plugin_name.partition("_") expected_name = plugin_name assert plugins.load(package_name, plugin, prefix=prefix) == expected_name
def names(): """List names of integrators for a given session The list of names will be sorted according to the sort_value of the integrator plugins (use `register_ordered` to define a sort value for an integrator). Returns: List: Sorted list of names of integrators. """ return plugins.names(package_name=__name__)
def options(): """List the command line options for starting the different pipelines Returns: Dict: Command line options pointing to pipelines """ options = dict() plugin_files = plugins.names(package_name=__name__) for pipeline in plugin_files: try: pipeline_options = plugins.call(package_name=__name__, plugin_name=pipeline, part="options") except mg_exceptions.UnknownPluginError: continue options.update({opt: pipeline for opt in pipeline_options}) return options
def test_call_existing_plugin(tmpfile): """Test that calling a parser-plugin works, and returns a Parser instance""" package_name = "midgard.parsers" plugin_name = plugins.names(package_name)[0] parser = plugins.call(package_name, plugin_name, file_path=tmpfile) assert isinstance(parser, Parser)
def test_plugin_exists(): """Test that an existing plugin returns True for exists()""" package_name = "midgard.parsers" plugin_name = plugins.names(package_name)[0] assert plugins.exists(package_name, plugin_name)
def test_package_non_existing(): """Test that a non-existent package raises an appropriate error""" with pytest.raises(exceptions.UnknownPackageError): plugins.names("midgard.non_existent")
def test_package_empty(): """Test that names() does not find any plugins in midgard.dev-package""" lib_plugins = plugins.names("midgard.dev") assert len(lib_plugins) == 0
def test_package_not_empty(plugin_package): """Test that names() finds some plugins in package""" parsers = plugins.names(plugin_package) assert len(parsers) > 0
def test_ordered_plugin(plugin_package): """Test that order of plugins can be customized""" plugin_names = plugins.names(plugin_package) assert plugin_names[0] == "plugin_first" assert plugin_names[-1] == "plugin_last"
def names() -> List[str]: """Names of fieldtype plugins""" return plugins.names(__name__)