MCPcopy Index your code
hub / github.com/CodeClash-ai/CodeClash / create_file_in_container

Function create_file_in_container

codeclash/utils/environment.py:164–178  ·  view source on GitHub ↗

Create a file with given content on a Docker container. Uses a temporary file on the local filesystem for the transfer.

(
    container: DockerEnvironment,
    *,
    content: str,
    dest_path: str | Path,
)

Source from the content-addressed store, hash-verified

162
163
164def create_file_in_container(
165 container: DockerEnvironment,
166 *,
167 content: str,
168 dest_path: str | Path,
169):
170 """
171 Create a file with given content on a Docker container.
172 Uses a temporary file on the local filesystem for the transfer.
173 """
174 with tempfile.NamedTemporaryFile(mode="w", delete=True, suffix=".tmp", dir=_scratch_dir()) as tmp_file:
175 tmp_file.write(content)
176 tmp_file.flush() # Ensure content is written to disk
177 tmp_file_path = Path(tmp_file.name)
178 copy_to_container(container, tmp_file_path, dest_path)

Callers 6

execute_roundMethod · 0.90
execute_roundMethod · 0.90
validate_codeMethod · 0.90
execute_roundMethod · 0.90
reset_and_apply_patchMethod · 0.90

Calls 2

_scratch_dirFunction · 0.85
copy_to_containerFunction · 0.85

Tested by

no test coverage detected