<s> """<STR_LIT>""" <EOL> import logging <EOL> from pyqode . core . api . manager import Manager <EOL> def _logger ( ) : <EOL> return logging . getLogger ( __name__ ) <EOL> class TextDecorationsManager ( Manager ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , editor ) : <EOL> super ( TextDecorationsManager , self ) . __init__ ( editor ) <EOL> self . _decorations = [ ] <EOL> def append ( self , decoration ) : <EOL> """<STR_LIT>""" <EOL> if decoration not in self . _decorations : <EOL> self . _decorations . append ( decoration ) <EOL> self . _decorations = sorted ( <EOL> self . _decorations , key = lambda sel : sel . draw_order ) <EOL> self . editor . setExtraSelections ( self . _decorations ) <EOL> return True <EOL> return False <EOL> def remove ( self , decoration ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> self . _decorations . remove ( decoration ) <EOL> self . editor . setExtraSelections ( self . _decorations ) <EOL> return True <EOL> except ValueError : <EOL> return False <EOL> def clear ( self ) : <EOL> """<STR_LIT>""" <EOL> self . _decorations [ : ] = [ ] <EOL> try : <EOL> self . editor . setExtraSelections ( self . _decorations ) <EOL> except RuntimeError : <EOL> pass <EOL> def __iter__ ( self ) : <EOL> return iter ( self . _decorations ) <EOL> def __len__ ( self ) : <EOL> return len ( self . _decorations ) </s>
