#NEWLINE# def _create_dispatcher_class( cls , classname , bases , dict_ ) : #NEWLINE# #INDENT# 'Create a :class:`._Dispatch` class corresponding to an\n    :class:`.Events` class.' #NEWLINE# dispatch_base = getattr ( cls , 'dispatch' , _Dispatch ) #NEWLINE# dispatch_cls = type ( ( '%sDispatch' % k ) , ( dispatch_base , ) , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# cls . _set_dispatch ( cls , dispatch_cls ) #NEWLINE# for k in dict_ : #NEWLINE# #INDENT# if _is_event_name ( k ) : #NEWLINE# #INDENT# setattr ( dispatch_cls , k , _DispatchDescriptor ( cls , dict_ [ k ] ) ) #NEWLINE# _registrars [ k ] . append ( cls ) #NEWLINE# #UNINDENT# #UNINDENT# if getattr ( cls , '_dispatch_target' , None ) : #NEWLINE# #INDENT# cls . _dispatch_target . dispatch = dispatcher ( cls )