parameters: (path)
return_statement: return functools.reduce(path_reducer, parents, None)
docstring: Gets the nearest build root to given path
  
      :param path: path to find nearest build root to
      :return: nearest build root
docstring_summary: Gets the nearest build root to given path
docstring_tokens: Gets the nearest build root to given path
function: def get_nearest_build_root(path):
      """
      Gets the nearest build root to given path
  
      :param path: path to find nearest build root to
      :return: nearest build root
      """
      parents = filter(
          lambda build: os.path.commonpath([build, path]) == build, get_build_roots()
      )
  
      def path_reducer(agg, item):
          """Reduces to the longest path"""
          common = os.path.commonpath([item, path])
          if agg is None or len(common) > len(agg):
              return common
          return agg
  
      return functools.reduce(path_reducer, parents, None)
function_tokens: def get_nearest_build_root ( path ) : parents = filter ( lambda build : os . path . commonpath ( [ build , path ] ) == build , get_build_roots ( ) ) def path_reducer ( agg , item ) : """Reduces to the longest path""" common = os . path . commonpath ( [ item , path ] ) if agg is None or len ( common ) > len ( agg ) : return common return agg return functools . reduce ( path_reducer , parents , None )