當前位置: 首頁>>代碼示例>>Python>>正文


Python doit_cmd.DoitMain類代碼示例

本文整理匯總了Python中doit.doit_cmd.DoitMain的典型用法代碼示例。如果您正苦於以下問題:Python DoitMain類的具體用法?Python DoitMain怎麽用?Python DoitMain使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了DoitMain類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: start

    def start(self):
        """Begin executing tasks."""

        if self.log_filename:
            print('Output will be logged to `%s`.' % self.log_filename)

        start_time = time.strftime(self.timestamp_fmt)
        print('Started %s' % start_time)

        if self.log_filename:
            orig_stdout = sys.stdout
            orig_stderr = sys.stderr

            sys.stdout = self.log_file
            sys.stderr = self.log_file

            print('Started %s' % start_time)

        doit_main = DoitMain(self)
        doit_main.run(['run'])

        stop_time = time.strftime(self.timestamp_fmt)

        if self.log_filename:
            print('Stopped %s' % stop_time)
            print()

            sys.stdout = orig_stdout
            sys.stderr = orig_stderr
            self.log_file.close()

        print('Stopped %s' % stop_time)
開發者ID:metavee,項目名稱:batchproc,代碼行數:32,代碼來源:core.py

示例2: doit

    def doit(line):
        """
        Run *doit* with `task_creators` from all interactive variables
        (IPython's global namespace).

        Examples:

            >>> %doit --help          ## Show help for options and arguments.

            >>> def task_foo():
                    return {'actions': ['echo hi IPython'],
                            'verbosity': 2}

            >>> %doit list            ## List any tasks discovered.
            foo

            >>> %doit                 ## Run any tasks.
            .  foo
            hi IPython

        """
        ip = get_ipython()
        # Override db-files location inside ipython-profile dir,
        # which is certainly writable.
        prof_dir = ip.profile_dir.location
        opt_vals = {'dep_file': os.path.join(prof_dir, 'db', '.doit.db')}
        commander = DoitMain(ModuleTaskLoader(ip.user_module),
                             extra_config={'GLOBAL': opt_vals})
        commander.run(line.split())
開發者ID:saimn,項目名稱:doit,代碼行數:29,代碼來源:tools.py

示例3: main

def main():

    configure_test()

    load_exps()

    doit_main = DoitMain(CustomTaskLoader())
    return doit_main.run(['run'])
開發者ID:grnydawn,項目名稱:VectorizeIt,代碼行數:8,代碼來源:vectest.py

示例4: test_help_plugin_name

 def test_help_plugin_name(self, capsys):
     plugin = {'XXX': 'tests.sample_plugin:MyCmd'}
     main = DoitMain(extra_config={'COMMAND':plugin})
     main.BIN_NAME = 'doit'
     returned = main.run(["help"])
     assert returned == 0
     out, err = capsys.readouterr()
     assert "doit XXX " in out
     assert "test extending doit commands" in out, out
開發者ID:pydoit,項目名稱:doit,代碼行數:9,代碼來源:test_cmd_help.py

示例5: main

def main(argv=None):
    myname = path.basename(sys.argv[0])  # @UnusedVariable
    mydir = path.dirname(__file__)  # @UnusedVariable
    if argv is None:
        argv = sys.argv[1:]
    opt_vals = {}  # 'dep_file': path.abspath(path.join(mydir, '.doit.db'))}
    commander = DoitMain(ModuleTaskLoader(pndlcmd),
                         extra_config={'GLOBAL': opt_vals})
    commander.run(argv)
開發者ID:silky,項目名稱:pandalone,代碼行數:9,代碼來源:__main__.py

示例6: get_commands

 def get_commands(self):
     # core doit commands
     cmds = DoitMain.get_commands(self)
     # load nikola commands
     for name, cmd in self.nikola.commands.items():
         cmds[name] = cmd
     return cmds
開發者ID:emilopez,項目名稱:nikola,代碼行數:7,代碼來源:main.py

示例7: get_commands

 def get_commands(self):
     # core doit commands
     cmds = DoitMain.get_commands(self)
     # load nikola commands
     for name, cmd in self.nikola.commands.items():
         cmds[name] = cmd
     # Hide run because Nikola uses build
     cmds.pop('run')
     return cmds
開發者ID:verbalshadow,項目名稱:nikola,代碼行數:9,代碼來源:main.py

示例8: cmd_main

def cmd_main(args, extra_config=None, bin_name='doit'):
    if extra_config:
        extra_config = {'GLOBAL': extra_config}
    main = DoitMain(extra_config=extra_config)
    main.BIN_NAME = bin_name
    return main.run(args)
開發者ID:pydoit,項目名稱:doit,代碼行數:6,代碼來源:test_cmd_help.py

示例9: get_commands

 def get_commands(self):
     cmds = DoitMain.get_commands(self)
     my_cmd = MyCmd()
     cmds[my_cmd.name] = my_cmd
     return cmds
開發者ID:JeffSpies,項目名稱:doit,代碼行數:5,代碼來源:custom_cmd.py

示例10: doit_app

def doit_app(request):
    app = DoitMain()
    app.sub_cmds['tabcompletion'] = TabCompletion()
    app.sub_cmds['help'] = Help()
    return app
開發者ID:JeffSpies,項目名稱:doit,代碼行數:5,代碼來源:test_cmd_completion.py


注:本文中的doit.doit_cmd.DoitMain類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。