MCPcopy Create free account
hub / github.com/OpenPipe/ART / make_patch_source

Function make_patch_source

tests/integration.py:46–65  ·  view source on GitHub ↗

This is a patch to the art.TrainableModel class to change project name logging these runs as test runs.

()

Source from the content-addressed store, hash-verified

44
45
46def make_patch_source() -> str:
47 """
48 This is a patch to the art.TrainableModel class to change project name logging these runs as test runs.
49 """
50 project = "Tester"
51 return (
52 "try:\n"
53 " import art as _art\n"
54 " import art.model as _art_model\n"
55 "except Exception:\n"
56 " pass\n"
57 "else:\n"
58 " _orig_tm_init = _art_model.TrainableModel.__init__\n"
59 " def _patched_tm_init(self, *args, **kwargs):\n"
60 f" kwargs['project'] = {project!r}\n"
61 " result = _orig_tm_init(self, *args, **kwargs)\n"
62 " return result\n"
63 " _art_model.TrainableModel.__init__ = _patched_tm_init\n"
64 " _art.TrainableModel = _art_model.TrainableModel\n"
65 )
66
67
68def make_variable_override_source(variables: Dict[str, Any]) -> str:

Callers 1

test_notebook_executionFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_notebook_executionFunction · 0.68