<s> """<STR_LIT>""" <EOL> import re <EOL> from django . core . management import get_commands , execute_from_command_line <EOL> from django . core . management . base import BaseCommand , CommandError <EOL> from django . core . management . color import color_style <EOL> from django . utils import six <EOL> def get_filtered_commands ( * filters ) : <EOL> filters_re = re . compile ( "<STR_LIT:|>" . join ( filters ) ) <EOL> for command , app in six . iteritems ( get_commands ( ) ) : <EOL> if filters_re . search ( app ) : <EOL> yield app , command <EOL> class Command ( BaseCommand ) : <EOL> args = '<STR_LIT>' <EOL> help = __doc__ <EOL> def handle ( self , * filters , ** options ) : <EOL> if filters : <EOL> style = color_style ( ) <EOL> output = set ( ) <EOL> for app , command in get_filtered_commands ( * filters ) : <EOL> if app not in output : <EOL> self . stdout . write ( style . NOTICE ( "<STR_LIT>" . format ( app ) ) ) <EOL> output . add ( app ) <EOL> self . stdout . write ( "<STR_LIT>" . format ( command ) ) <EOL> else : <EOL> execute_from_command_line ( [ "<STR_LIT>" ] ) </s>
