MCPcopy Index your code
hub / github.com/ipython/ipython / get_path_links

Method get_path_links

IPython/core/interactiveshell.py:907–931  ·  view source on GitHub ↗

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)

(p: Path)

Source from the content-addressed store, hash-verified

905
906 @staticmethod
907 def get_path_links(p: Path):
908 """Gets path links including all symlinks
909
910 Examples
911 --------
912 In [1]: from IPython.core.interactiveshell import InteractiveShell
913
914 In [2]: import sys, pathlib
915
916 In [3]: paths = InteractiveShell.get_path_links(pathlib.Path(sys.executable))
917
918 In [4]: len(paths) == len(set(paths))
919 Out[4]: True
920
921 In [5]: bool(paths)
922 Out[5]: True
923 """
924 paths = [p]
925 while p.is_symlink():
926 new_path = Path(os.readlink(p))
927 if not new_path.is_absolute():
928 new_path = p.parent / new_path
929 p = new_path
930 paths.append(p)
931 return paths
932
933 def init_virtualenv(self):
934 """Add the current virtualenv to sys.path so the user can import modules from it.

Callers 1

init_virtualenvMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected