#NEWLINE# @ classmethod #NEWLINE# def collapse_element( cls , overlay , key = None , ranges = None , mode = 'data' ) : #NEWLINE# #INDENT# '\n        Finds any applicable compositor and applies it.\n        ' #NEWLINE# from . overlay import Overlay #NEWLINE# match = cls . strongest_match ( overlay , values ) #NEWLINE# if ( match is None ) : #NEWLINE# #INDENT# return overlay #NEWLINE# #UNINDENT# ( _ , applicable_op , ( start , stop ) ) = match #NEWLINE# values = overlay . values ( ) #NEWLINE# sliced = Overlay . from_values ( values [ start : stop ] ) #NEWLINE# result = applicable_op . apply ( sliced , ranges , key = key ) #NEWLINE# result = result . relabel ( group = applicable_op . group ) #NEWLINE# output = Overlay . from_values ( ( ( values [ : start ] + [ result ] ) + values [ stop : ] ) ) #NEWLINE# output . id = overlay . id #NEWLINE# return output