MCPcopy
hub / github.com/huggingface/smolagents / PrintContainer

Class PrintContainer

src/smolagents/local_python_executor.py:240–263  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

238
239
240class PrintContainer:
241 def __init__(self):
242 self.value = ""
243
244 def append(self, text):
245 self.value += text
246 return self
247
248 def __iadd__(self, other):
249 """Implements the += operator"""
250 self.value += str(other)
251 return self
252
253 def __str__(self):
254 """String representation"""
255 return self.value
256
257 def __repr__(self):
258 """Representation for debugging"""
259 return f"PrintContainer({self.value})"
260
261 def __len__(self):
262 """Implements len() function support"""
263 return len(self.value)
264
265
266class BreakException(Exception):

Callers 7

test_initial_valueMethod · 0.90
test_appendMethod · 0.90
test_iaddMethod · 0.90
test_strMethod · 0.90
test_reprMethod · 0.90
test_lenMethod · 0.90
evaluate_python_codeFunction · 0.85

Calls

no outgoing calls

Tested by 6

test_initial_valueMethod · 0.72
test_appendMethod · 0.72
test_iaddMethod · 0.72
test_strMethod · 0.72
test_reprMethod · 0.72
test_lenMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…