<s> "<STR_LIT>" <EOL> from __future__ import unicode_literals <EOL> import time <EOL> from datetime import timedelta , tzinfo <EOL> from django . utils . encoding import force_str , force_text , DEFAULT_LOCALE_ENCODING <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> sign = '<STR_LIT:->' if offset < <NUM_LIT:0> else '<STR_LIT:+>' <EOL> self . __name = "<STR_LIT>" % ( sign , abs ( offset ) / <NUM_LIT> , abs ( offset ) % <NUM_LIT> ) <EOL> def __repr__ ( self ) : <EOL> return self . __name <EOL> def __getinitargs__ ( self ) : <EOL> return self . __offset , <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 . __dt = dt <EOL> self . _tzname = self . tzname ( dt ) <EOL> def __repr__ ( self ) : <EOL> return force_str ( self . _tzname ) <EOL> def __getinitargs__ ( self ) : <EOL> return self . __dt , <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 force_text ( time . tzname [ self . _isdst ( dt ) ] , <EOL> DEFAULT_LOCALE_ENCODING ) <EOL> except UnicodeDecodeError : <EOL> return None <EOL> def _isdst ( self , dt ) : <EOL> tt = ( dt . year , dt . month , dt . day , <EOL> dt . hour , dt . minute , dt . second , <EOL> dt . weekday ( ) , <NUM_LIT:0> , <NUM_LIT:0> ) <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>
