MCPcopy Index your code
hub / github.com/python/cpython / CapturedResults

Class CapturedResults

Lib/test/test_interpreters/utils.py:308–332  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

306
307
308class CapturedResults(namedtuple('CapturedResults', 'stdout stderr exc')):
309
310 class Proxy:
311 def __init__(self, capturing):
312 self._capturing = capturing
313 def _finish(self):
314 if self._capturing is None:
315 return
316 self._final = self._capturing.final()
317 self._capturing = None
318 def __iter__(self):
319 self._finish()
320 yield from self._final
321 def __len__(self):
322 self._finish()
323 return len(self._final)
324 def __getattr__(self, name):
325 self._finish()
326 if name.startswith('_'):
327 raise AttributeError(name)
328 return getattr(self._final, name)
329
330 def raise_if_failed(self):
331 if self.exc is not None:
332 raise interpreters.ExecutionFailed(self.exc)
333
334
335def _captured_script(script, *, stdout=True, stderr=False, exc=False):

Callers 1

finalMethod · 0.85

Calls 1

namedtupleFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…