MCPcopy Index your code
hub / github.com/fastapi/fastapi / update_content

Function update_content

scripts/contributors.py:226–235  ·  view source on GitHub ↗
(*, content_path: Path, new_content: Any)

Source from the content-addressed store, hash-verified

224
225
226def update_content(*, content_path: Path, new_content: Any) -> bool:
227 old_content = content_path.read_text(encoding="utf-8")
228
229 new_content = yaml.dump(new_content, sort_keys=False, width=200, allow_unicode=True)
230 if old_content == new_content:
231 logging.info(f"The content hasn't changed for {content_path}")
232 return False
233 content_path.write_text(new_content, encoding="utf-8")
234 logging.info(f"Updated {content_path}")
235 return True
236
237
238def main() -> None:

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…