ATLAS Offline Software
Loading...
Searching...
No Matches
python.trfArgClasses Namespace Reference

Classes

class  argAction
class  argActionFactory
 Factory class used to generate argparse actions, actions should be used when arguments are used without value, like boolean flags. More...
class  argAthenaFile
 Athena file class. More...
class  argBool
 Boolean type argument. More...
class  argBSFile
 ByteStream file class. More...
class  argBZ2File
 TarBZ filetype. More...
class  argEVNT_TRFile
class  argEVNTFile
class  argFactory
 Factory class used to generate argument class instances for argparse. More...
class  argFile
 File argument class. More...
class  argFloat
 Float type argument. More...
class  argFTKIPFile
 Class which defines a special input file format used in FTK simulation. More...
class  argHepEvtAsciiFile
 HEP ASCII file. More...
class  argHISTFile
 Data quality histogram file class. More...
class  argHITSFile
class  argInt
 Int type argument. More...
class  argIntList
 List of int arguments. More...
class  argKeyFloatValueList
class  argLHEFile
 LHE ASCII file. More...
class  argList
 List of string arguments. More...
class  argNTUPFile
 NTUP (plain ROOT) file class. More...
class  argPOOLFile
 POOL file class. More...
class  argRDOFile
class  argString
 String type argument. More...
class  argSubstep
 Base class for substep arguments. More...
class  argSubstepBool
 Boolean substep argument. More...
class  argSubstepConditions
 Substep class for conditionsTag. More...
class  argSubstepFloat
 Float substep argument. More...
class  argSubstepInt
 Int substep argument. More...
class  argSubstepList
 Argument class for substep lists, suitable for preExec/postExec. More...
class  argSubstepSteering
 Special argument class to hold steering information. More...
class  argSubstepString
 String substep argument. More...
class  argument
 Basic argument class holding a value which can be get and set. More...
class  argYODAFile
class  trfArgParser

Functions

 strToBool (string)
 Small utility to convert a string value to a boolean.
 dictSubstepMerge (dict1, dict2)
 special dictionary merger which is used for substep type arguments

Variables

 msg = logging.getLogger(__name__)

Function Documentation

◆ dictSubstepMerge()

python.trfArgClasses.dictSubstepMerge ( dict1,
dict2 )

special dictionary merger which is used for substep type arguments

Uses set class to get the unique list of keys. Any key present in only one dictionary is unaltered. If the values are lists they are catenated, otherwise the values are picked from the dictionary in which it is set.

Parameters

c dict1 First dictionary

Parameters

c dict2 Second dictionary

Returns
Merged dictionary @raise trfExceptions.TransformArgException If both dictionaries contain non-list keys which are not the same.

Definition at line 2660 of file trfArgClasses.py.

2660def dictSubstepMerge(dict1, dict2):
2661 mergeDict = {}
2662 allKeys = set(dict1) | set(dict2)
2663 # Find the value type - lists are special...
2664 listType = False
2665 if len(dict1) > 0:
2666 if isinstance(list(dict1.values())[0], list):
2667 listType = True
2668 elif len(dict2) > 0:
2669 if isinstance(list(dict2.values())[0], list):
2670 listType = True
2671 if listType:
2672 for key in allKeys:
2673 mergeDict[key] = dict1.get(key, []) + dict2.get(key, [])
2674 else:
2675 for key in allKeys:
2676 if key in dict1 and key in dict2:
2677 # Don't really know what to do if these clash...
2678 if dict1[key] != dict2[key]:
2679 raise trfExceptions.TransformArgException(trfExit.nameToCode('TRF_ARG_CONV_FAIL'),
2680 'Merging substep arguments found clashing values for substep {0}: {1}!={2}'.format(key, dict1[key], dict2[key]))
2681 mergeDict[key] = dict1[key]
2682 elif key in dict1:
2683 mergeDict[key] = dict1[key]
2684 else:
2685 mergeDict[key] = dict2[key]
2686
2687 return mergeDict
2688
2689
STL class.

◆ strToBool()

python.trfArgClasses.strToBool ( string)

Small utility to convert a string value to a boolean.

Definition at line 2639 of file trfArgClasses.py.

2639def strToBool(string):
2640 try:
2641 msg.debug("converting string {string} to boolean".format(string = string))
2642 if string.lower() == 'false':
2643 return False
2644 elif string.lower() == 'true':
2645 return True
2646 else:
2647 raise trfExceptions.TransformArgException(trfExit.nameToCode('TRF_ARG_CONV_FAIL'), 'Failed to convert value {0} to bool'.format(string))
2648 except AttributeError:
2649 raise trfExceptions.TransformArgException(trfExit.nameToCode('TRF_ARG_CONV_FAIL'), 'Failed to convert value {0} to bool'.format(string))
2650

Variable Documentation

◆ msg

python.trfArgClasses.msg = logging.getLogger(__name__)

Definition at line 17 of file trfArgClasses.py.