original_docstring: Clone a list of principals.
  
      :param cls: the principal type to use (a `PrincipalMixin` subclass)
      :param principals: a collection of these principals
      :param event_role_map: the mapping from old to new event roles.
                             if omitted, event roles are skipped
      :param regform_map: if omitted, registration forms are skipped
      :return: A new set of principals that can be added to an object
      
docstring: Clone a list of principals.
docstring_tokens: Clone a list of principals .
code: def clone_principals(cls, principals, event_role_map=None, regform_map=None):
      """Clone a list of principals.
  
      :param cls: the principal type to use (a `PrincipalMixin` subclass)
      :param principals: a collection of these principals
      :param event_role_map: the mapping from old to new event roles.
                             if omitted, event roles are skipped
      :param regform_map: if omitted, registration forms are skipped
      :return: A new set of principals that can be added to an object
      """
      rv = set()
      assert all(isinstance(x, cls) for x in principals)
      attrs = get_simple_column_attrs(cls) | {'user', 'local_group', 'ip_network_group', 'category_role'}
      for old_principal in principals:
          event_role = None
          registration_form = None
          if old_principal.type == PrincipalType.event_role:
              if event_role_map is None:
                  continue
              event_role = event_role_map[old_principal.event_role]
          elif old_principal.type == PrincipalType.registration_form:
              if regform_map is None:
                  continue
              registration_form = regform_map[old_principal.registration_form]
          principal = cls()
          principal.populate_from_dict({attr: getattr(old_principal, attr) for attr in attrs})
          if event_role:
              principal.event_role = event_role
          elif registration_form:
              principal.registration_form = registration_form
          rv.add(principal)
      return rv
code_tokens: def clone_principals ( cls , principals , event_role_map = None , regform_map = None ) : rv = set ( ) assert all ( isinstance ( x , cls ) for x in principals ) attrs = get_simple_column_attrs ( cls ) | { 'user' , 'local_group' , 'ip_network_group' , 'category_role' } for old_principal in principals : event_role = None registration_form = None if old_principal . type == PrincipalType . event_role : if event_role_map is None : continue event_role = event_role_map [ old_principal . event_role ] elif old_principal . type == PrincipalType . registration_form : if regform_map is None : continue registration_form = regform_map [ old_principal . registration_form ] principal = cls ( ) principal . populate_from_dict ( { attr : getattr ( old_principal , attr ) for attr in attrs } ) if event_role : principal . event_role = event_role elif registration_form : principal . registration_form = registration_form rv . add ( principal ) return rv
short_docstring: Clone a list of principals.
short_docstring_tokens: Clone a list of principals .
comment: """Clone a list of principals.
  
      :param cls: the principal type to use (a `PrincipalMixin` subclass)
      :param principals: a collection of these principals
      :param event_role_map: the mapping from old to new event roles.
                             if omitted, event roles are skipped
      :param regform_map: if omitted, registration forms are skipped
      :return: A new set of principals that can be added to an object
      """