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

◆ filterFile()

def commentSkipper.buildFileCommentSkipper.filterFile (   file)

Definition at line 15 of file buildFileCommentSkipper.py.

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 

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

Referenced by commentSkipper.buildFileCommentSkipper.filterFiles().

◆ filterFiles()

def commentSkipper.buildFileCommentSkipper.filterFiles (   fileList)

Definition at line 7 of file buildFileCommentSkipper.py.

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

References commentSkipper.buildFileCommentSkipper.filterFile().

◆ filterMultilineComment()

def commentSkipper.buildFileCommentSkipper.filterMultilineComment (   lines,
  commentStart,
  commentEnd 
)

Definition at line 32 of file buildFileCommentSkipper.py.

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

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

Referenced by commentSkipper.buildFileCommentSkipper.filterFile().

◆ filterOneLineComment()

def commentSkipper.buildFileCommentSkipper.filterOneLineComment (   lines,
  commentStart 
)

Definition at line 24 of file buildFileCommentSkipper.py.

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 

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

Referenced by commentSkipper.buildFileCommentSkipper.filterFile().

Variable Documentation

◆ __author__

commentSkipper.buildFileCommentSkipper.__author__
private

Definition at line 2 of file buildFileCommentSkipper.py.

◆ __date__

commentSkipper.buildFileCommentSkipper.__date__
private

Definition at line 3 of file buildFileCommentSkipper.py.

FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
commentSkipper.buildFileCommentSkipper.filterFile
def filterFile(file)
Definition: buildFileCommentSkipper.py:15
commentSkipper.buildFileCommentSkipper.filterMultilineComment
def filterMultilineComment(lines, commentStart, commentEnd)
Definition: buildFileCommentSkipper.py:32
commentSkipper.buildFileCommentSkipper.filterOneLineComment
def filterOneLineComment(lines, commentStart)
Definition: buildFileCommentSkipper.py:24
commentSkipper.buildFileCommentSkipper.filterFiles
def filterFiles(fileList)
Definition: buildFileCommentSkipper.py:7
python.rootplot.root2matplotlib.replace
def replace(string, replacements)
Definition: root2matplotlib.py:444