MCPcopy Index your code
hub / github.com/python/cpython / wrapper

Function wrapper

Platforms/WASI/_build.py:107–125  ·  view source on GitHub ↗
(context)

Source from the content-addressed store, hash-verified

105 def decorator(func):
106 @functools.wraps(func)
107 def wrapper(context):
108 nonlocal working_dir
109
110 if callable(working_dir):
111 working_dir = working_dir(context)
112 separator()
113 log("📁", os.fsdecode(working_dir))
114 if (
115 clean_ok
116 and getattr(context, "clean", False)
117 and working_dir.exists()
118 ):
119 log("🚮", "Deleting directory (--clean)...")
120 shutil.rmtree(working_dir)
121
122 working_dir.mkdir(parents=True, exist_ok=True)
123
124 with contextlib.chdir(working_dir):
125 return func(context, working_dir)
126
127 return wrapper
128

Callers

nothing calls this directly

Calls 5

separatorFunction · 0.85
logFunction · 0.70
funcFunction · 0.50
existsMethod · 0.45
mkdirMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…