<s> from django . core . management . base import BaseCommand <EOL> from recommends . tasks import recommends_precompute <EOL> from datetime import datetime <EOL> import dateutil . relativedelta <EOL> from optparse import make_option <EOL> import warnings <EOL> class Command ( BaseCommand ) : <EOL> help = '<STR_LIT>' <EOL> option_list = BaseCommand . option_list + ( <EOL> make_option ( '<STR_LIT>' , <EOL> action = '<STR_LIT:store_true>' , <EOL> dest = '<STR_LIT>' , <EOL> default = False , <EOL> help = '<STR_LIT>' <EOL> ) , <EOL> ) <EOL> def handle ( self , * args , ** options ) : <EOL> verbosity = int ( options . get ( '<STR_LIT>' , <NUM_LIT:0> ) ) <EOL> if options [ '<STR_LIT>' ] : <EOL> warnings . warn ( '<STR_LIT>' , PendingDeprecationWarning ) <EOL> verbosity = <NUM_LIT:1> <EOL> if verbosity == <NUM_LIT:0> : <EOL> recommends_precompute ( ) <EOL> else : <EOL> self . stdout . write ( "<STR_LIT>" ) <EOL> start_time = datetime . now ( ) <EOL> results = recommends_precompute ( ) <EOL> end_time = datetime . now ( ) <EOL> if verbosity > <NUM_LIT:1> : <EOL> for r in results : <EOL> self . stdout . write ( <EOL> "<STR_LIT>" <EOL> % ( r [ '<STR_LIT>' ] , r [ '<STR_LIT>' ] ) ) <EOL> rd = dateutil . relativedelta . relativedelta ( end_time , start_time ) <EOL> self . stdout . write ( <EOL> "<STR_LIT>" <EOL> % ( rd . years , rd . months , rd . days , rd . hours , rd . minutes , rd . seconds ) ) </s>
