#NEWLINE# def _offset_str( self ) : #NEWLINE# #INDENT# def get_str( td ) : #NEWLINE# #INDENT# off_str = '' #NEWLINE# if ( td . days > 0 ) : #NEWLINE# #INDENT# off_str += ( str ( td . days ) + 'D' ) #NEWLINE# #UNINDENT# if ( td . seconds > 0 ) : #NEWLINE# #INDENT# s = td . seconds #NEWLINE# hrs = int ( ( s / 3600 ) ) #NEWLINE# if ( hrs != 0 ) : #NEWLINE# #INDENT# off_str += ( str ( hrs ) + 'H' ) #NEWLINE# s -= ( hrs * 3600 ) #NEWLINE# #UNINDENT# mts = int ( ( s / 60 ) ) #NEWLINE# if ( mts != 0 ) : #NEWLINE# #INDENT# off_str += ( str ( mts ) + 'Min' ) #NEWLINE# s -= ( mts * 60 ) #NEWLINE# #UNINDENT# if ( s != 0 ) : #NEWLINE# #INDENT# off_str += ( str ( s ) + 's' ) #NEWLINE# #UNINDENT# #UNINDENT# if ( td . microseconds > 0 ) : #NEWLINE# #INDENT# off_str += ( str ( td . microseconds ) + 'us' ) #NEWLINE# #UNINDENT# return off_str #NEWLINE# #UNINDENT# if isinstance ( off_str . offset , timedelta ) : #NEWLINE# #INDENT# zero = timedelta ( 0 , 0 , 0 ) #NEWLINE# if ( self . offset >= zero ) : #NEWLINE# #INDENT# off_str = ( '+' + get_str ( self . offset ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# off_str = ( '-' + get_str ( ( - self . offset ) ) ) #NEWLINE# #UNINDENT# return off_str #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return ( '+' + repr ( self . offset ) )