test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions | Variables
keyFinder Namespace Reference

Functions

def find
 
def finds
 

Variables

string __author__ = "Aurelija"
 
string __date__ = "$Jul 12, 2010 10:08:20 AM$"
 

Function Documentation

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

Definition at line 26 of file keyFinder.py.

Referenced by finds().

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

Definition at line 7 of file keyFinder.py.

References find().

Referenced by cmsCodeRulesChecker.runRules().

7 
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
#exceptRegEx is the list of regular expressions that says to skip line if one of these regEx matches
def find
Definition: keyFinder.py:26
def finds
Definition: keyFinder.py:7

Variable Documentation

string keyFinder.__author__ = "Aurelija"

Definition at line 1 of file keyFinder.py.

string keyFinder.__date__ = "$Jul 12, 2010 10:08:20 AM$"

Definition at line 2 of file keyFinder.py.