CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Functions | Variables
commentSkipper.buildFileCommentSkipper Namespace Reference

Functions

def filterFile
 
def filterFiles
 
def filterMultilineComment
 
def filterOneLineComment
 

Variables

string __author__ = "Aurelija"
 
string __date__ = "$2010-07-20 11.52.22$"
 

Function Documentation

def commentSkipper.buildFileCommentSkipper.filterFile (   file)

Definition at line 15 of file buildFileCommentSkipper.py.

References commentSkipper.buildFileCommentSkipper.filterMultilineComment(), and commentSkipper.buildFileCommentSkipper.filterOneLineComment().

Referenced by commentSkipper.buildFileCommentSkipper.filterFiles().

15 
16 def filterFile(file):
17  lines = open(file).readlines()
18  lines = filterMultilineComment(lines, '"""', '"""')
19  lines = filterMultilineComment(lines, "'''", "'''")
20  lines = filterMultilineComment(lines, '<!--', '-->')
21  lines = filterOneLineComment(lines, "#")
22  return lines
23 
def commentSkipper.buildFileCommentSkipper.filterFiles (   fileList)

Definition at line 7 of file buildFileCommentSkipper.py.

References commentSkipper.buildFileCommentSkipper.filterFile().

7 
8 def filterFiles(fileList):
9  files = []
10 
11  for file in fileList:
12  files.append((file, filterFile(file)))
13  return files
14 
def commentSkipper.buildFileCommentSkipper.filterMultilineComment (   lines,
  commentStart,
  commentEnd 
)

Definition at line 32 of file buildFileCommentSkipper.py.

References spr.find(), python.rootplot.root2matplotlib.replace(), and gpuVertexFinder.while().

Referenced by commentSkipper.buildFileCommentSkipper.filterFile().

32 
33 def filterMultilineComment(lines, commentStart, commentEnd):
34  i = 0
35  tlines = len(lines)
36  while (i < tlines):
37  startIndex = lines[i].find(commentStart)
38  startLine = i
39  while((startIndex != -1) and (i < tlines)):
40  endIndex = lines[i].find(commentEnd)
41  if endIndex != -1:
42  if startLine == i:
43  lines[i] = lines[i].replace(lines[i][startIndex:endIndex+3], '', 1)
44  else:
45  lines[i] = lines[i].replace(lines[i][:endIndex+3], '')
46  startIndex = lines[i].find(commentStart)
47  startLine = i
48  else:
49  if startLine == i:
50  lines[i] = lines[i].replace(lines[i][startIndex:], '\n', 1)
51  else:
52  lines[i] = lines[i].replace(lines[i][:], '\n')
53  i += 1
54  i += 1
55  return lines
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
while(__syncthreads_or(more))
def commentSkipper.buildFileCommentSkipper.filterOneLineComment (   lines,
  commentStart 
)

Definition at line 24 of file buildFileCommentSkipper.py.

References spr.find(), sistrip::SpyUtilities.range(), and python.rootplot.root2matplotlib.replace().

Referenced by commentSkipper.buildFileCommentSkipper.filterFile().

24 
25 def filterOneLineComment(lines, commentStart):
26  for i in range(len(lines)):
27  index = lines[i].find(commentStart)
28  if index != -1:
29  lines[i] = lines[i].replace(lines[i][index:], '\n')
30  return lines
31 
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
const uint16_t range(const Frame &aFrame)

Variable Documentation

string commentSkipper.buildFileCommentSkipper.__author__ = "Aurelija"

Definition at line 2 of file buildFileCommentSkipper.py.

string commentSkipper.buildFileCommentSkipper.__date__ = "$2010-07-20 11.52.22$"

Definition at line 3 of file buildFileCommentSkipper.py.