<s> """<STR_LIT>""" <EOL> from datetime import datetime <EOL> from django . core . management . base import BaseCommand <EOL> from optparse import make_option <EOL> from redistricting . models import * <EOL> from redistricting . utils import * <EOL> class Command ( BaseCommand ) : <EOL> """<STR_LIT>""" <EOL> args = None <EOL> help = '<STR_LIT>' <EOL> option_list = BaseCommand . option_list + ( <EOL> make_option ( '<STR_LIT>' , '<STR_LIT>' , dest = '<STR_LIT>' , default = None , type = '<STR_LIT:int>' , <EOL> action = '<STR_LIT:store>' , help = '<STR_LIT>' ) , <EOL> make_option ( '<STR_LIT>' , '<STR_LIT>' , dest = '<STR_LIT>' , default = False , <EOL> action = '<STR_LIT:store_true>' , help = '<STR_LIT>' ) , <EOL> make_option ( '<STR_LIT>' , '<STR_LIT>' , dest = '<STR_LIT>' , default = '<STR_LIT:index>' , <EOL> action = '<STR_LIT:store>' , help = "<STR_LIT>" ) , <EOL> ) <EOL> def handle ( self , * args , ** options ) : <EOL> """<STR_LIT>""" <EOL> verbosity = int ( options . get ( '<STR_LIT>' ) ) <EOL> plan_id = options . get ( '<STR_LIT>' ) <EOL> plans = [ Plan . objects . get ( pk = plan_id ) ] if plan_id else Plan . objects . all ( ) <EOL> if options . get ( "<STR_LIT>" ) : <EOL> plans = [ p for p in plans if p . is_shared ] <EOL> if verbosity > <NUM_LIT:0> : <EOL> self . stdout . write ( '<STR_LIT>' % ( len ( plans ) , datetime . now ( ) ) ) <EOL> for p in plans : <EOL> if verbosity > <NUM_LIT:0> : <EOL> self . stdout . write ( '<STR_LIT>' % ( p . id , p . name ) ) <EOL> if options . get ( '<STR_LIT>' ) == '<STR_LIT:index>' : <EOL> f = DistrictIndexFile . plan2index ( p ) <EOL> elif options . get ( '<STR_LIT>' ) == '<STR_LIT>' : <EOL> f = DistrictShapeFile . plan2shape ( p ) <EOL> if verbosity > <NUM_LIT:0> : <EOL> self . stdout . write ( '<STR_LIT>' % f . name ) <EOL> if verbosity > <NUM_LIT:0> : <EOL> self . stdout . write ( '<STR_LIT>' % ( datetime . now ( ) ) ) </s>
