<s> from __future__ import absolute_import <EOL> import functools <EOL> import types <EOL> import click <EOL> from tower_cli . conf import settings <EOL> def command ( method = None , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> def actual_decorator ( method ) : <EOL> @ with_global_options <EOL> @ click . command ( ** kwargs ) <EOL> @ functools . wraps ( method ) <EOL> def answer ( * inner_a , ** inner_kw ) : <EOL> runtime_settings = { <EOL> '<STR_LIT:host>' : inner_kw . pop ( '<STR_LIT>' , None ) , <EOL> '<STR_LIT:password>' : inner_kw . pop ( '<STR_LIT>' , None ) , <EOL> '<STR_LIT>' : inner_kw . pop ( '<STR_LIT>' , None ) , <EOL> '<STR_LIT:username>' : inner_kw . pop ( '<STR_LIT>' , None ) , <EOL> '<STR_LIT>' : inner_kw . pop ( '<STR_LIT>' , None ) , <EOL> '<STR_LIT>' : inner_kw . pop ( '<STR_LIT>' , None ) , <EOL> } <EOL> with settings . runtime_values ( ** runtime_settings ) : <EOL> return method ( * inner_a , ** inner_kw ) <EOL> return answer <EOL> if method and isinstance ( method , types . FunctionType ) : <EOL> return actual_decorator ( method ) <EOL> else : <EOL> return actual_decorator <EOL> def with_global_options ( method ) : <EOL> """<STR_LIT>""" <EOL> method = click . option ( <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> help = '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' , <EOL> required = False , <EOL> ) ( method ) <EOL> method = click . option ( <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> help = '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' , <EOL> required = False , <EOL> ) ( method ) <EOL> method = click . option ( <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> help = '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' , <EOL> required = False , <EOL> ) ( method ) <EOL> method = click . option ( <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> help = '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' , <EOL> type = click . Choice ( [ '<STR_LIT>' , '<STR_LIT>' ] ) , <EOL> required = False , <EOL> ) ( method ) <EOL> method = click . option ( <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> default = None , <EOL> help = '<STR_LIT>' , <EOL> is_flag = True , <EOL> required = False , <EOL> ) ( method ) <EOL> method = click . option ( <EOL> '<STR_LIT>' , <EOL> default = None , <EOL> help = '<STR_LIT>' <EOL> '<STR_LIT>' , <EOL> is_flag = True , <EOL> required = False , <EOL> ) ( method ) <EOL> return method </s>
