#NEWLINE# def pruner( self , ts , pruning , remove_javascript = True , printText = True ) : #NEWLINE# #INDENT# if remove_javascript : #NEWLINE# #INDENT# ts = self . removeJavascript ( leftover ) #NEWLINE# #UNINDENT# if pruning : #NEWLINE# #INDENT# leftover = [ ] #NEWLINE# done = [ ] #NEWLINE# for x in ts : #NEWLINE# #INDENT# notinit = True #NEWLINE# for y in ts : #NEWLINE# #INDENT# if ( ( x [ 1 ] in y [ 1 ] ) & ( y [ 1 ] != x [ 1 ] ) ) : #NEWLINE# #INDENT# notinit = False #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# if notinit : #NEWLINE# #INDENT# leftover . append ( x ) #NEWLINE# #UNINDENT# #UNINDENT# ts = leftover #NEWLINE# #UNINDENT# if printText : #NEWLINE# #INDENT# if ( 'bs4' in ts [ 0 ] [ 0 ] . __module__ ) : #NEWLINE# #INDENT# return [ x [ 0 ] . text for x in ts ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return [ x [ 0 ] . text_content ( ) for x in ts ] #NEWLINE# #UNINDENT# #UNINDENT# return ts