<s> from __future__ import absolute_import , division , with_statement <EOL> from functools import wraps <EOL> from fabric . decorators import ( task , hosts , roles , runs_once , serial , <EOL> parallel , with_settings ) <EOL> from fabric . network import needs_host <EOL> from revolver . core import env <EOL> from revolver import contextmanager as ctx <EOL> def sudo ( func ) : <EOL> @ wraps ( func ) <EOL> def wrapper ( * args , ** kwargs ) : <EOL> with ctx . sudo ( ) : <EOL> func ( * args , ** kwargs ) <EOL> return wrapper <EOL> def multiargs ( func ) : <EOL> @ wraps ( func ) <EOL> def wrapper ( * args , ** kwargs ) : <EOL> if len ( args ) == <NUM_LIT:0> : <EOL> return func ( ) <EOL> arg = args [ <NUM_LIT:0> ] <EOL> args = args [ <NUM_LIT:1> : ] <EOL> if type ( arg ) in ( tuple , list ) : <EOL> return map ( lambda _ : func ( _ , * args , ** kwargs ) , arg ) <EOL> else : <EOL> return func ( arg , * args , ** kwargs ) <EOL> return wrapper <EOL> def inject_use_sudo ( func ) : <EOL> @ wraps ( func ) <EOL> def inject_wrapper ( * args , ** kwargs ) : <EOL> func_args = func . func_code . co_varnames [ : func . func_code . co_argcount ] <EOL> if "<STR_LIT>" not in kwargs and "<STR_LIT>" in func_args : <EOL> kwargs [ "<STR_LIT>" ] = env . sudo_forced <EOL> if "<STR_LIT>" not in kwargs and "<STR_LIT>" in func_args : <EOL> kwargs [ "<STR_LIT>" ] = env . sudo_forced <EOL> return func ( * args , ** kwargs ) <EOL> return inject_wrapper </s>
