我们从Python开源项目中,提取了以下9个代码示例,用于说明如何使用random.__all__()。
def test__all__(self): # tests validity but not completeness of the __all__ list self.assertTrue(set(random.__all__) <= set(dir(random)))
def install_random_wrapper(): """ random ??? ???? assert ??""" import random os.urandom = random_wrapper for sym in random.__all__: m = getattr(random, sym) if callable(m): setattr(random, sym, random_wrapper)