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

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

Definition at line 27 of file keyFinder.py.

Referenced by finds().

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 
44 
def find(file, regularExpression, exceptRegEx=[])
Definition: keyFinder.py:27
def keyFinder.finds (   fileList,
  regularExpression,
  exceptRegEx = [] 
)

Definition at line 8 of file keyFinder.py.

References find().

Referenced by cmsCodeRulesChecker.runRules().

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
def find(file, regularExpression, exceptRegEx=[])
Definition: keyFinder.py:27
def finds(fileList, regularExpression, exceptRegEx=[])
Definition: keyFinder.py:8

Variable Documentation

keyFinder.__author__
private

Definition at line 2 of file keyFinder.py.

keyFinder.__date__
private

Definition at line 3 of file keyFinder.py.