<s> from __future__ import unicode_literals <EOL> from datetime import timedelta <EOL> from django . conf import settings <EOL> from django . utils import timezone <EOL> try : <EOL> from django . core . management . base import BaseCommand <EOL> except ImportError : <EOL> from django . core . management . base import NoArgsCommand as BaseCommand <EOL> from hitcount . models import Hit <EOL> class Command ( BaseCommand ) : <EOL> help = "<STR_LIT>" <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> super ( Command , self ) . __init__ ( * args , ** kwargs ) <EOL> def handle ( self , * args , ** kwargs ) : <EOL> self . handle_noargs ( ) <EOL> def handle_noargs ( self , ** options ) : <EOL> grace = getattr ( settings , '<STR_LIT>' , { '<STR_LIT>' : <NUM_LIT:30> } ) <EOL> period = timezone . now ( ) - timedelta ( ** grace ) <EOL> qs = Hit . objects . filter ( created__lt = period ) <EOL> number_removed = len ( qs ) <EOL> qs . delete ( ) <EOL> self . stdout . write ( '<STR_LIT>' % number_removed ) </s>
