<s> "<STR_LIT>" <EOL> import locale <EOL> import time <EOL> from datetime import timedelta , tzinfo <EOL> from django . utils . encoding import smart_unicode <EOL> try : <EOL> DEFAULT_ENCODING = locale . getdefaultlocale ( ) [ <NUM_LIT:1> ] or '<STR_LIT:ascii>' <EOL> except : <EOL> DEFAULT_ENCODING = '<STR_LIT:ascii>' <EOL> class FixedOffset ( tzinfo ) : <EOL> "<STR_LIT>" <EOL> def __init__ ( self , offset ) : <EOL> if isinstance ( offset , timedelta ) : <EOL> self . __offset = offset <EOL> offset = self . __offset . seconds // <NUM_LIT> <EOL> else : <EOL> self . __offset = timedelta ( minutes = offset ) <EOL> self . __name = u"<STR_LIT>" % ( offset / <NUM_LIT> , offset % <NUM_LIT> ) <EOL> def __repr__ ( self ) : <EOL> return self . __name <EOL> def utcoffset ( self , dt ) : <EOL> return self . __offset <EOL> def tzname ( self , dt ) : <EOL> return self . __name <EOL> def dst ( self , dt ) : <EOL> return timedelta ( <NUM_LIT:0> ) <EOL> class LocalTimezone ( tzinfo ) : <EOL> "<STR_LIT>" <EOL> def __init__ ( self , dt ) : <EOL> tzinfo . __init__ ( self ) <EOL> self . _tzname = self . tzname ( dt ) <EOL> def __repr__ ( self ) : <EOL> return self . _tzname <EOL> def utcoffset ( self , dt ) : <EOL> if self . _isdst ( dt ) : <EOL> return timedelta ( seconds = - time . altzone ) <EOL> else : <EOL> return timedelta ( seconds = - time . timezone ) <EOL> def dst ( self , dt ) : <EOL> if self . _isdst ( dt ) : <EOL> return timedelta ( seconds = - time . altzone ) - timedelta ( seconds = - time . timezone ) <EOL> else : <EOL> return timedelta ( <NUM_LIT:0> ) <EOL> def tzname ( self , dt ) : <EOL> try : <EOL> return smart_unicode ( time . tzname [ self . _isdst ( dt ) ] , DEFAULT_ENCODING ) <EOL> except UnicodeDecodeError : <EOL> return None <EOL> def _isdst ( self , dt ) : <EOL> tt = ( dt . year , dt . month , dt . day , dt . hour , dt . minute , dt . second , dt . weekday ( ) , <NUM_LIT:0> , - <NUM_LIT:1> ) <EOL> try : <EOL> stamp = time . mktime ( tt ) <EOL> except ( OverflowError , ValueError ) : <EOL> tt = ( <NUM_LIT> , ) + tt [ <NUM_LIT:1> : ] <EOL> stamp = time . mktime ( tt ) <EOL> tt = time . localtime ( stamp ) <EOL> return tt . tm_isdst > <NUM_LIT:0> </s>
