The Gaudi Framework  master (594c33fa)
GaudiConfig2._db.ConfDB2 Class Reference
Inheritance diagram for GaudiConfig2._db.ConfDB2:
Collaboration diagram for GaudiConfig2._db.ConfDB2:

Public Member Functions

def __init__ (self)
 
def __getitem__ (self, key)
 
def __contains__ (self, key)
 
def __iter__ (self)
 

Private Attributes

 _dbs
 

Detailed Description

Definition at line 17 of file _db.py.

Constructor & Destructor Documentation

◆ __init__()

def GaudiConfig2._db.ConfDB2.__init__ (   self)

Definition at line 18 of file _db.py.

18  def __init__(self):
19  import shelve
20 
21  self._dbs = {}
22  pathvar = "DYLD_LIBRARY_PATH" if sys.platform == "darwin" else "LD_LIBRARY_PATH"
23  for path in os.getenv(pathvar, "").split(os.pathsep):
24  if not os.path.isdir(path):
25  continue
26  dbfiles = [
27  os.path.join(path, f)
28  for f in os.listdir(path)
29  if f.endswith(".confdb2") and os.path.isfile(os.path.join(path, f))
30  ]
31  dbfiles.sort()
32  for db in [shelve.open(f, "r") for f in dbfiles]:
33  for key in db:
34  if key not in self._dbs:
35  self._dbs[key] = db
36 

Member Function Documentation

◆ __contains__()

def GaudiConfig2._db.ConfDB2.__contains__ (   self,
  key 
)

Definition at line 40 of file _db.py.

40  def __contains__(self, key):
41  return key in self._dbs
42 

◆ __getitem__()

def GaudiConfig2._db.ConfDB2.__getitem__ (   self,
  key 
)

Definition at line 37 of file _db.py.

37  def __getitem__(self, key):
38  return self._dbs[key][key]
39 

◆ __iter__()

def GaudiConfig2._db.ConfDB2.__iter__ (   self)

Definition at line 43 of file _db.py.

43  def __iter__(self):
44  return iter(self._dbs)
45 
46 
47 # allow overriding the low level DB access for testing

Member Data Documentation

◆ _dbs

GaudiConfig2._db.ConfDB2._dbs
private

Definition at line 21 of file _db.py.


The documentation for this class was generated from the following file:
GaudiPython.Pythonizations.__getitem__
__getitem__
Definition: Pythonizations.py:141
GaudiPython.Pythonizations.__iter__
__iter__
Definition: Pythonizations.py:143