The Gaudi Framework  master (ff829712)
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 470 of file semantics.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 471 of file semantics.py.

471 def __init__(self, semantics):
472 self.value_semantics = semantics
473 self.default = set() # cannot use None due to the way __ior__ is implemented
474 self._data = set()
475 self.is_dirty = False
476

Member Function Documentation

◆ __contains__()

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

Definition at line 491 of file semantics.py.

491 def __contains__(self, value):
492 return self.value_semantics.store(value) in self.data
493

◆ __eq__()

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

Definition at line 494 of file semantics.py.

494 def __eq__(self, other):
495 return self.data == other
496

◆ __iter__()

GaudiConfig2.semantics._SetHelper.__iter__ ( self)

Definition at line 497 of file semantics.py.

497 def __iter__(self):
498 for value in self.data:
499 yield self.value_semantics.load(value)
500

◆ __len__()

GaudiConfig2.semantics._SetHelper.__len__ ( self)

Definition at line 488 of file semantics.py.

488 def __len__(self):
489 return len(self.data)
490

◆ __repr__()

GaudiConfig2.semantics._SetHelper.__repr__ ( self)

Definition at line 518 of file semantics.py.

518 def __repr__(self):
519 if self.data:
520 # sort into list but print as set to get reproducible repr
521 return "{" + repr(sorted(self.data))[1:-1] + "}"
522 else:
523 return "set()"
524
525

◆ add()

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

Definition at line 501 of file semantics.py.

501 def add(self, value):
502 self.is_dirty = True
503 self.data.add(self.value_semantics.store(value))
504

◆ data()

GaudiConfig2.semantics._SetHelper.data ( self)

Definition at line 485 of file semantics.py.

485 def data(self):
486 return self._data if self.is_dirty else self.default
487

◆ discard()

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

Definition at line 505 of file semantics.py.

505 def discard(self, value):
506 if not self.is_dirty:
507 raise RuntimeError("cannot remove elements from the default value")
508 self.data.discard(value)
509

◆ opt_value()

GaudiConfig2.semantics._SetHelper.opt_value ( self)

Definition at line 515 of file semantics.py.

515 def opt_value(self):
516 return set(self.value_semantics.opt_value(item) for item in self.data)
517

◆ pop()

GaudiConfig2.semantics._SetHelper.pop ( self)

Definition at line 510 of file semantics.py.

510 def pop(self):
511 if not self.is_dirty:
512 raise RuntimeError("cannot remove elements from the default value")
513 return self.data.pop()
514

Member Data Documentation

◆ _data

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

Definition at line 474 of file semantics.py.

◆ data

GaudiConfig2.semantics._SetHelper.data

Definition at line 489 of file semantics.py.

◆ default

GaudiConfig2.semantics._SetHelper.default = set()

Definition at line 473 of file semantics.py.

◆ difference

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

Definition at line 481 of file semantics.py.

◆ intersection

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

Definition at line 480 of file semantics.py.

◆ is_dirty

bool GaudiConfig2.semantics._SetHelper.is_dirty = False

Definition at line 475 of file semantics.py.

◆ symmetric_difference

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

Definition at line 482 of file semantics.py.

◆ union

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

Definition at line 478 of file semantics.py.

◆ update

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

Definition at line 479 of file semantics.py.

◆ value_semantics

GaudiConfig2.semantics._SetHelper.value_semantics = semantics

Definition at line 472 of file semantics.py.


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