MCPcopy Index your code
hub / github.com/modelscope/modelscope / push_python_path

Function push_python_path

modelscope/utils/plugins.py:84–96  ·  view source on GitHub ↗

Prepends the given path to `sys.path`. This method is intended to use with `with`, so after its usage, its value will be removed from `sys.path`.

(path: str)

Source from the content-addressed store, hash-verified

82
83@contextmanager
84def push_python_path(path: str):
85 """
86 Prepends the given path to `sys.path`.
87 This method is intended to use with `with`, so after its usage, its value
88 will be removed from `sys.path`.
89 """
90 path = Path(path).resolve()
91 path = str(path)
92 sys.path.insert(0, path)
93 try:
94 yield
95 finally:
96 sys.path.remove(path)
97
98
99def discover_file_plugins(

Callers 2

discover_pluginsFunction · 0.85

Calls 2

insertMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…