Changeset 377
- Timestamp:
- 01/19/06 23:49:38 (3 years ago)
- Files:
-
- pydocplugin/0.9/tracpydoc/tracpydoc.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
pydocplugin/0.9/tracpydoc/tracpydoc.py
r373 r377 63 63 shadowed[name] = 1 64 64 65 def matched(file): 66 for match in excludes: 67 if fnmatch(file, match): 68 return 0 69 for match in includes: 70 if fnmatch(file, match): 71 self.env.log.debug(file + ',' + match) 72 return 1 73 return not includes and not excludes 65 matched = PyDoc(self.env).filter_match 74 66 75 67 # Package spam/__init__.py takes precedence over module spam.py. 76 77 # Do matching against include/exclude list78 68 for file in files: 79 69 path = os.path.join(dir, file) … … 155 145 self.syspath = sys.path 156 146 157 self.includes = [p for p in self.config.get('pydoc', 158 'include', '').split() if p] 159 self.excludes = [p for p in self.config.get('pydoc', 160 'exclude', '').split() if p] 147 self.includes, self.excludes = self.get_filters() 161 148 162 149 show_private = self.config.get('pydoc', 'show_private', '') 163 150 self.show_private = [p.rstrip('.*') for p in show_private.split()] 164 151 self.makedoc_lock = threading.Lock() 152 153 def filter_match(self, file): 154 includes, excludes = self.get_filters() 155 for match in excludes: 156 if fnmatch(file, match): 157 return 0 158 for match in includes: 159 if fnmatch(file, match): 160 return 1 161 return not includes 162 163 164 def get_filters(self): 165 return ([p for p in self.config.get('pydoc', 166 'include', '').split() if p], 167 [p for p in self.config.get('pydoc', 168 'exclude', '').split() if p]) 165 169 166 170 def load_object(self, fullobject): … … 366 370 367 371 def get_search_filters(self, req): 368 yield ('pydoc', 'Python Documentation' )372 yield ('pydoc', 'Python Documentation', 0) 369 373 370 374 def get_search_results(self, req, query, filters): 371 375 query = query.split() 372 376 results = [] 377 matched = PyDoc(self.env).filter_match 373 378 if 'pydoc' in filters: 374 379 def callback(path, modname, desc): 375 380 for q in query: 381 if (path and not matched(path)) and (modname and not matched(modname)): 382 return 376 383 if q in modname or q.lower() in desc.lower(): 377 384 results.append((self.env.href.pydoc(modname), modname,
