sip_run.py 文件源码

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

项目:integration-prototype 作者: SKA-ScienceDataProcessor 项目源码 文件源码
def __init__(self):
        """Sets up a command line parser, initialises logging and runs the
        specified module.
        """
        # Set up command line parser.
        run_methods = [func[4:] for func in dir(__class__)
                       if callable(getattr(__class__, func))
                       and func.startswith('run_')]
        parser = argparse.ArgumentParser(prog='sip_run.py',
                                         description='Run a SIP function.')
        parser.add_argument('module', help='Module to run.',
                            choices=run_methods)
        parser.add_argument('-v', '--verbose', help='Enable verbose messages.',
                            action='store_true')
        parser.add_argument('--config', '-c', type=argparse.FileType('r'),
                            help='JSON configuration file.')
        self.args = parser.parse_args()

        # Initialise logging.
        self._log = self._init_logger()

        # Run the specified module.
        self._dispatch(self.args.module)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号