def walk(self, top):
if not top:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if isinstance(top, basestring):<EOL><INDENT>top = self.get_path_info(top)<EOL><DEDENT>yield top<EOL>if top['<STR_LIT>'] == '<STR_LIT>':<EOL><INDENT>for info in self.list_directory(top['<STR_LIT:name>']):<EOL><INDENT>for item in self.walk(info):<EOL><INDENT>yield item<EOL><DEDENT><DEDENT><DEDENT>
Generate infos for all paths in the tree rooted at ``top`` (included).

The ``top`` parameter can be either an HDFS path string or a
dictionary of properties as returned by :meth:`get_path_info`.

:type top: str, dict
:param top: an HDFS path or path info dict
:rtype: iterator
:return: path infos of files and directories in the tree rooted at
  ``top``
:raises: :exc:`~exceptions.IOError`; :exc:`~exceptions.ValueError`
  if ``top`` is empty