MCPcopy
hub / github.com/verl-project/verl / call_method

Function call_method

verl/utils/reward_score/prime_code/testing_util.py:577–600  ·  view source on GitHub ↗
(method, inputs)

Source from the content-addressed store, hash-verified

575
576
577def call_method(method, inputs):
578 if isinstance(inputs, list):
579 inputs = "\n".join(inputs)
580
581 inputs_line_iterator = iter(inputs.split("\n"))
582
583 # sys.setrecursionlimit(10000)
584
585 # @patch('builtins.input', side_effect=inputs.split("\n"))
586 @patch("builtins.open", mock_open(read_data=inputs))
587 @patch("sys.stdin", StringIO(inputs))
588 @patch("sys.stdin.readline", lambda *args: next(inputs_line_iterator))
589 @patch("sys.stdin.readlines", lambda *args: inputs.split("\n"))
590 @patch("sys.stdin.read", lambda *args: inputs)
591 # @patch('sys.stdout.write', print)
592 def _inner_call_method(_method):
593 try:
594 return _method()
595 except SystemExit:
596 pass
597 finally:
598 pass
599
600 return _inner_call_method(method)
601
602
603def reliability_guard(maximum_memory_bytes=None):

Callers 1

run_testFunction · 0.85

Calls 2

_inner_call_methodFunction · 0.85
splitMethod · 0.45

Tested by

no test coverage detected