CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 14 of file buildFileCommentSkipper.py.

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

Referenced by commentSkipper.buildFileCommentSkipper.filterFiles().

14 
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 
def commentSkipper.buildFileCommentSkipper.filterFiles (   fileList)

Definition at line 6 of file buildFileCommentSkipper.py.

References commentSkipper.buildFileCommentSkipper.filterFile().

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

Definition at line 31 of file buildFileCommentSkipper.py.

References spr.find(), and linker.replace().

Referenced by commentSkipper.buildFileCommentSkipper.filterFile().

31 
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
def replace
Definition: linker.py:10
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
def commentSkipper.buildFileCommentSkipper.filterOneLineComment (   lines,
  commentStart 
)

Definition at line 23 of file buildFileCommentSkipper.py.

References spr.find(), and linker.replace().

Referenced by commentSkipper.buildFileCommentSkipper.filterFile().

23 
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 
def replace
Definition: linker.py:10
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7

Variable Documentation

string commentSkipper.buildFileCommentSkipper.__author__ = "Aurelija"

Definition at line 1 of file buildFileCommentSkipper.py.

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

Definition at line 2 of file buildFileCommentSkipper.py.