ATLAS Offline Software
Classes | Functions | Variables
python.JobProperties Namespace Reference

Classes

class  _JobPropertyMeta
 
class  JobProperties
 
class  JobProperty
 
class  JobPropertyContainer
 

Functions

def _isCompatible (allowedTypes, value)
 
def save_jobproperties (file_name)
 
def load_jobproperties (file_name)
 

Variables

bool jobPropertiesDisallowed = False
 
string __author__ = 'M. Gallas, P. Calafiura, S. Binet'
 
string __version__ = '$Revision: 1.18 $'
 
string __doc__ = "JobProperties"
 
list __all__ = [ "JobProperties"]
 

Function Documentation

◆ _isCompatible()

def python.JobProperties._isCompatible (   allowedTypes,
  value 
)
private

Definition at line 35 of file JobProperties.py.

35 def _isCompatible( allowedTypes, value ):
36  # this function is similar to PropertyProxy._isCompatible, but with
37  # some twists to handle the peculiarity of JobProperty's implementation
38 
39  offcount = 0
40  for a in allowedTypes:
41  try:
42  tp = eval( a )
43  except Exception:
44  if type(value).__name__ in allowedTypes:
45  return True # old style, for e.g. function
46  offcount += 1
47  continue
48 
49  if ( tp == str and len(allowedTypes) == 1 ) and not isinstance( value, tp ):
50  # special case, insist on exact match for str (no conversions allowed)
51  return False
52  elif type(value) is str and not isinstance( value, tp ):
53  # similarly, insist on exact match for str (no conversions allowed)
54  pass # offcount will cause a failure, unless another type matches
55  elif tp == int and type(value) is float:
56  # special case, insist on strict match for integer types
57  pass # id. as for strings above
58  elif ( tp == bool ) and not (type(value) in [bool, int]):
59  # restrictions on bool, as the code below does "== False", so even though
60  # a lot of types convert to bool, only bool and int (and float) behave as
61  # expected on comparison
62  pass # id. as for strings above
63  else:
64  # all other types: accept if conversion allowed
65  try:
66  tp( value ) # conversion needed to check allowedValues
67  return True
68  except Exception:
69  pass
70 
71  # accept if no types, or if there are uncheckable types left
72  return not (len(allowedTypes) - offcount)
73 
74 #=======================================================================
75 # classes
76 #=======================================================================

◆ load_jobproperties()

def python.JobProperties.load_jobproperties (   file_name)
Loads the "jobproperties" container of JobProperties. 

Definition at line 806 of file JobProperties.py.

806 def load_jobproperties(file_name):
807  """ Loads the "jobproperties" container of JobProperties.
808  """
809  try:
810  if not (file_name.__contains__(os.sep)) :
811  file_name=os.getcwd()+os.sep+file_name
812  f=open(file_name,'r')
813  return pickle.load(f)
814  except IOError:
815  print ('It is not possible to load the jobproperties ')
816 

◆ save_jobproperties()

def python.JobProperties.save_jobproperties (   file_name)
Saves the "jobproperties" container of JobProperties.

Definition at line 793 of file JobProperties.py.

793 def save_jobproperties(file_name):
794  """ Saves the "jobproperties" container of JobProperties.
795  """
796  try:
797  if not (file_name.__contains__(os.sep)) :
798  file_name=os.getcwd()+os.sep+file_name
799  f=open(file_name,'w')
800 # data=[JobPropertyContainer,JobProperty,jobproperties]
801 # pickle.dump(data,f)
802  pickle.dump(jobproperties,f)
803  f.close()
804  except IOError:
805  print ('It is not possible to save the jobproperties ')

Variable Documentation

◆ __all__

list python.JobProperties.__all__ = [ "JobProperties"]
private

Definition at line 27 of file JobProperties.py.

◆ __author__

string python.JobProperties.__author__ = 'M. Gallas, P. Calafiura, S. Binet'
private

Definition at line 23 of file JobProperties.py.

◆ __doc__

string python.JobProperties.__doc__ = "JobProperties"
private

Definition at line 25 of file JobProperties.py.

◆ __version__

string python.JobProperties.__version__ = '$Revision: 1.18 $'
private

Definition at line 24 of file JobProperties.py.

◆ jobPropertiesDisallowed

bool python.JobProperties.jobPropertiesDisallowed = False

Definition at line 17 of file JobProperties.py.

ParticleTest.tp
tp
Definition: ParticleTest.py:25
python.JobProperties.save_jobproperties
def save_jobproperties(file_name)
Definition: JobProperties.py:793
Trk::open
@ open
Definition: BinningType.h:40
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
python.JobProperties._isCompatible
def _isCompatible(allowedTypes, value)
Definition: JobProperties.py:35
python.JobProperties.load_jobproperties
def load_jobproperties(file_name)
Definition: JobProperties.py:806