MCPcopy
hub / github.com/PrefectHQ/prefect / write_text

Method write_text

src/prefect/utilities/dockerutils.py:363–372  ·  view source on GitHub ↗
(self, text: str, destination: Union[str, PurePosixPath])

Source from the content-addressed store, hash-verified

361 self.add_line(f"COPY {source} {destination}")
362
363 def write_text(self, text: str, destination: Union[str, PurePosixPath]) -> None:
364 if not self.context:
365 raise Exception("No context available")
366
367 if not isinstance(destination, PurePosixPath):
368 destination = PurePosixPath(destination)
369
370 source_hash = hashlib.sha256(text.encode()).hexdigest()
371 (self.context / f".{source_hash}").write_text(text)
372 self.add_line(f"COPY .{source_hash} {destination}")
373
374 def build(
375 self, pull: bool = False, stream_progress_to: Optional[TextIO] = None

Callers 15

_write_markerFunction · 0.80
child_flowFunction · 0.80
async_child_flowFunction · 0.80
background_taskFunction · 0.80
write_task_markerFunction · 0.80
test_docker_deployFunction · 0.80
some_taskMethod · 0.80

Calls 1

add_lineMethod · 0.95

Tested by 15

_write_markerFunction · 0.64
child_flowFunction · 0.64
async_child_flowFunction · 0.64
background_taskFunction · 0.64
write_task_markerFunction · 0.64
test_docker_deployFunction · 0.64
some_taskMethod · 0.64