CMS 3D CMS Logo

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

Functions

def find
 
def finds
 

Variables

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

Function Documentation

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

Definition at line 26 of file keyFinder.py.

Referenced by cmsCodeRules.keyFinder.finds().

26 
27 def find(file, regularExpression, exceptRegEx = []):
28  lines = []
29  matchException = False
30 
31  if type(file).__name__ != 'list':
32  fileLines = open(file).readlines()
33  else: fileLines = file
34  for i in range(len(fileLines)):
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 cmsCodeRules.keyFinder.finds (   fileList,
  regularExpression,
  exceptRegEx = [] 
)

Definition at line 7 of file keyFinder.py.

References cmsCodeRules.keyFinder.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

Variable Documentation

string cmsCodeRules.keyFinder.__author__ = "Aurelija"

Definition at line 1 of file keyFinder.py.

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

Definition at line 2 of file keyFinder.py.