#NEWLINE# @ classmethod #NEWLINE# def parse( cls , string ) : #NEWLINE# #INDENT# tzinfo = None #NEWLINE# if ( string == 'local' ) : #NEWLINE# #INDENT# tzinfo = tz . tzlocal ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( string in [ 'utc' , 'UTC' ] ) : #NEWLINE# #INDENT# tzinfo = tz . tzutc ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# iso_match = cls . _TZINFO_RE . match ( string ) #NEWLINE# if string : #NEWLINE# #INDENT# ( sign , hours , minutes ) = iso_match . groups ( ) #NEWLINE# if ( minutes is None ) : #NEWLINE# #INDENT# minutes = 0 #NEWLINE# #UNINDENT# seconds = ( ( int ( hours ) * 3600 ) + ( int ( minutes ) * 60 ) ) #NEWLINE# if ( sign == '-' ) : #NEWLINE# #INDENT# seconds *= ( - 1 ) #NEWLINE# #UNINDENT# tzinfo = tz . tzoffset ( None , seconds ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# tzinfo = tz . gettz ( string ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( tzinfo is None ) : #NEWLINE# #INDENT# raise ParserError ( 'Could not parse timezone expression "{0}"' , string ) #NEWLINE# #UNINDENT# return tzinfo