MCPcopy Create free account
hub / github.com/aboutcode-org/vulnerablecode / write_file

Function write_file

vulnerabilities/management/commands/export.py:198–206  ·  view source on GitHub ↗

Write the ``data`` as YAML to the ``file_path`` in the ``base_path`` root directory. Create directories in the path as needed.

(base_path: Path, file_path: Path, data: dict)

Source from the content-addressed store, hash-verified

196
197
198def write_file(base_path: Path, file_path: Path, data: dict):
199 """
200 Write the ``data`` as YAML to the ``file_path`` in the ``base_path`` root directory.
201 Create directories in the path as needed.
202 """
203 write_to = base_path / file_path
204 write_to.parent.mkdir(parents=True, exist_ok=True)
205 with open(write_to, encoding="utf-8", mode="w") as f:
206 f.write(saneyaml.dump(data))

Callers 1

export_dataMethod · 0.70

Calls 1

writeMethod · 0.80

Tested by

no test coverage detected