예제 #1
0
def nested():
    template = nestle.NestleOptions.default_options
    options = {
        "prior location": SIMPLE_PRIOR,
        "prior name": "prior",
        "method": "classic",
        "npoints": 4
    }
    command = option_tools.CommandOptions(template, options)
    setup = nestle.NestleOptions.setup(command)
    return setup.return_interface()
예제 #2
0
def iterator():
    template = data.DataIterator.default_options
    options = {"fail": True}
    command = option_tools.CommandOptions(template, options)
    setup = data.DataIterator.setup(command)
    return setup.return_interface()
예제 #3
0
def parser():
    template = data.DataParser.default_options
    options = {"enable cache": False}
    command = option_tools.CommandOptions(template, options)
    setup = data.DataParser.setup(command)
    return setup.return_interface()
예제 #4
0
 def __get_command_object(metadata, settings):
     # type: (opts.Base, Dict[str, Any]) -> option_tools.CommandOptions
     default = metadata.default_options
     loaded_settings = settings[metadata.plugin_name]
     return option_tools.CommandOptions(default, loaded_settings)
예제 #5
0
import pytest

from PyPWA.initializers.configurator import options
from PyPWA.initializers.configurator import option_tools

configuration = {
    "Option 1": 123,
    "Option 2": "A collection of words",
    "Option 3": ["Preset 2"],
    "Option 4": "ABC"
}

NO_OPTIONS = option_tools.CommandOptions(configuration, {})
MIN_OPTIONS = option_tools.CommandOptions(configuration, {"Option 1": 231})
FULL_OPTIONS = option_tools.CommandOptions(
    configuration, {
        "Option 1": 321,
        "Option 2": "words",
        "Option 3": ["Preset 1"],
        "Option 4": None
    })


@pytest.fixture
def plugin_name_conversion():
    return option_tools.PluginNameConversion()


def test_conversion_can_get_enum(plugin_name_conversion):
    plugin_type = plugin_name_conversion.external_to_internal("Data Parsing")
    assert plugin_type == options.Types.DATA_PARSER