MCPcopy
hub / github.com/doocs/leetcode / remove_header

Function remove_header

run_format.py:244–261  ·  view source on GitHub ↗

Remove header from php and go files

(path: str)

Source from the content-addressed store, hash-verified

242
243
244def remove_header(path: str):
245 """Remove header from php and go files"""
246 print(f"[remove header] path: {path}")
247 with open(path, "r", encoding="utf-8") as f:
248 content = f.read()
249 if path.endswith(".php"):
250 content = content.rstrip()
251 content = content.replace("<?php\n", "")
252 elif path.endswith(".go"):
253 content = content.rstrip()
254 if "sorting" not in path:
255 content = content.replace("package main\n\n", "").replace(
256 "package main\n", ""
257 )
258 else:
259 return
260 with open(path, "w", encoding="utf-8") as f:
261 f.write(content)
262
263
264def find_all_paths() -> List[str]:

Callers 2

format_inline_codeFunction · 0.85
runFunction · 0.85

Calls 2

printFunction · 0.85
readMethod · 0.45

Tested by

no test coverage detected