<s> """<STR_LIT>""" <EOL> from __future__ import absolute_import <EOL> from . . import util , exc <EOL> from . base import _registrars <EOL> from . registry import _EventKey <EOL> CANCEL = util . symbol ( '<STR_LIT>' ) <EOL> NO_RETVAL = util . symbol ( '<STR_LIT>' ) <EOL> def _event_key ( target , identifier , fn ) : <EOL> for evt_cls in _registrars [ identifier ] : <EOL> tgt = evt_cls . _accept_with ( target ) <EOL> if tgt is not None : <EOL> return _EventKey ( target , identifier , fn , tgt ) <EOL> else : <EOL> raise exc . InvalidRequestError ( "<STR_LIT>" % <EOL> ( identifier , target ) ) <EOL> def listen ( target , identifier , fn , * args , ** kw ) : <EOL> """<STR_LIT>""" <EOL> _event_key ( target , identifier , fn ) . listen ( * args , ** kw ) <EOL> def listens_for ( target , identifier , * args , ** kw ) : <EOL> """<STR_LIT>""" <EOL> def decorate ( fn ) : <EOL> listen ( target , identifier , fn , * args , ** kw ) <EOL> return fn <EOL> return decorate <EOL> def remove ( target , identifier , fn ) : <EOL> """<STR_LIT>""" <EOL> _event_key ( target , identifier , fn ) . remove ( ) <EOL> def contains ( target , identifier , fn ) : <EOL> """<STR_LIT>""" <EOL> return _event_key ( target , identifier , fn ) . contains ( ) </s>
