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

Public Member Functions

 __init__ (self, key_semantics, value_semantics)
 data (self)
 __len__ (self)
 __getitem__ (self, key)
 __setitem__ (self, key, value)
 __delitem__ (self, key)
 __iter__ (self)
 keys (self)
 items (self)
 values (self)
 __contains__ (self, key)
 get (self, key, default=None)
 update (self, otherMap)
 opt_value (self)
 __repr__ (self)

Public Attributes

 key_semantics = key_semantics
 value_semantics = value_semantics
 default = None
bool is_dirty = False
 data

Protected Attributes

dict _data = {}

Detailed Description

Definition at line 734 of file semantics.py.

Constructor & Destructor Documentation

◆ __init__()

GaudiConfig2.semantics._DictHelper.__init__ ( self,
key_semantics,
value_semantics )

Definition at line 735 of file semantics.py.

735 def __init__(self, key_semantics, value_semantics):
736 self.key_semantics = key_semantics
737 self.value_semantics = value_semantics
738 self.default = None
739 self._data = {}
740 self.is_dirty = False
741

Member Function Documentation

◆ __contains__()

GaudiConfig2.semantics._DictHelper.__contains__ ( self,
key )

Definition at line 780 of file semantics.py.

780 def __contains__(self, key):
781 return self.key_semantics.store(key) in self.data
782

◆ __delitem__()

GaudiConfig2.semantics._DictHelper.__delitem__ ( self,
key )

Definition at line 760 of file semantics.py.

760 def __delitem__(self, key):
761 if not self.is_dirty:
762 raise RuntimeError("cannot remove elements from the default value")
763 self.data.__delitem__(self.key_semantics.store(key))
764

◆ __getitem__()

GaudiConfig2.semantics._DictHelper.__getitem__ ( self,
key )

Definition at line 749 of file semantics.py.

749 def __getitem__(self, key):
750 return self.value_semantics.load(
751 self.data.__getitem__(self.key_semantics.store(key))
752 )
753

◆ __iter__()

GaudiConfig2.semantics._DictHelper.__iter__ ( self)

Definition at line 765 of file semantics.py.

765 def __iter__(self):
766 for key in self.data:
767 yield self.key_semantics.load(key)
768

◆ __len__()

GaudiConfig2.semantics._DictHelper.__len__ ( self)

Definition at line 746 of file semantics.py.

746 def __len__(self):
747 return len(self.data)
748

◆ __repr__()

GaudiConfig2.semantics._DictHelper.__repr__ ( self)

Definition at line 803 of file semantics.py.

803 def __repr__(self):
804 return repr(self.data)
805
806

◆ __setitem__()

GaudiConfig2.semantics._DictHelper.__setitem__ ( self,
key,
value )

Definition at line 754 of file semantics.py.

754 def __setitem__(self, key, value):
755 self.is_dirty = True
756 self.data.__setitem__(
757 self.key_semantics.store(key), self.value_semantics.store(value)
758 )
759

◆ data()

GaudiConfig2.semantics._DictHelper.data ( self)

Definition at line 743 of file semantics.py.

743 def data(self):
744 return self._data if self.is_dirty else self.default
745

◆ get()

GaudiConfig2.semantics._DictHelper.get ( self,
key,
default = None )

Definition at line 783 of file semantics.py.

783 def get(self, key, default=None):
784 key = self.key_semantics.store(key)
785 if key in self.data:
786 return self.value_semantics.load(self.data[key])
787 return default
788

◆ items()

GaudiConfig2.semantics._DictHelper.items ( self)

Definition at line 772 of file semantics.py.

772 def items(self):
773 for key, value in self.data.items():
774 yield (self.key_semantics.load(key), self.value_semantics.load(value))
775

◆ keys()

GaudiConfig2.semantics._DictHelper.keys ( self)

Definition at line 769 of file semantics.py.

769 def keys(self):
770 return list(self)
771

◆ opt_value()

GaudiConfig2.semantics._DictHelper.opt_value ( self)

Definition at line 797 of file semantics.py.

797 def opt_value(self):
798 return {
799 self.key_semantics.opt_value(key): self.value_semantics.opt_value(value)
800 for key, value in self.data.items()
801 }
802

◆ update()

GaudiConfig2.semantics._DictHelper.update ( self,
otherMap )

Definition at line 792 of file semantics.py.

792 def update(self, otherMap):
793 self.is_dirty = True
794 for key, value in otherMap.items():
795 self.data[self.key_semantics.store(key)] = self.value_semantics.store(value)
796

◆ values()

GaudiConfig2.semantics._DictHelper.values ( self)

Definition at line 776 of file semantics.py.

776 def values(self):
777 for value in self.data.values():
778 yield self.value_semantics.load(value)
779

Member Data Documentation

◆ _data

dict GaudiConfig2.semantics._DictHelper._data = {}
protected

Definition at line 739 of file semantics.py.

◆ data

GaudiConfig2.semantics._DictHelper.data

Definition at line 747 of file semantics.py.

◆ default

GaudiConfig2.semantics._DictHelper.default = None

Definition at line 738 of file semantics.py.

◆ is_dirty

bool GaudiConfig2.semantics._DictHelper.is_dirty = False

Definition at line 740 of file semantics.py.

◆ key_semantics

GaudiConfig2.semantics._DictHelper.key_semantics = key_semantics

Definition at line 736 of file semantics.py.

◆ value_semantics

GaudiConfig2.semantics._DictHelper.value_semantics = value_semantics

Definition at line 737 of file semantics.py.


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