コード例 #1
0
def get_arguments_dict(spec_args):
    """
    Collect all ValueArgument args in dict according to arg names

    some-key=value will be nested in dict as:

    {"some": {
        "key": value}
    }

    For `YamlFileArgument` value is path to yaml so file content
    will be loaded as a nested dict.

    :param spec_args: Dictionary based on cmd-line args parsed from spec file
    :return: dict
    """
    settings_dict = {}
    for _name, argument in spec_args.items():
        utils.dict_insert(settings_dict, argument, *_name.split("-"))

    return settings_dict
コード例 #2
0
ファイル: main.py プロジェクト: fhubik/InfraRed
def get_arguments_dict(spec_args):
    """
    Collect all ValueArgument args in dict according to arg names

    some-key=value will be nested in dict as:

    {"some": {
        "key": value}
    }

    For `YamlFileArgument` value is path to yaml so file content
    will be loaded as a nested dict.

    :param spec_args: Dictionary based on cmd-line args parsed from spec file
    :return: dict
    """
    settings_dict = {}
    for _name, argument in spec_args.items():
        utils.dict_insert(settings_dict, argument,
                          *_name.split("-"))

    return settings_dict
コード例 #3
0
ファイル: test_utils.py プロジェクト: fhubik/InfraRed
def test_dict_insert(tested, val, key, expected):
    from cli import utils
    utils.dict_insert(tested, val, *key)
    assert tested == expected
コード例 #4
0
ファイル: test_utils.py プロジェクト: ssbarnea/InfraRed
def test_dict_insert(tested, val, key, expected):
    from cli import utils
    utils.dict_insert(tested, val, *key)
    assert tested == expected