<s> from datetime import tzinfo , timedelta , datetime <EOL> ZERO = timedelta ( <NUM_LIT:0> ) <EOL> HOUR = timedelta ( hours = <NUM_LIT:1> ) <EOL> def first_sunday_on_or_after ( dt ) : <EOL> days_to_go = <NUM_LIT:6> - dt . weekday ( ) <EOL> if days_to_go : <EOL> dt += timedelta ( days_to_go ) <EOL> return dt <EOL> DSTSTART_2007 = datetime ( <NUM_LIT:1> , <NUM_LIT:3> , <NUM_LIT:8> , <NUM_LIT:2> ) <EOL> DSTEND_2007 = datetime ( <NUM_LIT:1> , <NUM_LIT:11> , <NUM_LIT:1> , <NUM_LIT:1> ) <EOL> DSTSTART_1987_2006 = datetime ( <NUM_LIT:1> , <NUM_LIT:4> , <NUM_LIT:1> , <NUM_LIT:2> ) <EOL> DSTEND_1987_2006 = datetime ( <NUM_LIT:1> , <NUM_LIT:10> , <NUM_LIT> , <NUM_LIT:1> ) <EOL> DSTSTART_1967_1986 = datetime ( <NUM_LIT:1> , <NUM_LIT:4> , <NUM_LIT> , <NUM_LIT:2> ) <EOL> DSTEND_1967_1986 = DSTEND_1987_2006 <EOL> class USTimeZone ( tzinfo ) : <EOL> def __init__ ( self , hours , reprname , stdname , dstname ) : <EOL> self . stdoffset = timedelta ( hours = hours ) <EOL> self . reprname = reprname <EOL> self . stdname = stdname <EOL> self . dstname = dstname <EOL> def __repr__ ( self ) : <EOL> return self . reprname <EOL> def tzname ( self , dt ) : <EOL> if self . dst ( dt ) : <EOL> return self . dstname <EOL> else : <EOL> return self . stdname <EOL> def utcoffset ( self , dt ) : <EOL> return self . stdoffset + self . dst ( dt ) <EOL> def dst ( self , dt ) : <EOL> if dt is None or dt . tzinfo is None : <EOL> return ZERO <EOL> assert dt . tzinfo is self <EOL> if <NUM_LIT> < dt . year : <EOL> dststart , dstend = DSTSTART_2007 , DSTEND_2007 <EOL> elif <NUM_LIT> < dt . year < <NUM_LIT> : <EOL> dststart , dstend = DSTSTART_1987_2006 , DSTEND_1986_2006 <EOL> elif <NUM_LIT> < dt . year < <NUM_LIT> : <EOL> dststart , dstend = DSTSTART_1967_1986 , DSTEND_1967_1986 <EOL> else : <EOL> return ZERO <EOL> start = first_sunday_on_or_after ( dststart . replace ( year = dt . year ) ) <EOL> end = first_sunday_on_or_after ( dstend . replace ( year = dt . year ) ) <EOL> if start <= dt . replace ( tzinfo = None ) < end : <EOL> return HOUR <EOL> else : <EOL> return ZERO <EOL> Pacific = USTimeZone ( - <NUM_LIT:8> , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) <EOL> def now ( ) : <EOL> return datetime . now ( Pacific ) . replace ( tzinfo = None ) <EOL> def asPacific ( dt ) : <EOL> return dt . astimezone ( Pacific ) </s>
