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)
sip_run.py 文件源码
python
阅读 27
收藏 0
点赞 0
评论 0
评论列表
文章目录