The Gaudi Framework  master (98f5f38d)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
GaudiConfig2.semantics._DictHelper Class Reference
Inheritance diagram for GaudiConfig2.semantics._DictHelper:
Collaboration diagram for GaudiConfig2.semantics._DictHelper:

Public Member Functions

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

Public Attributes

 key_semantics
 
 value_semantics
 
 default
 
 is_dirty
 

Private Attributes

 _data
 

Detailed Description

Definition at line 598 of file semantics.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 599 of file semantics.py.

599  def __init__(self, key_semantics, value_semantics):
600  self.key_semantics = key_semantics
601  self.value_semantics = value_semantics
602  self.default = None
603  self._data = {}
604  self.is_dirty = False
605 

Member Function Documentation

◆ __contains__()

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

Definition at line 644 of file semantics.py.

644  def __contains__(self, key):
645  return self.key_semantics.store(key) in self.data
646 

◆ __delitem__()

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

Definition at line 624 of file semantics.py.

624  def __delitem__(self, key):
625  if not self.is_dirty:
626  raise RuntimeError("cannot remove elements from the default value")
627  self.data.__delitem__(self.key_semantics.store(key))
628 

◆ __getitem__()

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

Definition at line 613 of file semantics.py.

613  def __getitem__(self, key):
614  return self.value_semantics.load(
615  self.data.__getitem__(self.key_semantics.store(key))
616  )
617 

◆ __iter__()

def GaudiConfig2.semantics._DictHelper.__iter__ (   self)

Definition at line 629 of file semantics.py.

629  def __iter__(self):
630  for key in self.data:
631  yield self.key_semantics.load(key)
632 

◆ __len__()

def GaudiConfig2.semantics._DictHelper.__len__ (   self)

Definition at line 610 of file semantics.py.

610  def __len__(self):
611  return len(self.data)
612 

◆ __repr__()

def GaudiConfig2.semantics._DictHelper.__repr__ (   self)

Definition at line 667 of file semantics.py.

667  def __repr__(self):
668  return repr(self.data)
669 
670 

◆ __setitem__()

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

Definition at line 618 of file semantics.py.

618  def __setitem__(self, key, value):
619  self.is_dirty = True
620  self.data.__setitem__(
621  self.key_semantics.store(key), self.value_semantics.store(value)
622  )
623 

◆ data()

def GaudiConfig2.semantics._DictHelper.data (   self)

Definition at line 607 of file semantics.py.

607  def data(self):
608  return self._data if self.is_dirty else self.default
609 

◆ get()

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

Definition at line 647 of file semantics.py.

647  def get(self, key, default=None):
648  key = self.key_semantics.store(key)
649  if key in self.data:
650  return self.value_semantics.load(self.data[key])
651  return default
652 

◆ items()

def GaudiConfig2.semantics._DictHelper.items (   self)

Definition at line 636 of file semantics.py.

636  def items(self):
637  for key, value in self.data.items():
638  yield (self.key_semantics.load(key), self.value_semantics.load(value))
639 

◆ keys()

def GaudiConfig2.semantics._DictHelper.keys (   self)

Definition at line 633 of file semantics.py.

633  def keys(self):
634  return list(self)
635 

◆ opt_value()

def GaudiConfig2.semantics._DictHelper.opt_value (   self)

Definition at line 661 of file semantics.py.

661  def opt_value(self):
662  return {
663  self.key_semantics.opt_value(key): self.value_semantics.opt_value(value)
664  for key, value in self.data.items()
665  }
666 

◆ update()

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

Definition at line 656 of file semantics.py.

656  def update(self, otherMap):
657  self.is_dirty = True
658  for key, value in otherMap.items():
659  self.data[self.key_semantics.store(key)] = self.value_semantics.store(value)
660 

◆ values()

def GaudiConfig2.semantics._DictHelper.values (   self)

Definition at line 640 of file semantics.py.

640  def values(self):
641  for value in self.data.values():
642  yield self.value_semantics.load(value)
643 

Member Data Documentation

◆ _data

GaudiConfig2.semantics._DictHelper._data
private

Definition at line 603 of file semantics.py.

◆ default

GaudiConfig2.semantics._DictHelper.default

Definition at line 602 of file semantics.py.

◆ is_dirty

GaudiConfig2.semantics._DictHelper.is_dirty

Definition at line 604 of file semantics.py.

◆ key_semantics

GaudiConfig2.semantics._DictHelper.key_semantics

Definition at line 600 of file semantics.py.

◆ value_semantics

GaudiConfig2.semantics._DictHelper.value_semantics

Definition at line 601 of file semantics.py.


The documentation for this class was generated from the following file:
GaudiPython.Pythonizations.__getitem__
__getitem__
Definition: Pythonizations.py:141
GaudiPartProp.decorators.get
get
decorate the vector of properties
Definition: decorators.py:283
GaudiPartProp.decorators.__repr__
__repr__
decorate the vector of properties
Definition: decorators.py:173
GaudiPartProp.decorators.__len__
__len__
Definition: decorators.py:177
GaudiPython.Pythonizations.__iter__
__iter__
Definition: Pythonizations.py:143
StringKeyEx.keys
keys
Definition: StringKeyEx.py:64
GaudiPython.Pythonizations.update
update
Definition: Pythonizations.py:145