def _should_include_path(path, includes, excludes):
 from os.path import basename
 from fnmatch import fnmatch
 base = basename(path)
 if includes:
  for include in includes:
   if fnmatch(base, include):
    try:
     log.debug("include `%s' (matches `%s')", path, include)
    except (NameError, AttributeError):
     pass
    break
  else:
   try:
    log.debug("exclude `%s' (matches no includes)", path)
   except (NameError, AttributeError):
    pass
   return False
 for exclude in excludes:
  if fnmatch(base, exclude):
   try:
    log.debug("exclude `%s' (matches `%s')", path, exclude)
   except (NameError, AttributeError):
    pass
   return False
 return True

def _should_include_path ( path , includes , excludes ) : from os . path import basename from fnmatch import fnmatch base = basename ( path ) if includes : for include in includes : if fnmatch ( base , include ) : try : log . debug ( "include `%s' (matches `%s')" , path , include ) except ( NameError , AttributeError ) : pass break else : try : log . debug ( "exclude `%s' (matches no includes)" , path ) except ( NameError , AttributeError ) : pass return False for exclude in excludes : if fnmatch ( base , exclude ) : try : log . debug ( "exclude `%s' (matches `%s')" , path , exclude ) except ( NameError , AttributeError ) : pass return False return True
return true iff the given path should be included .