<s> """<STR_LIT>""" <EOL> import pprint <EOL> from . cmd_base import DoitCmdBase <EOL> from . exceptions import InvalidCommand <EOL> opt_show_execute_status = { <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:s>' , <EOL> '<STR_LIT>' : '<STR_LIT:status>' , <EOL> '<STR_LIT:type>' : bool , <EOL> '<STR_LIT:default>' : False , <EOL> '<STR_LIT>' : """<STR_LIT>""" <EOL> } <EOL> class Info ( DoitCmdBase ) : <EOL> """<STR_LIT>""" <EOL> doc_purpose = "<STR_LIT>" <EOL> doc_usage = "<STR_LIT>" <EOL> doc_description = None <EOL> cmd_options = ( opt_show_execute_status , ) <EOL> def _execute ( self , pos_args , show_execute_status = False ) : <EOL> if len ( pos_args ) != <NUM_LIT:1> : <EOL> msg = ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> raise InvalidCommand ( msg ) <EOL> task_name = pos_args [ <NUM_LIT:0> ] <EOL> tasks = dict ( [ ( t . name , t ) for t in self . task_list ] ) <EOL> printer = pprint . PrettyPrinter ( indent = <NUM_LIT:4> , stream = self . outstream ) <EOL> task = tasks [ task_name ] <EOL> task_attrs = ( <EOL> '<STR_LIT:name>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' <EOL> ) <EOL> for attr in task_attrs : <EOL> value = getattr ( task , attr ) <EOL> if value : <EOL> self . outstream . write ( '<STR_LIT>' . format ( attr ) ) <EOL> printer . pprint ( getattr ( task , attr ) ) <EOL> if show_execute_status : <EOL> status = self . dep_manager . get_status ( task , tasks , get_log = True ) <EOL> if status . status == '<STR_LIT>' : <EOL> self . outstream . write ( '<STR_LIT>' ) <EOL> return <NUM_LIT:0> <EOL> else : <EOL> self . outstream . write ( '<STR_LIT>' ) <EOL> self . outstream . write ( self . get_reasons ( status . reasons ) ) <EOL> self . outstream . write ( '<STR_LIT:\n>' ) <EOL> return <NUM_LIT:1> <EOL> @ staticmethod <EOL> def get_reasons ( reasons ) : <EOL> '''<STR_LIT>''' <EOL> lines = [ ] <EOL> if reasons [ '<STR_LIT>' ] : <EOL> lines . append ( '<STR_LIT>' ) <EOL> if reasons [ '<STR_LIT>' ] : <EOL> lines . append ( '<STR_LIT>' ) <EOL> for utd , utd_args , utd_kwargs in reasons [ '<STR_LIT>' ] : <EOL> msg = '<STR_LIT>' <EOL> lines . append ( msg . format ( utd , utd_args , utd_kwargs ) ) <EOL> if reasons [ '<STR_LIT>' ] : <EOL> msg = '<STR_LIT>' <EOL> lines . append ( msg . format ( * reasons [ '<STR_LIT>' ] ) ) <EOL> sentences = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } <EOL> for reason , sentence in sentences . items ( ) : <EOL> entries = reasons . get ( reason ) <EOL> if entries : <EOL> lines . append ( '<STR_LIT>' . format ( sentence ) ) <EOL> for item in entries : <EOL> lines . append ( '<STR_LIT>' . format ( item ) ) <EOL> return '<STR_LIT:\n>' . join ( lines ) </s>
