Functions | |
def | find |
def | finds |
Variables | |
string | __author__ = "Aurelija" |
string | __date__ = "$Jul 12, 2010 10:08:20 AM$" |
def keyFinder::find | ( | file, | |
regularExpression, | |||
exceptRegEx = [] |
|||
) |
Definition at line 26 of file keyFinder.py.
00027 : 00028 lines = [] 00029 00030 if type(file).__name__ != 'list': 00031 fileLines = open(file).readlines() 00032 else: fileLines = file 00033 for i in range(len(fileLines)): 00034 matchException = False 00035 if re.search(regularExpression, fileLines[i]) != None: 00036 for regEx in exceptRegEx: 00037 if re.search(regEx, fileLines[i]) != None: 00038 matchException = True 00039 break 00040 if not matchException: 00041 lines.append(i+1) 00042 return lines 00043
def keyFinder::finds | ( | fileList, | |
regularExpression, | |||
exceptRegEx = [] |
|||
) |
Definition at line 7 of file keyFinder.py.
00008 : 00009 info = [] 00010 lines = [] 00011 00012 for i in range(len(fileList)): 00013 if type(fileList[0]).__name__ != 'tuple': 00014 file = fileList[i] 00015 lines = find(fileList[i], regularExpression, exceptRegEx) 00016 else: 00017 file = fileList[i][0] 00018 lines = find(fileList[i][1], regularExpression, exceptRegEx) 00019 00020 if lines: 00021 info.append((file, lines)) 00022 00023 return info 00024 00025 #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
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.