def _set_collection_attributes(cls, roles, methods):
 for (method_name, (before, argument, after)) in methods.items():
  setattr(cls, method_name, _instrument_membership_mutator(getattr(cls, method_name), before, argument, after))
 for (role, method_name) in roles.items():
  setattr(cls, ('_sa_%s' % role), getattr(cls, method_name))
 cls._sa_adapter = None
 if (not hasattr(cls, '_sa_converter')):
  cls._sa_converter = None
 cls._sa_instrumented = id(cls)

def _set_collection_attributes ( cls , roles , methods ) : for ( method_name , ( before , argument , after ) ) in methods . items ( ) : setattr ( cls , method_name , _instrument_membership_mutator ( getattr ( cls , method_name ) , before , argument , after ) ) for ( role , method_name ) in roles . items ( ) : setattr ( cls , ( '_sa_%s' % role ) , getattr ( cls , method_name ) ) cls . _sa_adapter = None if ( not hasattr ( cls , '_sa_converter' ) ) : cls . _sa_converter = None cls . _sa_instrumented = id ( cls )
apply ad-hoc instrumentation from decorators .