<s> from copy import deepcopy <EOL> class LDAPAttributeSet ( set ) : <EOL> def __init__ ( self , key , * a , ** kw ) : <EOL> self . key = key <EOL> super ( LDAPAttributeSet , self ) . __init__ ( * a , ** kw ) <EOL> def __repr__ ( self ) : <EOL> values = list ( self ) <EOL> values . sort ( ) <EOL> attributes = '<STR_LIT:U+002CU+0020>' . join ( [ repr ( x ) for x in values ] ) <EOL> return '<STR_LIT>' % ( <EOL> self . __class__ . __name__ , <EOL> self . key , <EOL> attributes ) <EOL> def __eq__ ( self , other ) : <EOL> """<STR_LIT>""" <EOL> if isinstance ( other , LDAPAttributeSet ) : <EOL> if self . key != other . key : <EOL> return False <EOL> return super ( LDAPAttributeSet , self ) . __eq__ ( other ) <EOL> else : <EOL> me = list ( self ) <EOL> me . sort ( ) <EOL> him = list ( other ) <EOL> him . sort ( ) <EOL> return me == him <EOL> def __ne__ ( self , other ) : <EOL> return not self == other <EOL> def difference ( self , other ) : <EOL> return set ( self ) - set ( other ) <EOL> def union ( self , other ) : <EOL> return set ( self ) | set ( other ) <EOL> def intersection ( self , other ) : <EOL> return set ( self ) & set ( other ) <EOL> def symmetric_difference ( self , other ) : <EOL> return set ( self ) ^ set ( other ) <EOL> def copy ( self ) : <EOL> result = self . __class__ ( self . key ) <EOL> result . update ( self ) <EOL> return result <EOL> __copy__ = copy <EOL> def __deepcopy__ ( self , memo ) : <EOL> result = self . __class__ ( self . key ) <EOL> memo [ id ( self ) ] = result <EOL> data = deepcopy ( set ( self ) , memo ) <EOL> result . update ( data ) <EOL> return result </s>
