MCPcopy Index your code
hub / github.com/ipython/ipython / _survives_exclude

Method _survives_exclude

docs/sphinxext/apigen.py:309–348  ·  view source on GitHub ↗

Returns True if *matchstr* does not match patterns ``self.package_name`` removed from front of string if present Examples -------- >>> dw = ApiDocWriter('sphinx') >>> dw._survives_exclude('sphinx.okpkg', 'package') True >>> dw.package_skip_p

(self, matchstr, match_type)

Source from the content-addressed store, hash-verified

307 return ad
308
309 def _survives_exclude(self, matchstr, match_type):
310 ''' Returns True if *matchstr* does not match patterns
311
312 ``self.package_name`` removed from front of string if present
313
314 Examples
315 --------
316 >>> dw = ApiDocWriter('sphinx')
317 >>> dw._survives_exclude('sphinx.okpkg', 'package')
318 True
319 >>> dw.package_skip_patterns.append('^\\.badpkg$')
320 >>> dw._survives_exclude('sphinx.badpkg', 'package')
321 False
322 >>> dw._survives_exclude('sphinx.badpkg', 'module')
323 True
324 >>> dw._survives_exclude('sphinx.badmod', 'module')
325 True
326 >>> dw.module_skip_patterns.append('^\\.badmod$')
327 >>> dw._survives_exclude('sphinx.badmod', 'module')
328 False
329 '''
330 if match_type == 'module':
331 patterns = self.module_skip_patterns
332 elif match_type == 'package':
333 patterns = self.package_skip_patterns
334 else:
335 raise ValueError('Cannot interpret match type "%s"'
336 % match_type)
337 # Match to URI without package name
338 L = len(self.package_name)
339 if matchstr[:L] == self.package_name:
340 matchstr = matchstr[L:]
341 for pat in patterns:
342 try:
343 pat.search
344 except AttributeError:
345 pat = re.compile(pat)
346 if pat.search(matchstr):
347 return False
348 return True
349
350 def discover_modules(self):
351 ''' Return module sequence discovered from ``self.package_name``

Callers 1

discover_modulesMethod · 0.95

Calls 1

searchMethod · 0.45

Tested by

no test coverage detected