The Gaudi Framework  master (bb4415cc)
Loading...
Searching...
No Matches
GaudiConfig2.semantics._SetHelper Class Reference
Inheritance diagram for GaudiConfig2.semantics._SetHelper:
Collaboration diagram for GaudiConfig2.semantics._SetHelper:

Public Member Functions

 __init__ (self, semantics)
 data (self)
 __len__ (self)
 __contains__ (self, value)
 __eq__ (self, other)
 __iter__ (self)
 add (self, value)
 discard (self, value)
 pop (self)
 opt_value (self)
 __repr__ (self)

Public Attributes

 value_semantics = semantics
 default = set()
bool is_dirty = False
 data

Static Public Attributes

 union = MutableSet.__ior__
 update = MutableSet.__ior__
 intersection = MutableSet.__iand__
 difference = MutableSet.__isub__
 symmetric_difference = MutableSet.__ixor__

Protected Attributes

 _data = set()

Detailed Description

Definition at line 606 of file semantics.py.

Constructor & Destructor Documentation

◆ __init__()

GaudiConfig2.semantics._SetHelper.__init__ ( self,
semantics )

Definition at line 607 of file semantics.py.

607 def __init__(self, semantics):
608 self.value_semantics = semantics
609 self.default = set() # cannot use None due to the way __ior__ is implemented
610 self._data = set()
611 self.is_dirty = False
612

Member Function Documentation

◆ __contains__()

GaudiConfig2.semantics._SetHelper.__contains__ ( self,
value )

Definition at line 627 of file semantics.py.

627 def __contains__(self, value):
628 return self.value_semantics.store(value) in self.data
629

◆ __eq__()

GaudiConfig2.semantics._SetHelper.__eq__ ( self,
other )

Definition at line 630 of file semantics.py.

630 def __eq__(self, other):
631 return self.data == other
632

◆ __iter__()

GaudiConfig2.semantics._SetHelper.__iter__ ( self)

Definition at line 633 of file semantics.py.

633 def __iter__(self):
634 for value in self.data:
635 yield self.value_semantics.load(value)
636

◆ __len__()

GaudiConfig2.semantics._SetHelper.__len__ ( self)

Definition at line 624 of file semantics.py.

624 def __len__(self):
625 return len(self.data)
626

◆ __repr__()

GaudiConfig2.semantics._SetHelper.__repr__ ( self)

Definition at line 654 of file semantics.py.

654 def __repr__(self):
655 if self.data:
656 # sort into list but print as set to get reproducible repr
657 return "{" + repr(sorted(self.data))[1:-1] + "}"
658 else:
659 return "set()"
660
661

◆ add()

GaudiConfig2.semantics._SetHelper.add ( self,
value )

Definition at line 637 of file semantics.py.

637 def add(self, value):
638 self.is_dirty = True
639 self.data.add(self.value_semantics.store(value))
640

◆ data()

GaudiConfig2.semantics._SetHelper.data ( self)

Definition at line 621 of file semantics.py.

621 def data(self):
622 return self._data if self.is_dirty else self.default
623

◆ discard()

GaudiConfig2.semantics._SetHelper.discard ( self,
value )

Definition at line 641 of file semantics.py.

641 def discard(self, value):
642 if not self.is_dirty:
643 raise RuntimeError("cannot remove elements from the default value")
644 self.data.discard(value)
645

◆ opt_value()

GaudiConfig2.semantics._SetHelper.opt_value ( self)

Definition at line 651 of file semantics.py.

651 def opt_value(self):
652 return set(self.value_semantics.opt_value(item) for item in self.data)
653

◆ pop()

GaudiConfig2.semantics._SetHelper.pop ( self)

Definition at line 646 of file semantics.py.

646 def pop(self):
647 if not self.is_dirty:
648 raise RuntimeError("cannot remove elements from the default value")
649 return self.data.pop()
650

Member Data Documentation

◆ _data

GaudiConfig2.semantics._SetHelper._data = set()
protected

Definition at line 610 of file semantics.py.

◆ data

GaudiConfig2.semantics._SetHelper.data

Definition at line 625 of file semantics.py.

◆ default

GaudiConfig2.semantics._SetHelper.default = set()

Definition at line 609 of file semantics.py.

◆ difference

GaudiConfig2.semantics._SetHelper.difference = MutableSet.__isub__
static

Definition at line 617 of file semantics.py.

◆ intersection

GaudiConfig2.semantics._SetHelper.intersection = MutableSet.__iand__
static

Definition at line 616 of file semantics.py.

◆ is_dirty

bool GaudiConfig2.semantics._SetHelper.is_dirty = False

Definition at line 611 of file semantics.py.

◆ symmetric_difference

GaudiConfig2.semantics._SetHelper.symmetric_difference = MutableSet.__ixor__
static

Definition at line 618 of file semantics.py.

◆ union

GaudiConfig2.semantics._SetHelper.union = MutableSet.__ior__
static

Definition at line 614 of file semantics.py.

◆ update

GaudiConfig2.semantics._SetHelper.update = MutableSet.__ior__
static

Definition at line 615 of file semantics.py.

◆ value_semantics

GaudiConfig2.semantics._SetHelper.value_semantics = semantics

Definition at line 608 of file semantics.py.


The documentation for this class was generated from the following file: