2 from FWCore.ParameterSet.pfnInPath
import pfnInPath
8 """ Ensure that everything is done for path to exist 10 - path: String that can be both directory and file 12 - general: environmental variables are expanded 13 - directory: is checked to exist 14 - file: is checked to exist with backup directory being searched in cms-data 17 if not isinstance(path, str):
20 path_expanded = os.path.expandvars(path)
24 if "://" in path_expanded:
25 protocol = path_expanded.split(
"://")[0]+
"://" 26 path_d = path_expanded.split(
"://")[1]
27 elif ":" in path_expanded:
28 protocol = path_expanded.split(
":")[0]+
':' 29 path_d =
":".
join(path_expanded.split(
":")[1:])
32 path_d = path_expanded
34 path_s = path_d.split(os.sep)
37 for ipart,part
in enumerate(path_s):
40 placeholderIdx.append(ipart)
44 if len(placeholderIdx) > 0:
45 path_to_check = os.path.join(*path_s[:placeholderIdx[0]])
47 if path_d.startswith(os.sep):
48 path_to_check = os.sep + path_to_check
50 path_to_check = path_d
53 if not os.path.exists(path_to_check)
and "." in os.path.splitext(path_to_check)[-1]:
57 return _file.split(
":")[-1]
60 if protocol !=
"": path_d = protocol + path_d
69 Returns an integer correspondig to the ROOT color 71 if(isinstance(value, str)):
75 pre, op, post = value.partition(
'-')
78 pre, op, post = value.partition(
'+')
81 return getattr(ROOT.EColor, value)
89 Generate all keys for nested dictionary 90 - reserved keywords are not picked up 92 reserved_keys = [
"customrighttitle",
"title"]
93 if hasattr(var,
'items'):
94 for k, v
in var.items():
95 if k
in reserved_keys:
continue 96 if isinstance(v, dict):
99 elif isinstance(v, list):
109 """Perform effective search for keys in nested dictionary 110 - if key is found, corresponding value is "digested" 111 - generator is returned for printout purpose only 112 - original var is overwritten 114 if hasattr(var,
'items'):
119 for k, v
in var.items():
122 if isinstance(v,list):
127 if isinstance(v,list):
128 var[k] = [alt(_v)
for _v
in v]
132 if isinstance(v, dict):
135 elif isinstance(v, list):
def find_and_change(keys, var, alt=digest_path)
def get_root_color(value)
static std::string join(char **cmd)