mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Minor formatting changes in commands/utils.py
This commit is contained in:
parent
8476154369
commit
36a072948c
@ -1,4 +1,6 @@
|
|||||||
"""Utility functions and basic common arguments for ``argparse.ArgumentParser``."""
|
"""Utility functions and basic common arguments
|
||||||
|
for ``argparse.ArgumentParser``.
|
||||||
|
"""
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import multiprocessing as mp
|
import multiprocessing as mp
|
||||||
@ -7,7 +9,8 @@ import multiprocessing as mp
|
|||||||
def start(parser, scope):
|
def start(parser, scope):
|
||||||
"""Utility function to execute a subcommand.
|
"""Utility function to execute a subcommand.
|
||||||
|
|
||||||
The function will look up in the ``scope`` if there is a function called ``run_<parser.args.command>``
|
The function will look up in the ``scope``
|
||||||
|
if there is a function called ``run_<parser.args.command>``
|
||||||
and will run it using ``parser.args`` as first positional argument.
|
and will run it using ``parser.args`` as first positional argument.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -15,7 +18,8 @@ def start(parser, scope):
|
|||||||
scope (dict): map containing (eventually) the functions to be called.
|
scope (dict): map containing (eventually) the functions to be called.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
NotImplementedError: if ``scope`` doesn't contain a function called ``run_<parser.args.command>``.
|
NotImplementedError: if ``scope`` doesn't contain a function called
|
||||||
|
``run_<parser.args.command>``.
|
||||||
"""
|
"""
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
@ -29,7 +33,8 @@ def start(parser, scope):
|
|||||||
|
|
||||||
# if no command has been found, raise a `NotImplementedError`
|
# if no command has been found, raise a `NotImplementedError`
|
||||||
if not func:
|
if not func:
|
||||||
raise NotImplementedError('Command `{}` not yet implemented'.format(args.command))
|
raise NotImplementedError('Command `{}` not yet implemented'.
|
||||||
|
format(args.command))
|
||||||
|
|
||||||
args.multiprocess = getattr(args, 'multiprocess', False)
|
args.multiprocess = getattr(args, 'multiprocess', False)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user