CMS 3D CMS Logo

Functions | Variables
pickleFileParser Namespace Reference

Functions

def pathToList (path)
 
def readPicFiles (directory, toSplit=False)
 
def splitToPackages (ruleResult)
 

Variables

 __author__
 
 __date__
 
 rulesNames
 
 slash
 

Function Documentation

◆ pathToList()

def pickleFileParser.pathToList (   path)

Definition at line 64 of file pickleFileParser.py.

64 def pathToList(path):
65  list = []
66  head, tail = split(path)
67  if tail != '':
68  list.insert(0, tail)
69  while head != '':
70  head, tail = split(head)
71  if tail != '':
72  list.insert(0, tail)
73  else:
74  break
75  return list
76 

References cms::dd.split().

Referenced by splitToPackages().

◆ readPicFiles()

def pickleFileParser.readPicFiles (   directory,
  toSplit = False 
)

Definition at line 16 of file pickleFileParser.py.

16 def readPicFiles(directory, toSplit = False):
17 
18  ruleResult = {}
19  rulesResults = {}
20  picFiles = sorted(glob.glob(join(directory, "cmsCodeRule*.dat")))
21 
22  for file in picFiles:
23  head, fileName = split(file)
24  ruleName = fileName[11:-4]
25  rulesNames.append(ruleName)
26 
27  file = open(file)
28  ruleResult = pickle.load(file)
29  if toSplit:
30  ruleResult = splitToPackages(ruleResult)
31 
32  rulesResults[ruleName] = ruleResult
33 
34  return rulesResults
35 
36 

References join(), cms::dd.split(), and splitToPackages().

Referenced by showPage.BuildViewer.showResults().

◆ splitToPackages()

def pickleFileParser.splitToPackages (   ruleResult)

Definition at line 37 of file pickleFileParser.py.

37 def splitToPackages(ruleResult):
38 
39  packageResult = []
40  info = []
41 
42  if not ruleResult: return info
43 
44  ruleResult = sorted(ruleResult.items())
45  file, lines = ruleResult.pop(0)
46  pathList = pathToList(file)
47  package = slash.join(pathList[:2])
48  packageResult.append((slash.join(pathList[2:]), lines))
49 
50  for file, lines in ruleResult:
51  pathList = pathToList(file)
52  head = slash.join(pathList[:2])
53  tail = slash.join(pathList[2:])
54  if package == head:
55  packageResult.append((tail, lines))
56  else:
57  info.append((package, packageResult))
58  packageResult = []
59  package = head
60  packageResult.append((tail, lines))
61  info.append((package, packageResult))
62  return info #list of (package, packageResult)
63 

References pathToList().

Referenced by readPicFiles().

Variable Documentation

◆ __author__

pickleFileParser.__author__
private

Definition at line 1 of file pickleFileParser.py.

◆ __date__

pickleFileParser.__date__
private

Definition at line 2 of file pickleFileParser.py.

◆ rulesNames

pickleFileParser.rulesNames

Definition at line 9 of file pickleFileParser.py.

◆ slash

pickleFileParser.slash
join
static std::string join(char **cmd)
Definition: RemoteFile.cc:17
cms::dd::split
std::vector< std::string_view > split(std::string_view, const char *)
pickleFileParser.splitToPackages
def splitToPackages(ruleResult)
Definition: pickleFileParser.py:37
pickleFileParser.readPicFiles
def readPicFiles(directory, toSplit=False)
Definition: pickleFileParser.py:16
pickleFileParser.pathToList
def pathToList(path)
Definition: pickleFileParser.py:64