#NEWLINE# def same_desctype_as_sibling( self , node , direction ) : #NEWLINE# #INDENT# idx = node . parent . index ( node ) #NEWLINE# if ( direction == 'next' ) : #NEWLINE# #INDENT# limit = len ( node . parent ) #NEWLINE# idx += 1 #NEWLINE# while ( idx < limit ) : #NEWLINE# #INDENT# if ( not isinstance ( node . parent [ idx ] , addnodes . index ) ) : #NEWLINE# #INDENT# sib = node . parent [ idx ] #NEWLINE# break #NEWLINE# #UNINDENT# idx += 1 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( direction == 'prev' ) : #NEWLINE# #INDENT# limit = ( - 1 ) #NEWLINE# idx -= 1 #NEWLINE# while ( idx > limit ) : #NEWLINE# #INDENT# if ( not isinstance ( node . parent [ idx ] , addnodes . index ) ) : #NEWLINE# #INDENT# sib = node . parent [ idx ] #NEWLINE# break #NEWLINE# #UNINDENT# idx -= 1 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# raise RuntimeError ( ( "invalid 'direction' argument %s" % repr ( direction ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# if ( not isinstance ( sib , type ( node ) ) ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# return ( sib [ 'objtype' ] == node [ 'objtype' ] )