<s> from circus . commands . base import Command <EOL> from circus . exc import ArgumentError , MessageError <EOL> from circus . util import convert_opt <EOL> class Get ( Command ) : <EOL> """<STR_LIT>""" <EOL> name = "<STR_LIT>" <EOL> properties = [ '<STR_LIT:name>' , '<STR_LIT>' ] <EOL> def message ( self , * args , ** opts ) : <EOL> if len ( args ) < <NUM_LIT:2> : <EOL> raise ArgumentError ( "<STR_LIT>" ) <EOL> return self . make_message ( name = args [ <NUM_LIT:0> ] , keys = args [ <NUM_LIT:1> : ] ) <EOL> def execute ( self , arbiter , props ) : <EOL> watcher = self . _get_watcher ( arbiter , props . get ( '<STR_LIT:name>' ) ) <EOL> options = { } <EOL> for name in props . get ( '<STR_LIT>' , [ ] ) : <EOL> if name in watcher . optnames : <EOL> options [ name ] = getattr ( watcher , name ) <EOL> else : <EOL> raise MessageError ( "<STR_LIT>" % name ) <EOL> return { "<STR_LIT>" : options } <EOL> def console_msg ( self , msg ) : <EOL> if msg [ '<STR_LIT:status>' ] == "<STR_LIT>" : <EOL> ret = [ ] <EOL> for k , v in msg . get ( '<STR_LIT>' , { } ) . items ( ) : <EOL> ret . append ( "<STR_LIT>" % ( k , convert_opt ( k , v ) ) ) <EOL> return "<STR_LIT:\n>" . join ( ret ) <EOL> return self . console_error ( msg ) </s>
