當前位置: 首頁>>代碼示例>>Python>>正文


Python gc.DEBUG_LEAK屬性代碼示例

本文整理匯總了Python中gc.DEBUG_LEAK屬性的典型用法代碼示例。如果您正苦於以下問題:Python gc.DEBUG_LEAK屬性的具體用法?Python gc.DEBUG_LEAK怎麽用?Python gc.DEBUG_LEAK使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在gc的用法示例。


在下文中一共展示了gc.DEBUG_LEAK屬性的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: argp_add_default_args

# 需要導入模塊: import gc [as 別名]
# 或者: from gc import DEBUG_LEAK [as 別名]
def argp_add_default_args(parser, default_root=''):
	"""
	Add standard arguments to a new :py:class:`argparse.ArgumentParser`
	instance. Used to add the utilities argparse options to the wrapper for
	display.

	:param parser: The parser to add arguments to.
	:type parser: :py:class:`argparse.ArgumentParser`
	:param str default_root: The default root logger to specify.
	"""
	parser.add_argument('-v', '--version', action='version', version=parser.prog + ' Version: ' + version.version)

	log_group = parser.add_argument_group('logging options')
	log_group.add_argument('-L', '--log', dest='loglvl', type=str.upper, choices=('DEBUG', 'INFO', 'WARNING', 'ERROR', 'FATAL'), help='set the logging level')
	log_group.add_argument('--logger', default=default_root, help='specify the root logger')

	gc_group = parser.add_argument_group('garbage collector options')
	gc_group.add_argument('--gc-debug-leak', action='store_const', const=gc.DEBUG_LEAK, default=0, help='set the DEBUG_LEAK flag')
	gc_group.add_argument('--gc-debug-stats', action='store_const', const=gc.DEBUG_STATS, default=0, help='set the DEBUG_STATS flag')
	return parser 
開發者ID:rsmusllp,項目名稱:king-phisher,代碼行數:22,代碼來源:startup.py

示例2: test_main

# 需要導入模塊: import gc [as 別名]
# 或者: from gc import DEBUG_LEAK [as 別名]
def test_main():
    enabled = gc.isenabled()
    gc.disable()
    assert not gc.isenabled()
    debug = gc.get_debug()
    gc.set_debug(debug & ~gc.DEBUG_LEAK) # this test is supposed to leak

    try:
        gc.collect() # Delete 2nd generation garbage
        run_unittest(GCTests, GCTogglingTests)
    finally:
        gc.set_debug(debug)
        # test gc.enable() even if GC is disabled by default
        if verbose:
            print "restoring automatic collection"
        # make sure to always test gc.enable()
        gc.enable()
        assert gc.isenabled()
        if not enabled:
            gc.disable() 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:22,代碼來源:test_gc.py

示例3: test_main

# 需要導入模塊: import gc [as 別名]
# 或者: from gc import DEBUG_LEAK [as 別名]
def test_main():
    enabled = gc.isenabled()
    gc.disable()
    assert not gc.isenabled()
    debug = gc.get_debug()
    gc.set_debug(debug & ~gc.DEBUG_LEAK) # this test is supposed to leak

    try:
        gc.collect() # Delete 2nd generation garbage
        run_unittest(GCTests, GCTogglingTests, GCCallbackTests)
    finally:
        gc.set_debug(debug)
        # test gc.enable() even if GC is disabled by default
        if verbose:
            print("restoring automatic collection")
        # make sure to always test gc.enable()
        gc.enable()
        assert gc.isenabled()
        if not enabled:
            gc.disable() 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:22,代碼來源:test_gc.py

示例4: test

# 需要導入模塊: import gc [as 別名]
# 或者: from gc import DEBUG_LEAK [as 別名]
def test():
    if verbose:
        print "disabling automatic collection"
    enabled = gc.isenabled()
    gc.disable()
    verify(not gc.isenabled())
    debug = gc.get_debug()
    gc.set_debug(debug & ~gc.DEBUG_LEAK) # this test is supposed to leak

    try:
        test_all()
    finally:
        gc.set_debug(debug)
        # test gc.enable() even if GC is disabled by default
        if verbose:
            print "restoring automatic collection"
        # make sure to always test gc.enable()
        gc.enable()
        verify(gc.isenabled())
        if not enabled:
            gc.disable() 
開發者ID:ofermend,項目名稱:medicare-demo,代碼行數:23,代碼來源:test_gc.py

示例5: test_main

# 需要導入模塊: import gc [as 別名]
# 或者: from gc import DEBUG_LEAK [as 別名]
def test_main():
    enabled = gc.isenabled()
    try:
        gc.disable()
        assert not gc.isenabled()
    except  NotImplementedError:
        pass
    debug = gc.get_debug()
    gc.set_debug(debug & ~gc.DEBUG_LEAK) # this test is supposed to leak

    try:
        gc.collect() # Delete 2nd generation garbage
        run_unittest(GCTests, GCTogglingTests)
    finally:
        gc.set_debug(debug)
        # test gc.enable() even if GC is disabled by default
        if verbose:
            print "restoring automatic collection"
        # make sure to always test gc.enable()
        gc.enable()
        assert gc.isenabled()
        if not enabled:
            gc.disable() 
開發者ID:Acmesec,項目名稱:CTFCrackTools-V2,代碼行數:25,代碼來源:test_gc.py

示例6: test_debug_stats

# 需要導入模塊: import gc [as 別名]
# 或者: from gc import DEBUG_LEAK [as 別名]
def test_debug_stats(self):
        self.assertEqual(1,gc.DEBUG_STATS)
        self.assertEqual(2,gc.DEBUG_COLLECTABLE)
        self.assertEqual(4,gc.DEBUG_UNCOLLECTABLE)
        self.assertEqual(8,gc.DEBUG_INSTANCES)
        self.assertEqual(16,gc.DEBUG_OBJECTS)
        self.assertEqual(32,gc.DEBUG_SAVEALL)
        self.assertEqual(62,gc.DEBUG_LEAK) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:10,代碼來源:test_gc.py

示例7: test_get_debug

# 需要導入模塊: import gc [as 別名]
# 或者: from gc import DEBUG_LEAK [as 別名]
def test_get_debug(self):
        state = [0,gc.DEBUG_STATS,gc.DEBUG_COLLECTABLE,gc.DEBUG_UNCOLLECTABLE,gc.DEBUG_INSTANCES,gc.DEBUG_OBJECTS,gc.DEBUG_SAVEALL,gc.DEBUG_LEAK]
        result = gc.get_debug()
        if result not in state:
            self.fail("Returned value of getdebug method is not valid value:" + str(result)) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:7,代碼來源:test_gc.py

示例8: test_debug_stats

# 需要導入模塊: import gc [as 別名]
# 或者: from gc import DEBUG_LEAK [as 別名]
def test_debug_stats(self):
        self.assertEqual(1,gc.DEBUG_STATS)
        self.assertEqual(2,gc.DEBUG_COLLECTABLE)
        self.assertEqual(4,gc.DEBUG_UNCOLLECTABLE)
        self.assertEqual(32,gc.DEBUG_SAVEALL)
        self.assertEqual(38,gc.DEBUG_LEAK) 
開發者ID:IronLanguages,項目名稱:ironpython3,代碼行數:8,代碼來源:test_gc.py

示例9: test_get_debug

# 需要導入模塊: import gc [as 別名]
# 或者: from gc import DEBUG_LEAK [as 別名]
def test_get_debug(self):
        state = [0,gc.DEBUG_STATS,gc.DEBUG_COLLECTABLE,gc.DEBUG_UNCOLLECTABLE,gc.DEBUG_SAVEALL,gc.DEBUG_LEAK]
        result = gc.get_debug()
        if result not in state:
            self.fail("Returned value of getdebug method is not valid value:" + str(result)) 
開發者ID:IronLanguages,項目名稱:ironpython3,代碼行數:7,代碼來源:test_gc.py


注:本文中的gc.DEBUG_LEAK屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。