<s> import logging <EOL> from cliff . show import ShowOne <EOL> from clifftablib . formatters import JsonFormatter <EOL> from raxcli . apps . monitoring . utils import MonitoringCommand , get_client <EOL> class ListCommand ( MonitoringCommand , ShowOne ) : <EOL> """<STR_LIT>""" <EOL> log = logging . getLogger ( __name__ ) <EOL> def take_action ( self , parsed_args ) : <EOL> client = get_client ( parsed_args ) <EOL> limits = client . ex_limits ( ) <EOL> if isinstance ( self . formatter , JsonFormatter ) : <EOL> columns = limits . keys ( ) <EOL> return ( columns , [ limits [ column ] for column in columns ] ) <EOL> else : <EOL> columns_prefixes = limits . keys ( ) <EOL> columns = [ ] <EOL> data = [ ] <EOL> for prefix in columns_prefixes : <EOL> for k , v in limits [ prefix ] . iteritems ( ) : <EOL> columns . append ( "<STR_LIT>" % ( prefix , k ) ) <EOL> data . append ( v ) <EOL> return ( columns , data ) </s>
