MCPcopy Create free account
hub / github.com/PaddlePaddle/FastDeploy / temp_env

Function temp_env

tests/operators/test_tree_mask.py:39–48  ·  view source on GitHub ↗
(key, value)

Source from the content-addressed store, hash-verified

37
38@contextmanager
39def temp_env(key, value):
40 old_val = os.environ.get(key)
41 os.environ[key] = value
42 try:
43 yield
44 finally:
45 if old_val is None:
46 os.environ.pop(key, None)
47 else:
48 os.environ[key] = old_val
49
50
51class TestTreeMask(unittest.TestCase):

Callers 1

Calls 2

popMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected