CMS 3D CMS Logo

Functions | Variables
keyFinder Namespace Reference

Functions

def find (file, regularExpression, exceptRegEx=[])
 
def finds (fileList, regularExpression, exceptRegEx=[])
 

Variables

 __author__
 
 __date__
 

Function Documentation

◆ find()

def keyFinder.find (   file,
  regularExpression,
  exceptRegEx = [] 
)

Definition at line 27 of file keyFinder.py.

27 def find(file, regularExpression, exceptRegEx = []):
28  lines = []
29 
30  if type(file).__name__ != 'list':
31  fileLines = open(file).readlines()
32  else: fileLines = file
33  for i in range(len(fileLines)):
34  matchException = False
35  if re.search(regularExpression, fileLines[i]) != None:
36  for regEx in exceptRegEx:
37  if re.search(regEx, fileLines[i]) != None:
38  matchException = True
39  break
40  if not matchException:
41  lines.append(i+1)
42  return lines
43 

References FastTimerService_cff.range.

Referenced by finds().

◆ finds()

def keyFinder.finds (   fileList,
  regularExpression,
  exceptRegEx = [] 
)

Definition at line 8 of file keyFinder.py.

8 def finds(fileList, regularExpression, exceptRegEx = []):
9  info = []
10  lines = []
11 
12  for i in range(len(fileList)):
13  if type(fileList[0]).__name__ != 'tuple':
14  file = fileList[i]
15  lines = find(fileList[i], regularExpression, exceptRegEx)
16  else:
17  file = fileList[i][0]
18  lines = find(fileList[i][1], regularExpression, exceptRegEx)
19 
20  if lines:
21  info.append((file, lines))
22 
23  return info
24 
25 #file is the file path or the list of file lines
26 #exceptRegEx is the list of regular expressions that says to skip line if one of these regEx matches

References find(), and FastTimerService_cff.range.

Referenced by cmsCodeRulesChecker.runRules().

Variable Documentation

◆ __author__

keyFinder.__author__
private

Definition at line 2 of file keyFinder.py.

◆ __date__

keyFinder.__date__
private

Definition at line 3 of file keyFinder.py.

FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
keyFinder.find
def find(file, regularExpression, exceptRegEx=[])
Definition: keyFinder.py:27
keyFinder.finds
def finds(fileList, regularExpression, exceptRegEx=[])
Definition: keyFinder.py:8