@staticmethod
def get_path_links(p: Path):
    'Gets path links including all symlinks\n\n        Examples\n        --------\n        In [1]: from IPython.core.interactiveshell import InteractiveShell\n\n        In [2]: import sys, pathlib\n\n        In [3]: paths = InteractiveShell.get_path_links(pathlib.Path(sys.executable))\n\n        In [4]: len(paths) == len(set(paths))\n        Out[4]: True\n\n        In [5]: bool(paths)\n        Out[5]: True\n        '
    paths = [p]
    while p.is_symlink():
        new_path = Path(os.readlink(p))
        if (not new_path.is_absolute()):
            new_path = (p.parent / new_path)
        p = new_path
        paths.append(p)
    return paths
Gets path links including all symlinks

Examples
--------
In [1]: from IPython.core.interactiveshell import InteractiveShell

In [2]: import sys, pathlib

In [3]: paths = InteractiveShell.get_path_links(pathlib.Path(sys.executable))

In [4]: len(paths) == len(set(paths))
Out[4]: True

In [5]: bool(paths)
Out[5]: True
@staticmethod
def get_path_links(p: Path):
    'Gets path links including all symlinks\n\n        Examples\n        --------\n        In [1]: from IPython.core.interactiveshell import InteractiveShell\n\n        In [2]: import sys, pathlib\n\n        In [3]: paths = InteractiveShell.get_path_links(pathlib.Path(sys.executable))\n\n        In [4]: len(paths) == len(set(paths))\n        Out[4]: True\n\n        In [5]: bool(paths)\n        Out[5]: True\n        '
    paths = [p]
    while p.is_symlink():
        new_path = Path(os.readlink(p))
        if (not new_path.is_absolute()):
            new_path = (p.parent / new_path)
        p = new_path
        paths.append(p)
    return paths