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

Classes

class  BlockNameProcessorMeta
class  ConfigBlockOption
class  ConfigBlockDependency
class  ConfigBlock

Functions

 filter_dsids (filterList, config)
 alphanumeric_block_name (func)

Variables

 logCPAlgCfgBlock = logging.getLogger('CPAlgCfgBlock')

Function Documentation

◆ alphanumeric_block_name()

alphanumeric_block_name ( func)
this wrapper ensures that the 'instanceName' of the various
config blocks is cleaned up of any non-alphanumeric characters
that may arise from using 'selectionName' in the naming.

Definition at line 32 of file ConfigBlock.py.

32def alphanumeric_block_name(func):
33 """this wrapper ensures that the 'instanceName' of the various
34 config blocks is cleaned up of any non-alphanumeric characters
35 that may arise from using 'selectionName' in the naming."""
36 @wraps(func)
37 def wrapper(*args, **kwargs):
38 # Get the string returned by the 'instanceName()' method of a config block
39 orig_name = func(*args, **kwargs)
40
41 if orig_name is None:
42 return ""
43
44 # Allowed replacements - anything else is likely a mistake on the user-side
45 result = orig_name.replace("||", "OR").replace("&&", "AND").replace("(","LB").replace(")","RB").replace(" ","")
46
47 return result
48 return wrapper
49
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition hcg.cxx:312

◆ filter_dsids()

filter_dsids ( filterList,
config )
check whether the sample being run passes a
possible DSID filter on the block

Definition at line 15 of file ConfigBlock.py.

15def filter_dsids (filterList, config) :
16 """check whether the sample being run passes a
17 possible DSID filter on the block"""
18 if len(filterList) == 0:
19 return True
20 for dsid_filter in filterList:
21 # Check if the pattern is enclosed in regex delimiters (e.g., starts with '^' or contains regex metacharacters)
22 if any(char in str(dsid_filter) for char in "^$*+?.()|[]{}\\"):
23 pattern = re.compile(dsid_filter)
24 if pattern.match(str(config.dsid())):
25 return True
26 else:
27 # Otherwise it's an exact DSID (but could be int or string)
28 if str(dsid_filter) == str(config.dsid()):
29 return True
30 return False
31

Variable Documentation

◆ logCPAlgCfgBlock

python.ConfigBlock.logCPAlgCfgBlock = logging.getLogger('CPAlgCfgBlock')

Definition at line 10 of file ConfigBlock.py.