(filename)
return abspath(filename)
Return the canonical path of the specified filename, eliminating any
symbolic links encountered in the path.
Return the canonical path of the specified filename, eliminating any
symbolic links encountered in the path.
Return the canonical path of the specified filename eliminating any symbolic links encountered in the path .
def realpath(filename):
    """Return the canonical path of the specified filename, eliminating any
symbolic links encountered in the path."""
    if isinstance(filename, bytes):
        sep = b'/'
        empty = b''
    else:
        sep = '/'
        empty = ''
    if isabs(filename):
        bits = [sep] + filename.split(sep)[1:]
    else:
        bits = [empty] + filename.split(sep)

    for i in range(2, len(bits)+1):
        component = join(*bits[0:i])
        # Resolve symbolic links.
        if islink(component):
            resolved = _resolve_link(component)
            if resolved is None:
                # Infinite loop -- return original component + rest of the path
                return abspath(join(*([component] + bits[i:])))
            else:
                newpath = join(*([resolved] + bits[i:]))
                return realpath(newpath)

    return abspath(filename)
def realpath ( filename ) : if isinstance ( filename , bytes ) : sep = b'/' empty = b'' else : sep = '/' empty = '' if isabs ( filename ) : bits = [ sep ] + filename . split ( sep ) [ 1 : ] else : bits = [ empty ] + filename . split ( sep ) for i in range ( 2 , len ( bits ) + 1 ) : component = join ( * bits [ 0 : i ] ) # Resolve symbolic links. if islink ( component ) : resolved = _resolve_link ( component ) if resolved is None : # Infinite loop -- return original component + rest of the path return abspath ( join ( * ( [ component ] + bits [ i : ] ) ) ) else : newpath = join ( * ( [ resolved ] + bits [ i : ] ) ) return realpath ( newpath ) return abspath ( filename )