<s> from pikos . _internal . keep_track import KeepTrack <EOL> from pikos . _internal . function_set import FunctionSet <EOL> from pikos . _internal . attach_decorators import advanced_attach <EOL> class FocusedFunctionMixin ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , * arguments , ** keywords ) : <EOL> """<STR_LIT>""" <EOL> functions = keywords . pop ( '<STR_LIT>' , ( ) ) <EOL> super ( FocusedFunctionMixin , self ) . __init__ ( * arguments , ** keywords ) <EOL> self . functions = FunctionSet ( functions ) <EOL> self . _code_trackers = { } <EOL> def on_function_event ( self , frame , event , arg ) : <EOL> """<STR_LIT>""" <EOL> if self . _tracker_check ( frame , event ) : <EOL> super ( FocusedFunctionMixin , self ) . on_function_event ( <EOL> frame , event , arg ) <EOL> def _tracker_check ( self , frame , event ) : <EOL> """<STR_LIT>""" <EOL> code = frame . f_code <EOL> if code in self . functions : <EOL> tracker = self . _code_trackers . setdefault ( code , KeepTrack ( ) ) <EOL> if event == '<STR_LIT>' : <EOL> tracker ( '<STR_LIT>' ) <EOL> else : <EOL> tracker ( '<STR_LIT>' ) <EOL> if not tracker : <EOL> del self . _code_trackers [ code ] <EOL> return True <EOL> return any ( self . _code_trackers . itervalues ( ) ) <EOL> attach = advanced_attach </s>
