Builtin, third party, and first party are all supposed to have a newline between them. Most of the codebase was doing this, but some had snuck through. This updates those ones to follow the coding style. These are caught by recent changes in the code style checking plugin making it more strict / accurate.
29 lines
581 B
Python
29 lines
581 B
Python
from functools import wraps
|
|
|
|
import docopt
|
|
|
|
from dcos import emitting
|
|
|
|
emitter = emitting.FlatEmitter()
|
|
|
|
|
|
def decorate_docopt_usage(func):
|
|
"""Handle DocoptExit exception
|
|
|
|
:param func: function
|
|
:type func: function
|
|
:return: wrapped function
|
|
:rtype: function
|
|
"""
|
|
|
|
@wraps(func)
|
|
def wrapper(*args, **kwargs):
|
|
try:
|
|
result = func(*args, **kwargs)
|
|
except docopt.DocoptExit as e:
|
|
emitter.publish("Command not recognized\n")
|
|
emitter.publish(e)
|
|
return 1
|
|
return result
|
|
return wrapper
|