MCPcopy Create free account
hub / github.com/InternScience/SciReason / Capturing

Class Capturing

opencompass/datasets/apps.py:329–341  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

327# from https://stackoverflow.com/a/16571630/6416660
328# alternative use redirect_stdout() from contextlib
329class Capturing(list):
330
331 def __enter__(self):
332 self._stdout = sys.stdout
333 sys.stdout = self._stringio = StringIO()
334 # Make closing the StringIO a no-op
335 self._stringio.close = lambda x: 1
336 return self
337
338 def __exit__(self, *args):
339 self.extend(self._stringio.getvalue().splitlines())
340 del self._stringio # free up some memory
341 sys.stdout = self._stdout
342
343
344def run_test(sample, test=None, debug=False):

Callers 1

run_testFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected