Did I find the right examples for you? yes no

All Samples(2)  |  Call(1)  |  Derive(0)  |  Import(1)
Returns True if path is a child folder of one of the paths in parents, but not excluded under excludes

        def is_parent_path(path, parents, excludes = [ ]):
    """Returns True if path is a child folder of one of the paths in parents, but not excluded under excludes"""
    _path = absdir(os.path.expanduser(os.path.expandvars(path)))
    if not _path:
        return False

    if not _path.endswith(os.path.sep):
        _path = _path + os.path.sep

    for p in parents:
        if os.path.commonprefix([ _path, p ]) == p:
            for excl in excludes:
                if os.path.commonprefix([ _path, excl ]) == excl:
                    return False
            return True

    return False
        


src/p/y/pymutester-0.1.0/mutester/nose_plugins.py   pymutester(Download)
from nose.util import absdir
from nose.plugins import Plugin
from .util import is_parent_path
 
__all__ = [ 'MutantTracker', 'DummyPlugin' ]
    def tr(self, frame, event, arg):
        if event == 'call':
            if is_parent_path(os.path.dirname(frame.f_code.co_filename), self.app_paths, self.exclude_paths):
                if ( frame.f_code.co_filename, frame.f_code.co_name, frame.f_code.co_firstlineno ) not in self.calls:
                    self.calls[( frame.f_code.co_filename, frame.f_code.co_name, frame.f_code.co_firstlineno )] = frame.f_code