<s> import logging <EOL> import os <EOL> from aeromancer . db import models <EOL> from aeromancer . oslo import models as oslo_models <EOL> from aeromancer import project <EOL> from aeromancer import utils <EOL> from cliff . lister import Lister <EOL> from sqlalchemy import distinct <EOL> from sqlalchemy . orm import aliased <EOL> class List ( Lister ) : <EOL> """<STR_LIT>""" <EOL> log = logging . getLogger ( __name__ ) <EOL> def get_parser ( self , prog_name ) : <EOL> parser = super ( List , self ) . get_parser ( prog_name ) <EOL> parser . add_argument ( <EOL> '<STR_LIT>' , <EOL> help = ( '<STR_LIT>' <EOL> '<STR_LIT>' ) , <EOL> ) <EOL> return parser <EOL> def take_action ( self , parsed_args ) : <EOL> session = self . app . get_db_session ( ) <EOL> query = session . query ( oslo_models . Module ) . join ( models . Project ) . filter ( <EOL> models . Project . name == parsed_args . project <EOL> ) . order_by ( oslo_models . Module . name ) <EOL> return ( ( '<STR_LIT:Name>' , ) , <EOL> ( ( r . name , ) <EOL> for r in query . all ( ) ) ) <EOL> class Uses ( Lister ) : <EOL> """<STR_LIT>""" <EOL> log = logging . getLogger ( __name__ ) <EOL> def get_parser ( self , prog_name ) : <EOL> parser = super ( Uses , self ) . get_parser ( prog_name ) <EOL> parser . add_argument ( <EOL> '<STR_LIT>' , <EOL> help = '<STR_LIT>' , <EOL> ) <EOL> return parser <EOL> def take_action ( self , parsed_args ) : <EOL> session = self . app . get_db_session ( ) <EOL> query = session . query ( oslo_models . Module ) . join ( models . Project ) . filter ( <EOL> oslo_models . Module . name == parsed_args . module <EOL> ) . order_by ( models . Project . name ) <EOL> return ( ( '<STR_LIT>' , ) , <EOL> ( ( r . project . name , ) for r in query . all ( ) ) ) </s>
