parameters: (prune_paths, root)
return_statement: return third_party_dirs
docstring: Find all third_party directories underneath the source root.
docstring_summary: Find all third_party directories underneath the source root.
docstring_tokens: Find all third_party directories underneath the source root .
function: def FindThirdPartyDirs(prune_paths, root):
      """Find all third_party directories underneath the source root."""
      third_party_dirs = set()
      for path, dirs, files in os.walk(root):
          path = path[len(root)+1:]  # Pretty up the path.
  
          if path in prune_paths:
              dirs[:] = []
              continue
  
          # Prune out directories we want to skip.
          # (Note that we loop over PRUNE_DIRS so we're not iterating over a
          # list that we're simultaneously mutating.)
          for skip in PRUNE_DIRS:
              if skip in dirs:
                  dirs.remove(skip)
  
          if os.path.basename(path) == 'third_party':
              # Add all subdirectories that are not marked for skipping.
              for dir in dirs:
                  dirpath = os.path.join(path, dir)
                  if dirpath not in prune_paths:
                      third_party_dirs.add(dirpath)
  
              # Don't recurse into any subdirs from here.
              dirs[:] = []
              continue
  
          # Don't recurse into paths in ADDITIONAL_PATHS, like we do with regular
          # third_party/foo paths.
          if path in ADDITIONAL_PATHS:
              dirs[:] = []
  
      for dir in ADDITIONAL_PATHS:
          if dir not in prune_paths:
              third_party_dirs.add(dir)
  
      return third_party_dirs
function_tokens: def FindThirdPartyDirs ( prune_paths , root ) : third_party_dirs = set ( ) for path , dirs , files in os . walk ( root ) : path = path [ len ( root ) + 1 : ] # Pretty up the path. if path in prune_paths : dirs [ : ] = [ ] continue # Prune out directories we want to skip. # (Note that we loop over PRUNE_DIRS so we're not iterating over a # list that we're simultaneously mutating.) for skip in PRUNE_DIRS : if skip in dirs : dirs . remove ( skip ) if os . path . basename ( path ) == 'third_party' : # Add all subdirectories that are not marked for skipping. for dir in dirs : dirpath = os . path . join ( path , dir ) if dirpath not in prune_paths : third_party_dirs . add ( dirpath ) # Don't recurse into any subdirs from here. dirs [ : ] = [ ] continue # Don't recurse into paths in ADDITIONAL_PATHS, like we do with regular # third_party/foo paths. if path in ADDITIONAL_PATHS : dirs [ : ] = [ ] for dir in ADDITIONAL_PATHS : if dir not in prune_paths : third_party_dirs . add ( dir ) return third_party_dirs