Lines Matching refs:self

124     def __init__(self, a, b, ignore=None, hide=None): # Initialize
125 self.left = a
126 self.right = b
128 self.hide = [os.curdir, os.pardir] # Names never to be shown
130 self.hide = hide
132 self.ignore = DEFAULT_IGNORES
134 self.ignore = ignore
136 def phase0(self): # Compare everything except common subdirectories
137 self.left_list = _filter(os.listdir(self.left),
138 self.hide+self.ignore)
139 self.right_list = _filter(os.listdir(self.right),
140 self.hide+self.ignore)
141 self.left_list.sort()
142 self.right_list.sort()
144 def phase1(self): # Compute common names
145 a = dict(zip(map(os.path.normcase, self.left_list), self.left_list))
146 b = dict(zip(map(os.path.normcase, self.right_list), self.right_list))
147 self.common = list(map(a.__getitem__, filter(b.__contains__, a)))
148 self.left_only = list(map(a.__getitem__, filterfalse(b.__contains__, a)))
149 self.right_only = list(map(b.__getitem__, filterfalse(a.__contains__, b)))
151 def phase2(self): # Distinguish files, directories, funnies
152 self.common_dirs = []
153 self.common_files = []
154 self.common_funny = []
156 for x in self.common:
157 a_path = os.path.join(self.left, x)
158 b_path = os.path.join(self.right, x)
176 self.common_funny.append(x)
178 self.common_dirs.append(x)
180 self.common_files.append(x)
182 self.common_funny.append(x)
184 self.common_funny.append(x)
186 def phase3(self): # Find out differences between common files
187 xx = cmpfiles(self.left, self.right, self.common_files)
188 self.same_files, self.diff_files, self.funny_files = xx
190 def phase4(self): # Find out differences between common subdirectories
195 self.subdirs = {}
196 for x in self.common_dirs:
197 a_x = os.path.join(self.left, x)
198 b_x = os.path.join(self.right, x)
199 self.subdirs[x] = self.__class__(a_x, b_x, self.ignore, self.hide)
201 def phase4_closure(self): # Recursively call phase4() on subdirectories
202 self.phase4()
203 for sd in self.subdirs.values():
206 def report(self): # Print a report on the differences between a and b
208 print('diff', self.left, self.right)
209 if self.left_only:
210 self.left_only.sort()
211 print('Only in', self.left, ':', self.left_only)
212 if self.right_only:
213 self.right_only.sort()
214 print('Only in', self.right, ':', self.right_only)
215 if self.same_files:
216 self.same_files.sort()
217 print('Identical files :', self.same_files)
218 if self.diff_files:
219 self.diff_files.sort()
220 print('Differing files :', self.diff_files)
221 if self.funny_files:
222 self.funny_files.sort()
223 print('Trouble with common files :', self.funny_files)
224 if self.common_dirs:
225 self.common_dirs.sort()
226 print('Common subdirectories :', self.common_dirs)
227 if self.common_funny:
228 self.common_funny.sort()
229 print('Common funny cases :', self.common_funny)
231 def report_partial_closure(self): # Print reports on self and on subdirs
232 self.report()
233 for sd in self.subdirs.values():
237 def report_full_closure(self): # Report on self and subdirs recursively
238 self.report()
239 for sd in self.subdirs.values():
249 def __getattr__(self, attr):
250 if attr not in self.methodmap:
252 self.methodmap[attr](self)
253 return getattr(self, attr)