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 15 of file buildFileCommentSkipper.py.

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

Referenced by commentSkipper.buildFileCommentSkipper.filterFiles().

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

Definition at line 7 of file buildFileCommentSkipper.py.

References commentSkipper.buildFileCommentSkipper.filterFile().

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

Definition at line 32 of file buildFileCommentSkipper.py.

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

Referenced by commentSkipper.buildFileCommentSkipper.filterFile().

32 def filterMultilineComment(lines, commentStart, commentEnd):
33  i = 0
34  tlines = len(lines)
35  while (i < tlines):
36  startIndex = lines[i].find(commentStart)
37  startLine = i
38  while((startIndex != -1) and (i < tlines)):
39  endIndex = lines[i].find(commentEnd)
40  if endIndex != -1:
41  if startLine == i:
42  lines[i] = lines[i].replace(lines[i][startIndex:endIndex+3], '', 1)
43  else:
44  lines[i] = lines[i].replace(lines[i][:endIndex+3], '')
45  startIndex = lines[i].find(commentStart)
46  startLine = i
47  else:
48  if startLine == i:
49  lines[i] = lines[i].replace(lines[i][startIndex:], '\n', 1)
50  else:
51  lines[i] = lines[i].replace(lines[i][:], '\n')
52  i += 1
53  i += 1
54  return lines
55 
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 24 of file buildFileCommentSkipper.py.

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

Referenced by commentSkipper.buildFileCommentSkipper.filterFile().

24 def filterOneLineComment(lines, commentStart):
25  for i in range(len(lines)):
26  index = lines[i].find(commentStart)
27  if index != -1:
28  lines[i] = lines[i].replace(lines[i][index:], '\n')
29  return lines
30 
31 
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 2 of file buildFileCommentSkipper.py.

commentSkipper.buildFileCommentSkipper.__date__
private

Definition at line 3 of file buildFileCommentSkipper.py.