def abspath(hdfs_path, user=None, local=False):
if local:<EOL><INDENT>return '<STR_LIT>' % os.path.abspath(hdfs_path)<EOL><DEDENT>if isfull(hdfs_path):<EOL><INDENT>return hdfs_path<EOL><DEDENT>hostname, port, path = split(hdfs_path, user=user)<EOL>if hostname:<EOL><INDENT>fs = hdfs_fs.hdfs(hostname, port)<EOL>apath = join("<STR_LIT>" % (fs.host, fs.port), path)<EOL>fs.close()<EOL><DEDENT>else:<EOL><INDENT>apath = "<STR_LIT>" % os.path.abspath(path)<EOL><DEDENT>return apath<EOL>
Return an absolute path for ``hdfs_path``.

The ``user`` arg is passed to :func:`split`. The ``local`` argument
forces ``hdfs_path`` to be interpreted as an ordinary local path:

.. code-block:: python

  >>> import os
  >>> os.chdir('/tmp')
  >>> import pydoop.hdfs.path as hpath
  >>> hpath.abspath('file:/tmp')
  'file:/tmp'
  >>> hpath.abspath('file:/tmp', local=True)
  'file:/tmp/file:/tmp'

Note that this function always return a full URI:

.. code-block:: python

  >>> import pydoop.hdfs.path as hpath
  >>> hpath.abspath('/tmp')
  'hdfs://localhost:9000/tmp'