ATLAS Offline Software
Public Member Functions | Public Attributes | Private Member Functions | List of all members
python.AutoConfigFlags.DynamicallyLoadMetadata Class Reference
Collaboration diagram for python.AutoConfigFlags.DynamicallyLoadMetadata:

Public Member Functions

def __init__ (self, filename, maxLevel='peeker')
 
def get (self, key, default)
 
def __contains__ (self, key)
 
def __getitem__ (self, key)
 
def __repr__ (self)
 
def keys (self)
 

Public Attributes

 metadata
 
 filename
 
 currentAccessLevel
 
 maxAccessLevel
 

Private Member Functions

def _loadMore (self, level)
 

Detailed Description

Definition at line 12 of file AutoConfigFlags.py.

Constructor & Destructor Documentation

◆ __init__()

def python.AutoConfigFlags.DynamicallyLoadMetadata.__init__ (   self,
  filename,
  maxLevel = 'peeker' 
)

Definition at line 13 of file AutoConfigFlags.py.

13  def __init__(self, filename, maxLevel='peeker'):
14  self.metadata = {}
15  self.filename = filename
16  self.currentAccessLevel = 'lite'
17  self.maxAccessLevel = maxLevel
18  thisFileMD = read_metadata(filename, None, 'lite')
19  self.metadata.update(thisFileMD[self.filename])
20  msg.debug("Loaded using 'lite' %s", str(self.metadata))
21 

Member Function Documentation

◆ __contains__()

def python.AutoConfigFlags.DynamicallyLoadMetadata.__contains__ (   self,
  key 
)

Definition at line 52 of file AutoConfigFlags.py.

52  def __contains__(self, key):
53  self.get(key, None)
54  return key in self.metadata
55 

◆ __getitem__()

def python.AutoConfigFlags.DynamicallyLoadMetadata.__getitem__ (   self,
  key 
)

Definition at line 56 of file AutoConfigFlags.py.

56  def __getitem__(self, key):
57  return self.get(key, None)
58 

◆ __repr__()

def python.AutoConfigFlags.DynamicallyLoadMetadata.__repr__ (   self)

Definition at line 59 of file AutoConfigFlags.py.

59  def __repr__(self):
60  return repr(self.metadata)
61 

◆ _loadMore()

def python.AutoConfigFlags.DynamicallyLoadMetadata._loadMore (   self,
  level 
)
private

Definition at line 22 of file AutoConfigFlags.py.

22  def _loadMore(self, level):
23  self.currentAccessLevel = level
24 
25  thisFileMD = read_metadata(self.filename, None, level)
26  self.metadata.update(thisFileMD[self.filename])
27 

◆ get()

def python.AutoConfigFlags.DynamicallyLoadMetadata.get (   self,
  key,
  default 
)

Definition at line 28 of file AutoConfigFlags.py.

28  def get(self, key, default):
29  if key in self.metadata:
30  return self.metadata[key]
31  if key in lite_primary_keys_to_keep or key in lite_TagInfo_keys_to_keep:
32  # no need to load more
33  return default
34 
35  if self.currentAccessLevel == self.maxAccessLevel:
36  return default
37 
38  levels = []
39  if self.currentAccessLevel == 'lite':
40  levels = ['peeker', 'full'] if self.maxAccessLevel == 'full' else ['peeker']
41  elif self.currentAccessLevel == 'peeker':
42  levels = ['full']
43 
44  for level in levels:
45  msg.info("Looking into the file in '%s' mode as the configuration requires more details: %s ", level, key)
46  self._loadMore(level)
47  if key in self.metadata:
48  return self.metadata[key]
49 
50  return default
51 

◆ keys()

def python.AutoConfigFlags.DynamicallyLoadMetadata.keys (   self)

Definition at line 62 of file AutoConfigFlags.py.

62  def keys(self):
63  return self.metadata.keys()
64 

Member Data Documentation

◆ currentAccessLevel

python.AutoConfigFlags.DynamicallyLoadMetadata.currentAccessLevel

Definition at line 16 of file AutoConfigFlags.py.

◆ filename

python.AutoConfigFlags.DynamicallyLoadMetadata.filename

Definition at line 15 of file AutoConfigFlags.py.

◆ maxAccessLevel

python.AutoConfigFlags.DynamicallyLoadMetadata.maxAccessLevel

Definition at line 17 of file AutoConfigFlags.py.

◆ metadata

python.AutoConfigFlags.DynamicallyLoadMetadata.metadata

Definition at line 14 of file AutoConfigFlags.py.


The documentation for this class was generated from the following file:
python.MetaReader.read_metadata
def read_metadata(filenames, file_type=None, mode='lite', promote=None, meta_key_filter=None, unique_tag_info_values=True, ignoreNonExistingLocalFiles=False)
Definition: MetaReader.py:53
PyAthena::repr
std::string repr(PyObject *o)
returns the string representation of a python object equivalent of calling repr(o) in python
Definition: PyAthenaUtils.cxx:106
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
get
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition: hcg.cxx:127
str
Definition: BTagTrackIpAccessor.cxx:11
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
python.Bindings.__getitem__
__getitem__
Definition: Control/AthenaPython/python/Bindings.py:779
WriteBchToCool.update
update
Definition: WriteBchToCool.py:67
python.Bindings.__contains__
__contains__
Definition: Control/AthenaPython/python/Bindings.py:765