当前位置: 首页>>代码示例>>Python>>正文


Python option_helper.parse_args函数代码示例

本文整理汇总了Python中pycket.option_helper.parse_args函数的典型用法代码示例。如果您正苦于以下问题:Python parse_args函数的具体用法?Python parse_args怎么用?Python parse_args使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了parse_args函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_jitarg_works

    def test_jitarg_works(self, cool_mod):
        # cannot actually check jit hint.
        argv = ['arg0'] + self.ok_jit_args + [cool_mod]
        config, names, args, retval = parse_args(argv)
        assert retval == RETURN_OK

        argv = ['arg0', cool_mod] + self.ok_jit_args
        config, names, args, retval = parse_args(argv)
        assert retval == RETURN_OK
开发者ID:pycket,项目名称:pycket,代码行数:9,代码来源:test_entry_point.py

示例2: test_jitarg_works

    def test_jitarg_works(self, empty_json):
        # cannot actually check jit hint.
        argv = ['arg0'] + self.ok_jit_args + [empty_json]
        config, names, args, retval = parse_args(argv)
        assert retval == 0

        argv = ['arg0', empty_json] + self.ok_jit_args
        config, names, args, retval = parse_args(argv)
        assert retval == 0
开发者ID:8l,项目名称:pycket,代码行数:9,代码来源:test_entry_point.py

示例3: test_verbose

    def test_verbose(self):
        config, names, args, retval = parse_args(['arg0', '--verbose'])
        assert config['verbose']
        assert names['verbosity_level'] == ['-1']

        config, names, args, retval = parse_args(['arg0', '--verbose', '2'])
        assert config['verbose']
        assert names['verbosity_level'] == ['2']
        assert retval == RETURN_OK
开发者ID:pycket,项目名称:pycket,代码行数:9,代码来源:test_entry_point.py

示例4: test_verbose_keywords

    def test_verbose_keywords(self):
        config, names, args, retval = parse_args(['arg0', '--verbose', 'regexp'])
        assert config['verbose']
        assert names['verbosity_level'] == ['-1']
        assert names['verbosity_keywords'] == ['regexp']

        config, names, args, retval = parse_args(['arg0', '--verbose', 'regexp', '--verbose', 'prims'])
        assert config['verbose']
        assert names['verbosity_level'] == ['-1']
        assert names['verbosity_keywords'] == ['regexp', 'prims']

        config, names, args, retval = parse_args(['arg0', '--verbose', 'regexp', '--verbose', '5', '--verbose', 'prims'])
        assert config['verbose']
        assert names['verbosity_level'] == ['5']
        assert names['verbosity_keywords'] == ['regexp', 'prims']
开发者ID:pycket,项目名称:pycket,代码行数:15,代码来源:test_entry_point.py

示例5: test_l

 def test_l(self, cool_mod):
     argv = ['arg0', "-l", cool_mod]
     config, names, args, retval = parse_args(argv)
     assert retval == RETURN_OK
     assert config['no-lib']
     assert 'loads' in names
     assert 'lib' in names['loads'] and cool_mod in names['load_arguments']
开发者ID:pycket,项目名称:pycket,代码行数:7,代码来源:test_entry_point.py

示例6: test_f

 def test_f(self, cool_mod):
     argv = ['arg0', "-f", cool_mod]
     config, names, args, retval = parse_args(argv)
     assert retval == RETURN_OK
     assert config == init_config
     assert 'loads' in names
     assert 'load' in names['loads'] and cool_mod in names['load_arguments']
开发者ID:pycket,项目名称:pycket,代码行数:7,代码来源:test_entry_point.py

示例7: actual_entry

    def actual_entry(argv):
        jit.set_param(None, "trace_limit", 1000000)
        jit.set_param(None, "threshold", 131)
        jit.set_param(None, "trace_eagerness", 50)

        if NonConstant(False):
            # Hack to give os.open() the correct annotation
            os.open("foo", 1, 1)

        config, names, args, retval = parse_args(argv)
        if retval != 0 or config is None:
            return retval
        args_w = [W_String.fromstr_utf8(arg) for arg in args]
        module_name, json_ast = ensure_json_ast(config, names)

        modtable = ModTable()
        modtable.enter_module(module_name)
        if json_ast is None:
            ast = expand_to_ast(module_name, modtable)
        else:
            ast = load_json_ast_rpython(json_ast, modtable)
        modtable.exit_module(module_name, ast)

        env = ToplevelEnv(pycketconfig)
        env.globalconfig.load(ast)
        env.commandline_arguments = args_w
        env.module_env.add_module(module_name, ast)
        try:
            val = interpret_module(ast, env)
        finally:
            from pycket.prims.input_output import shutdown

            shutdown(env)
        return 0
开发者ID:uternet,项目名称:pycket,代码行数:34,代码来源:entry_point.py

示例8: test_b

 def test_b(self):
     f_name = 'dummy.rkt'
     argv1 = ['arg0', "-b", f_name]
     config1, names1, args1, retval1 = parse_args(argv1)
     assert retval1 == 0
     assert names1['byte-expand'] == f_name
     assert args1 == []
开发者ID:magnusmorton,项目名称:pycket,代码行数:7,代码来源:test_entry_point.py

示例9: test_program_arguments_after_jit

 def test_program_arguments_after_jit(self, cool_mod):
     program_args = ["foo", "bar", "baz"]
     argv = ['arg0', cool_mod] + self.ok_jit_args + program_args
     config, names, args, retval = parse_args(argv)
     # again, must use "--"
     assert retval == MISSING_ARG
     assert args == []
开发者ID:pycket,项目名称:pycket,代码行数:7,代码来源:test_entry_point.py

示例10: actual_entry

    def actual_entry(argv):
        jit.set_param(None, "trace_limit", 1000000)
        jit.set_param(None, "threshold", 131)
        jit.set_param(None, "trace_eagerness", 50)

        config, names, args, retval = parse_args(argv)
        if retval != 0 or config is None:
            return retval
        args_w = [W_String.fromstr_utf8(arg) for arg in args]
        module_name, json_ast = ensure_json_ast(config, names)

        entry_flag = 'byte-expand' in names
        reader = JsonLoader(bytecode_expand=entry_flag)
        if json_ast is None:
            ast = reader.expand_to_ast(module_name)
        else:
            ast = reader.load_json_ast_rpython(module_name, json_ast)

        env = ToplevelEnv(pycketconfig)
        env.globalconfig.load(ast)
        env.commandline_arguments = args_w
        env.module_env.add_module(module_name, ast)
        try:
            val = interpret_module(ast, env)
        finally:
            from pycket.prims.input_output import shutdown
            if config.get('save-callgraph', False):
                with open('callgraph.dot', 'w') as outfile:
                    env.callgraph.write_dot_file(outfile)
            shutdown(env)
        return 0
开发者ID:rjnw,项目名称:pycket,代码行数:31,代码来源:entry_point.py

示例11: test_program_arguments_explicit

    def test_program_arguments_explicit(self, cool_mod):
        program_args = ["foo", "bar", "baz"]
        argv = ['arg0', cool_mod] + ["--"] + program_args
        config, names, args, retval = parse_args(argv)

        assert retval == RETURN_OK
        assert args == program_args
开发者ID:pycket,项目名称:pycket,代码行数:7,代码来源:test_entry_point.py

示例12: test_program_arguments_plain

 def test_program_arguments_plain(self, cool_mod):
     program_args = ["foo", "bar", "baz"]
     argv = ['arg0', cool_mod] + program_args
     config, names, args, retval = parse_args(argv)
     # must use "--"
     assert retval == MISSING_ARG
     assert args == []
开发者ID:pycket,项目名称:pycket,代码行数:7,代码来源:test_entry_point.py

示例13: test_program_arguments_explicit_with_switch

    def test_program_arguments_explicit_with_switch(self, empty_json):
        program_args = ["--jit", "foo", "bar", "baz"]
        argv = ['arg0', empty_json] + ["--"] + program_args
        config, names, args, retval = parse_args(argv)

        assert retval == 0
        assert args == program_args
开发者ID:8l,项目名称:pycket,代码行数:7,代码来源:test_entry_point.py

示例14: test_program_arguments_after_jit

    def test_program_arguments_after_jit(self, empty_json):
        program_args = ["foo", "bar", "baz"]
        argv = ['arg0', empty_json] + self.ok_jit_args + program_args
        config, names, args, retval = parse_args(argv)

        assert retval == 0
        assert args == program_args
开发者ID:8l,项目名称:pycket,代码行数:7,代码来源:test_entry_point.py

示例15: test_e

 def test_e(self):
     code = "(ratatta)"
     argv = ['arg0', "-e", code]
     config, names, args, retval = parse_args(argv)
     assert config == init_config
     assert retval == RETURN_OK
     assert 'loads' in names
     assert 'eval' in names['loads'] and code in names['load_arguments']
开发者ID:pycket,项目名称:pycket,代码行数:8,代码来源:test_entry_point.py


注:本文中的pycket.option_helper.parse_args函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。