Lines Matching refs:self

29     def __init__(self, warn=None, debug_print=None):
32 self.allfiles = None
33 self.files = []
35 def set_allfiles(self, allfiles):
36 self.allfiles = allfiles
38 def findall(self, dir=os.curdir):
39 self.allfiles = findall(dir)
41 def debug_print(self, msg):
51 def append(self, item):
52 self.files.append(item)
54 def extend(self, items):
55 self.files.extend(items)
57 def sort(self):
59 sortable_files = sorted(map(os.path.split, self.files))
60 self.files = []
62 self.files.append(os.path.join(*sort_tuple))
67 def remove_duplicates(self):
69 for i in range(len(self.files) - 1, 0, -1):
70 if self.files[i] == self.files[i - 1]:
71 del self.files[i]
76 def _parse_template_line(self, line):
104 def process_template_line(self, line):
110 (action, patterns, dir, dir_pattern) = self._parse_template_line(line)
116 self.debug_print("include " + ' '.join(patterns))
118 if not self.include_pattern(pattern, anchor=1):
123 self.debug_print("exclude " + ' '.join(patterns))
125 if not self.exclude_pattern(pattern, anchor=1):
130 self.debug_print("global-include " + ' '.join(patterns))
132 if not self.include_pattern(pattern, anchor=0):
137 self.debug_print("global-exclude " + ' '.join(patterns))
139 if not self.exclude_pattern(pattern, anchor=0):
145 self.debug_print("recursive-include %s %s" %
148 if not self.include_pattern(pattern, prefix=dir):
154 self.debug_print("recursive-exclude %s %s" %
157 if not self.exclude_pattern(pattern, prefix=dir):
163 self.debug_print("graft " + dir_pattern)
164 if not self.include_pattern(None, prefix=dir_pattern):
169 self.debug_print("prune " + dir_pattern)
170 if not self.exclude_pattern(None, prefix=dir_pattern):
180 def include_pattern(self, pattern, anchor=1, prefix=None, is_regex=0):
181 """Select strings (presumably filenames) from 'self.files' that
201 Selected strings will be added to self.files.
208 self.debug_print("include_pattern: applying regex r'%s'" %
212 if self.allfiles is None:
213 self.findall()
215 for name in self.allfiles:
217 self.debug_print(" adding " + name)
218 self.files.append(name)
223 def exclude_pattern (self, pattern,
228 The list 'self.files' is modified in place.
233 self.debug_print("exclude_pattern: applying regex r'%s'" %
235 for i in range(len(self.files)-1, -1, -1):
236 if pattern_re.search(self.files[i]):
237 self.debug_print(" removing " + self.files[i])
238 del self.files[i]