def _create_dispatcher_class(cls, classname, bases, dict_):
 if hasattr(cls, 'dispatch'):
  dispatch_base = cls.dispatch.__class__
 else:
  dispatch_base = _Dispatch
 event_names = [k for k in dict_ if _is_event_name(k)]
 dispatch_cls = type(('%sDispatch' % classname), (dispatch_base,), {'__slots__': event_names})
 dispatch_cls._event_names = event_names
 dispatch_inst = cls._set_dispatch(cls, dispatch_cls)
 for k in dispatch_cls._event_names:
  setattr(dispatch_inst, k, _ClsLevelDispatch(cls, dict_[k]))
  _registrars[k].append(cls)
 for super_ in dispatch_cls.__bases__:
  if (issubclass(super_, _Dispatch) and (super_ is not _Dispatch)):
   for ls in super_._events.dispatch._event_descriptors:
    setattr(dispatch_inst, ls.name, ls)
    dispatch_cls._event_names.append(ls.name)
 if getattr(cls, '_dispatch_target', None):
  cls._dispatch_target.dispatch = dispatcher(cls)

def _create_dispatcher_class ( cls , classname , bases , dict_ ) : if hasattr ( cls , 'dispatch' ) : dispatch_base = cls . dispatch . __class__ else : dispatch_base = _Dispatch event_names = [ k for k in dict_ if _is_event_name ( k ) ] dispatch_cls = type ( ( '%sDispatch' % classname ) , ( dispatch_base , ) , { '__slots__' : event_names } ) dispatch_cls . _event_names = event_names dispatch_inst = cls . _set_dispatch ( cls , dispatch_cls ) for k in dispatch_cls . _event_names : setattr ( dispatch_inst , k , _ClsLevelDispatch ( cls , dict_ [ k ] ) ) _registrars [ k ] . append ( cls ) for super_ in dispatch_cls . __bases__ : if ( issubclass ( super_ , _Dispatch ) and ( super_ is not _Dispatch ) ) : for ls in super_ . _events . dispatch . _event_descriptors : setattr ( dispatch_inst , ls . name , ls ) dispatch_cls . _event_names . append ( ls . name ) if getattr ( cls , '_dispatch_target' , None ) : cls . _dispatch_target . dispatch = dispatcher ( cls )
create a :class: .