当前位置: 首页>>代码示例>>Python>>正文


Python COW.COWDictBase类代码示例

本文整理汇总了Python中bb.COW.COWDictBase的典型用法代码示例。如果您正苦于以下问题:Python COWDictBase类的具体用法?Python COWDictBase怎么用?Python COWDictBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了COWDictBase类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self, special = COWDictBase.copy(), seen = COWDictBase.copy() ):
        self.dict = {}

        # cookie monster tribute
        self._special_values = special
        self._seen_overrides = seen

        self.expand_cache = {}
开发者ID:izzetaykutkocak,项目名称:poky-e100,代码行数:8,代码来源:data_smart.py

示例2: __init__

    def __init__(self, special = COWDictBase.copy(), seen = COWDictBase.copy() ):
        self.dict = {}

        self.inchistory = IncludeHistory()
        self.varhistory = VariableHistory(self)
        self._tracking = False

        # cookie monster tribute
        self._special_values = special
        self._seen_overrides = seen

        self.expand_cache = {}
开发者ID:karfield,项目名称:bitbake,代码行数:12,代码来源:data_smart.py

示例3: testCow

    def testCow(self):
        from bb.COW import COWDictBase
        c = COWDictBase.copy()
        c['123'] = 1027
        c['other'] = 4711
        c['d'] = { 'abc' : 10, 'bcd' : 20 }

        copy = c.copy()

        self.assertEquals(1027, c['123'])
        self.assertEquals(4711, c['other'])
        self.assertEquals({'abc':10, 'bcd':20}, c['d'])
        self.assertEquals(1027, copy['123'])
        self.assertEquals(4711, copy['other'])
        self.assertEquals({'abc':10, 'bcd':20}, copy['d'])

        # cow it now
        copy['123'] = 1028
        copy['other'] = 4712
        copy['d']['abc'] = 20


        self.assertEquals(1027, c['123'])
        self.assertEquals(4711, c['other'])
        self.assertEquals({'abc':10, 'bcd':20}, c['d'])
        self.assertEquals(1028, copy['123'])
        self.assertEquals(4712, copy['other'])
        self.assertEquals({'abc':20, 'bcd':20}, copy['d'])
开发者ID:BackupTheBerlios,项目名称:bitbake-svn,代码行数:28,代码来源:cowtest.py

示例4: testGetSet

    def testGetSet(self):
        """
        Test and set
        """
        from bb.COW import COWDictBase
        a = COWDictBase.copy()

        self.assertEquals(False, a.has_key('a'))

        a['a'] = 'a'
        a['b'] = 'b'
        self.assertEquals(True, a.has_key('a'))
        self.assertEquals(True, a.has_key('b'))
        self.assertEquals('a', a['a'] )
        self.assertEquals('b', a['b'] )
开发者ID:BackupTheBerlios,项目名称:bitbake-svn,代码行数:15,代码来源:cowtest.py

示例5: testGetSet

    def testGetSet(self):
        """
        Test and set
        """
        from bb.COW import COWDictBase
        a = COWDictBase.copy()

        self.assertEqual(False, 'a' in a)

        a['a'] = 'a'
        a['b'] = 'b'
        self.assertEqual(True, 'a' in a)
        self.assertEqual(True, 'b' in a)
        self.assertEqual('a', a['a'] )
        self.assertEqual('b', a['b'] )
开发者ID:01org,项目名称:luv-yocto,代码行数:15,代码来源:cow.py

示例6: __init__

 def __init__(self, dataroot):
     self.dataroot = dataroot
     self.variables = COWDictBase.copy()
开发者ID:Brainbuster,项目名称:opennfr-buildumgebung,代码行数:3,代码来源:data_smart.py

示例7: __setstate__

 def __setstate__(self, state):
     self.dataroot = state['dataroot']
     self.variables = COWDictBase.copy()
     for k, v in state['variables'].items():
         self.variables[k] = v
开发者ID:ISI-apex,项目名称:hpsc-bsp,代码行数:5,代码来源:data_smart.py

示例8: testCopyCopy

    def testCopyCopy(self):
        """
        Test the copy of copies
        """

        from bb.COW import COWDictBase

        # create two COW dict 'instances'
        b = COWDictBase.copy()
        c = COWDictBase.copy()

        # assign some keys to one instance, some keys to another
        b['a'] = 10
        b['c'] = 20
        c['a'] = 30

        # test separation of the two instances
        self.assertEquals(False, c.has_key('c'))
        self.assertEquals(30, c['a'])
        self.assertEquals(10, b['a'])

        # test copy
        b_2 = b.copy()
        c_2 = c.copy()

        self.assertEquals(False, c_2.has_key('c'))
        self.assertEquals(10, b_2['a'])

        b_2['d'] = 40
        self.assertEquals(False, c_2.has_key('d'))
        self.assertEquals(True, b_2.has_key('d'))
        self.assertEquals(40, b_2['d'])
        self.assertEquals(False, b.has_key('d'))
        self.assertEquals(False, c.has_key('d'))

        c_2['d'] = 30
        self.assertEquals(True, c_2.has_key('d'))
        self.assertEquals(True, b_2.has_key('d'))
        self.assertEquals(30, c_2['d'])
        self.assertEquals(40, b_2['d'])
        self.assertEquals(False, b.has_key('d'))
        self.assertEquals(False, c.has_key('d'))

        # test copy of the copy
        c_3 = c_2.copy()
        b_3 = b_2.copy()
        b_3_2 = b_2.copy()

        c_3['e'] = 4711
        self.assertEquals(4711, c_3['e'])
        self.assertEquals(False, c_2.has_key('e'))
        self.assertEquals(False, b_3.has_key('e'))
        self.assertEquals(False, b_3_2.has_key('e'))
        self.assertEquals(False, b_2.has_key('e'))

        b_3['e'] = 'viel'
        self.assertEquals('viel', b_3['e'])
        self.assertEquals(4711, c_3['e'])
        self.assertEquals(False, c_2.has_key('e'))
        self.assertEquals(True, b_3.has_key('e'))
        self.assertEquals(False, b_3_2.has_key('e'))
        self.assertEquals(False, b_2.has_key('e'))
开发者ID:BackupTheBerlios,项目名称:bitbake-svn,代码行数:62,代码来源:cowtest.py


注:本文中的bb.COW.COWDictBase类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。