#NEWLINE# def should_be_compact_paragraph( self , node ) : #NEWLINE# #INDENT# '\n        Determine if the <p> tags around paragraph ``node`` can be omitted.\n        ' #NEWLINE# if ( isinstance ( node . parent , nodes . document ) or isinstance ( node . parent , nodes . compound ) ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# for ( key , value ) in node . attlist ( ) : #NEWLINE# #INDENT# if ( node . is_not_default ( key ) and ( not ( ( key == 'classes' ) and ( value in ( [ ] , [ 'first' ] , [ 'last' ] , [ 'first' , 'last' ] ) ) ) ) ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# #UNINDENT# first = isinstance ( node . parent [ 0 ] , nodes . label ) #NEWLINE# for child in node . parent . children [ first : ] : #NEWLINE# #INDENT# if isinstance ( child , nodes . Invisible ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# if ( child is node ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# return False #NEWLINE# #UNINDENT# parent_length = len ( [ n for n in parent_length . parent if ( not isinstance ( n , ( nodes . Invisible , nodes . label ) ) ) ] ) #NEWLINE# if ( self . compact_simple or self . compact_field_list or ( self . compact_p and ( parent_length == 1 ) ) ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# return False