parameters: (path, cwd=None)
return_statement: return relpath
docstring: Return relative or absolute path name, whichever is shortest.
docstring_summary: Return relative or absolute path name, whichever is shortest.
docstring_tokens: Return relative or absolute path name whichever is shortest .
function: def short_path(path, cwd=None):
      """
      Return relative or absolute path name, whichever is shortest.
      """
      if not isinstance(path, str):
          return path
      if cwd is None:
          cwd = os.getcwd()
      abspath = os.path.abspath(path)
      relpath = os.path.relpath(path, cwd)
      if len(abspath) <= len(relpath):
          return abspath
      return relpath
function_tokens: def short_path ( path , cwd = None ) : if not isinstance ( path , str ) : return path if cwd is None : cwd = os . getcwd ( ) abspath = os . path . abspath ( path ) relpath = os . path . relpath ( path , cwd ) if len ( abspath ) <= len ( relpath ) : return abspath return relpath