CMS 3D CMS Logo

Functions | Variables
commentSkipper.buildFileCommentSkipper Namespace Reference

Functions

def filterFile (file)
 
def filterFiles (fileList)
 
def filterMultilineComment (lines, commentStart, commentEnd)
 
def filterOneLineComment (lines, commentStart)
 

Variables

 __author__
 
 __date__
 

Function Documentation

def commentSkipper.buildFileCommentSkipper.filterFile (   file)

Definition at line 14 of file buildFileCommentSkipper.py.

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

Referenced by commentSkipper.buildFileCommentSkipper.filterFiles().

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

Definition at line 6 of file buildFileCommentSkipper.py.

References commentSkipper.buildFileCommentSkipper.filterFile().

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

Definition at line 31 of file buildFileCommentSkipper.py.

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

Referenced by commentSkipper.buildFileCommentSkipper.filterFile().

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

Definition at line 23 of file buildFileCommentSkipper.py.

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

Referenced by commentSkipper.buildFileCommentSkipper.filterFile().

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

Variable Documentation

commentSkipper.buildFileCommentSkipper.__author__
private

Definition at line 1 of file buildFileCommentSkipper.py.

commentSkipper.buildFileCommentSkipper.__date__
private

Definition at line 2 of file buildFileCommentSkipper.py.