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

Function wrapper

Platforms/emscripten/__main__.py:159–181  ·  view source on GitHub ↗
(context)

Source from the content-addressed store, hash-verified

157 def decorator(func):
158 @functools.wraps(func)
159 def wrapper(context):
160 working_dir = context.build_paths[path_key]
161 try:
162 tput_output = subprocess.check_output(
163 ["tput", "cols"], encoding="utf-8"
164 )
165 terminal_width = int(tput_output.strip())
166 except subprocess.CalledProcessError:
167 terminal_width = 80
168 print("⎯" * terminal_width)
169 print("📁", working_dir)
170 if (
171 clean_ok
172 and getattr(context, "clean", False)
173 and working_dir.exists()
174 ):
175 print("🚮 Deleting directory (--clean)...")
176 shutil.rmtree(working_dir)
177
178 working_dir.mkdir(parents=True, exist_ok=True)
179
180 with contextlib.chdir(working_dir):
181 return func(context, working_dir)
182
183 return wrapper
184

Callers

nothing calls this directly

Calls 5

funcFunction · 0.50
check_outputMethod · 0.45
stripMethod · 0.45
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…