CMS 3D CMS Logo

Functions | Variables

pickleFileParser Namespace Reference

Functions

def pathToList
def readPicFiles
def splitToPackages

Variables

string __author__ = "Aurelija"
string __date__ = "$2010-08-13 14.28.08$"
list rulesNames = []
string slash = "\\"

Function Documentation

def pickleFileParser::pathToList (   path)

Definition at line 66 of file pickleFileParser.py.

00067                     :
00068     list = []
00069     head, tail = split(path)
00070     if tail != '':
00071         list.insert(0, tail)
00072     while head != '':
00073         head, tail = split(head)
00074         if tail != '':
00075             list.insert(0, tail)
00076         else:
00077             break
00078     return list
00079 
def pickleFileParser::readPicFiles (   directory,
  toSplit = False 
)

Definition at line 16 of file pickleFileParser.py.

00017                                             :
00018 
00019     ruleResult = {}
00020     rulesResults = {}
00021     picFiles = glob.glob(join(directory, "cmsCodeRule*.dat"))
00022     picFiles.sort()
00023 
00024     for file in picFiles:
00025         head, fileName = split(file)
00026         ruleName = fileName[11:-4]
00027         rulesNames.append(ruleName)
00028 
00029         file = open(file)
00030         ruleResult = pickle.load(file)
00031         if toSplit:
00032             ruleResult = splitToPackages(ruleResult)
00033 
00034         rulesResults[ruleName] = ruleResult
00035 
00036     return rulesResults
00037 

def pickleFileParser::splitToPackages (   ruleResult)

Definition at line 38 of file pickleFileParser.py.

00039                                :
00040 
00041     packageResult = []
00042     info = []
00043 
00044     if not ruleResult: return info
00045 
00046     ruleResult = ruleResult.items()
00047     ruleResult.sort()
00048     file, lines = ruleResult.pop(0)
00049     pathList = pathToList(file)
00050     package = slash.join(pathList[:2])
00051     packageResult.append((slash.join(pathList[2:]), lines))
00052 
00053     for file, lines in ruleResult:
00054         pathList = pathToList(file)
00055         head = slash.join(pathList[:2])
00056         tail = slash.join(pathList[2:])
00057         if package == head:
00058             packageResult.append((tail, lines))
00059         else:
00060             info.append((package, packageResult))
00061             packageResult = []
00062             package = head
00063             packageResult.append((tail, lines))
00064     info.append((package, packageResult))
00065     return info #list of (package, packageResult)


Variable Documentation

string pickleFileParser::__author__ = "Aurelija"

Definition at line 1 of file pickleFileParser.py.

string pickleFileParser::__date__ = "$2010-08-13 14.28.08$"

Definition at line 2 of file pickleFileParser.py.

Definition at line 9 of file pickleFileParser.py.

string pickleFileParser::slash = "\\"