def _setup_canned_roles(cls, roles, methods):
 collection_type = util.duck_type_collection(cls)
 if (collection_type in __interfaces):
  (canned_roles, decorators) = __interfaces[collection_type]
  for (role, name) in canned_roles.items():
   roles.setdefault(role, name)
  for (method, decorator) in decorators.items():
   fn = getattr(cls, method, None)
   if (fn and (method not in methods) and (not hasattr(fn, '_sa_instrumented'))):
    setattr(cls, method, decorator(fn))

def _setup_canned_roles ( cls , roles , methods ) : collection_type = util . duck_type_collection ( cls ) if ( collection_type in __interfaces ) : ( canned_roles , decorators ) = __interfaces [ collection_type ] for ( role , name ) in canned_roles . items ( ) : roles . setdefault ( role , name ) for ( method , decorator ) in decorators . items ( ) : fn = getattr ( cls , method , None ) if ( fn and ( method not in methods ) and ( not hasattr ( fn , '_sa_instrumented' ) ) ) : setattr ( cls , method , decorator ( fn ) )
see if this class has "canned" roles based on a known collection type .