init.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:temci 作者: parttimenerd 项目源码 文件源码
def prompt_spec_exec_dict(run_dict: dict) -> dict:
    """
    Prompt for the config of the spec exec runner.

    :param run_dict: run config dict (without the runner part)
    :return: runner config
    """
    runner_dict = {}

    runner_dict["file"] = default_prompt("SPEC like result file to use: ",
                                         validator=TypeValidator(FileName()),
                                         completer=PathCompleter())

    runner_dict["base_path"] = prompt("Property base path: ")

    runner_dict["path_regexp"] = prompt("Regexp matching the property path for each measured property: ",
                                        validator=NonEmptyValidator())

    def get(sub_path: str = ""): # just a mock
        """
        Get the value of the property with the given path.
        :param sub_path: given path relative to the base path
        :return: value of the property
        """
    print("The python code is entered via a multiline input. ")
    print("Press [Meta+Enter] or [Esc] followed by [Enter] to accept input.")
    print("You can click with the mouse in order to select text.")
    print("Use the get(sub_path: str) -> str function to obtain a properties value.")
    locs = locals()
    runner_dict["code"] = prompt_python("The python is executed for each measured property: \n", lambda: {}, lambda: {"get": locs["get"]})

    return runner_dict
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号