• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python indexed_container.IndexedContainer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: testEmptyFilteredIndexedContainer

 def testEmptyFilteredIndexedContainer(self):
     ic = IndexedContainer()
     self.addProperties(ic)
     self.populate(ic)
     ic.addContainerFilter(self._PROPERTY_STRING_ID, 'aasdfasdfasdf',
             True, False)
     ic.sort([self._PROPERTY_STRING_ID], [True])
开发者ID:Lemoncandy,项目名称:muntjac,代码行数:7,代码来源:TestContainerSorting.py


示例2: testAddItemAtPerformance

 def testAddItemAtPerformance(self):
     times = list()
     for _ in range(self._REPEATS):
         c = IndexedContainer()
         start = 1000 * time.time()
         for _ in range(self._ITEMS):
             c.addItemAt(0)
         times.append((1000 * time.time()) - start)
     self.checkMedian(self._ITEMS, times, "IndexedContainer.addItemAt()", self._ADD_ITEM_AT_FAIL_THRESHOLD)
开发者ID:AvdN,项目名称:muntjac,代码行数:9,代码来源:indexed_container_performance_test.py


示例3: testFilteredIndexedContainer

 def testFilteredIndexedContainer(self):
     ic = IndexedContainer()
     self.addProperties(ic)
     self.populate(ic)
     ic.addContainerFilter(self._PROPERTY_STRING_ID, 'a', True, False)
     ic.sort([self._PROPERTY_STRING_ID], [True])
     self.verifyOrder(ic, [self._ITEM_ANOTHER_NULL, self._ITEM_DATA_MINUS1,
             self._ITEM_DATA_MINUS1_NULL, self._ITEM_DATA_MINUS2,
             self._ITEM_DATA_MINUS2_NULL])
开发者ID:Lemoncandy,项目名称:muntjac,代码行数:9,代码来源:TestContainerSorting.py


示例4: rebuild_editor

 def rebuild_editor ( self ):
     """ Rebuilds the editor after its definition is modified.
     """
     control = self.control
     c = IndexedContainer()
     for name in self.names:
         c.addItem(name)
     control.setContainerDataSource(c)
     self.update_editor()
开发者ID:rwl,项目名称:traitsui,代码行数:9,代码来源:check_list_editor.py


示例5: testAddItemAfterPerformance

 def testAddItemAfterPerformance(self):
     initialId = "Item0"
     times = list()
     for _ in range(self._REPEATS):
         c = IndexedContainer()
         c.addItem(initialId)
         start = 1000 * time.time()
         for _ in range(self._ITEMS):
             c.addItemAfter(initialId)
         times.append((1000 * time.time()) - start)
     self.checkMedian(self._ITEMS, times, "IndexedContainer.addItemAfter()", self._ADD_ITEM_AFTER_FAIL_THRESHOLD)
开发者ID:AvdN,项目名称:muntjac,代码行数:11,代码来源:indexed_container_performance_test.py


示例6: getResolutionContainer

    def getResolutionContainer(self):
        resolutionContainer = IndexedContainer()
        resolutionContainer.addContainerProperty(
                self.resolution_PROPERTY_NAME, str, None)

        for i, res in enumerate(self._resolutions):
            added = resolutionContainer.addItem(res)
            added.getItemProperty(
                    self.resolution_PROPERTY_NAME).setValue(
                            self._resolutionNames[i])

        return resolutionContainer
开发者ID:AvdN,项目名称:muntjac,代码行数:12,代码来源:DateResolutionExample.py


示例7: getNameContainer

 def getNameContainer(cls):
     contactContainer = IndexedContainer()
     contactContainer.addContainerProperty(cls.PERSON_PROPERTY_NAME, str, "")
     i = 0
     while i < 50:
         fn = cls._firstnames[int(random() * len(cls._firstnames))]
         ln = cls._lastnames[int(random() * len(cls._lastnames))]
         idd = fn + ln
         item = contactContainer.addItem(idd)
         if item is not None:
             i += 1
             v = fn + " " + ln
             item.getItemProperty(cls.PERSON_PROPERTY_NAME).setValue(v)
     return contactContainer
开发者ID:rwl,项目名称:muntjac,代码行数:14,代码来源:ExampleUtil.py


示例8: testIndexedContainer

    def testIndexedContainer(self):
        ic = IndexedContainer()

        self.addProperties(ic)
        self.populate(ic)

        ic.sort([self._PROPERTY_STRING_ID], [True])
        self.verifyOrder(ic, [self._ITEM_ANOTHER_NULL, self._ITEM_DATA_MINUS1,
                self._ITEM_DATA_MINUS1_NULL, self._ITEM_DATA_MINUS2,
                self._ITEM_DATA_MINUS2_NULL, self._ITEM_STRING_1,
                self._ITEM_STRING_2, self._ITEM_STRING_NULL2])

        ic.sort([self._PROPERTY_INTEGER_NOT_NULL, self._PROPERTY_INTEGER_NULL2,
                self._PROPERTY_STRING_ID], [True, False, True])
        self.verifyOrder(ic, [self._ITEM_DATA_MINUS2,
                self._ITEM_DATA_MINUS2_NULL, self._ITEM_DATA_MINUS1,
                self._ITEM_DATA_MINUS1_NULL, self._ITEM_ANOTHER_NULL,
                self._ITEM_STRING_NULL2, self._ITEM_STRING_1,
                self._ITEM_STRING_2])

        ic.sort([self._PROPERTY_INTEGER_NOT_NULL, self._PROPERTY_INTEGER_NULL2,
                 self._PROPERTY_STRING_ID], [True, True, True])
        self.verifyOrder(ic, [self._ITEM_DATA_MINUS2_NULL,
                self._ITEM_DATA_MINUS2, self._ITEM_DATA_MINUS1_NULL,
                self._ITEM_DATA_MINUS1, self._ITEM_ANOTHER_NULL,
                self._ITEM_STRING_NULL2, self._ITEM_STRING_1,
                self._ITEM_STRING_2])
开发者ID:Lemoncandy,项目名称:muntjac,代码行数:27,代码来源:TestContainerSorting.py


示例9: testIndedexContainerItemIds

 def testIndedexContainerItemIds(self):
     ic = IndexedContainer()
     ic.addContainerProperty('prop1', str, None)
     idd = ic.addItem()
     ic.getItem(idd).getItemProperty('prop1').setValue('1')
     item2 = ic.addItem('item2')
     item2.getItemProperty('prop1').setValue('2')
     self.serializeAndDeserialize(ic)
开发者ID:Lemoncandy,项目名称:muntjac,代码行数:8,代码来源:TestSerialization.py


示例10: getLocaleContainer

 def getLocaleContainer(cls):
     localeContainer = IndexedContainer()
     localeContainer.addContainerProperty(cls.locale_PROPERTY_LOCALE, Locale, None)
     localeContainer.addContainerProperty(cls.locale_PROPERTY_NAME, str, None)
     for i in range(len(cls._locales)):
         idd = cls._locales[i][2]
         item = localeContainer.addItem(idd)
         v = Locale(cls._locales[i][0], cls._locales[i][1])
         item.getItemProperty(cls.locale_PROPERTY_LOCALE).setValue(v)
         v = cls._locales[i][2]
         item.getItemProperty(cls.locale_PROPERTY_NAME).setValue(v)
     return localeContainer
开发者ID:rwl,项目名称:muntjac,代码行数:12,代码来源:ExampleUtil.py


示例11: testAddItemAfterLastPerformance

 def testAddItemAfterLastPerformance(self):
     # TODO running with less items because slow otherwise
     times = list()
     for _ in range(self._REPEATS):
         c = IndexedContainer()
         c.addItem()
         start = 1000 * time.time()
         for _ in range(self._ITEMS):
             c.addItemAfter(c.lastItemId())
         times.append((1000 * time.time()) - start)
     self.checkMedian(self._ITEMS / 3, times,
             'IndexedContainer.addItemAfter(lastId)',
             self._ADD_ITEM_AFTER_LAST_FAIL_THRESHOLD)
开发者ID:MatiasNAmendola,项目名称:muntjac,代码行数:13,代码来源:indexed_container_performance_test.py


示例12: createDummyData

    def createDummyData(cls):
        fnames = ['Peter', 'Alice', 'Joshua', 'Mike', 'Olivia', 'Nina', 'Alex',
                'Rita', 'Dan', 'Umberto', 'Henrik', 'Rene', 'Lisa', 'Marge']
        lnames = ['Smith', 'Gordon', 'Simpson', 'Brown', 'Clavel', 'Simons',
                'Verne', 'Scott', 'Allison', 'Gates', 'Rowling', 'Barks',
                'Ross', 'Schneider', 'Tate']

        ic = IndexedContainer()

        for p in cls._fields:
            ic.addContainerProperty(p, str, '')

        for _ in range(1000):
            idd = ic.addItem()
            fname = fnames[int( len(fnames) * random() )]
            ic.getContainerProperty(idd, 'First Name').setValue(fname)
            lname = lnames[int( len(lnames) * random() )]
            ic.getContainerProperty(idd, 'Last Name').setValue(lname)

        return ic
开发者ID:AvdN,项目名称:muntjac,代码行数:20,代码来源:SimpleAddressBook.py


示例13: getOrderContainer

    def getOrderContainer(cls):
        container = IndexedContainer()

        # Create the container properties
        container.addContainerProperty(cls.ORDER_DESCRIPTION_PROPERTY_ID, str, "")
        container.addContainerProperty(cls.ORDER_QUANTITY_PROPERTY_ID, int, 0)
        container.addContainerProperty(cls.ORDER_UNITPRICE_PROPERTY_ID, str, "$0")
        container.addContainerProperty(cls.ORDER_ITEMPRICE_PROPERTY_ID, str, "$0")

        # Create some orders
        cls.addOrderToContainer(container, "Domain Name", 3, 7.99)
        cls.addOrderToContainer(container, "SSL Certificate", 1, 119.0)
        cls.addOrderToContainer(container, "Web Hosting", 1, 19.95)
        cls.addOrderToContainer(container, "Email Box", 20, 0.15)
        cls.addOrderToContainer(container, "E-Commerce Setup", 1, 25.0)
        cls.addOrderToContainer(container, "Technical Support", 1, 50.0)

        return container
开发者ID:rwl,项目名称:muntjac,代码行数:18,代码来源:ExampleUtil.py


示例14: createContainer

    def createContainer(cls):
        """Creates a container with three properties "col1,col2,col3"
        with 100 items

        @return: Returns the created table
        """
        container = IndexedContainer()
        container.addContainerProperty('col1', str, '')
        container.addContainerProperty('col2', str, '')
        container.addContainerProperty('col3', str, '')

        for i in range(100):
            item = container.addItem('item %d' % i)
            item.getItemProperty('col1').setValue('first%d' % i)
            item.getItemProperty('col2').setValue('middle%d' % i)
            item.getItemProperty('col3').setValue('last%d' % i)

        return container
开发者ID:AvdN,项目名称:muntjac,代码行数:18,代码来源:test_footer.py


示例15: testItemSetChangeListeners

    def testItemSetChangeListeners(self):
        container = IndexedContainer()
        counter = ItemSetChangeCounter()
        container.addListener(counter)

        id1 = 'id1'
        id2 = 'id2'
        id3 = 'id3'

        self.initializeContainer(container)
        counter.reset()
        container.addItem()
        counter.assertOnce()
        container.addItem(id1)
        counter.assertOnce()

        self.initializeContainer(container)
        counter.reset()
        container.addItemAt(0)
        counter.assertOnce()
        container.addItemAt(0, id1)
        counter.assertOnce()
        container.addItemAt(0, id2)
        counter.assertOnce()
        container.addItemAt(len(container), id3)
        counter.assertOnce()
        # no notification if already in container
        container.addItemAt(0, id1)
        counter.assertNone()

        self.initializeContainer(container)
        counter.reset()
        container.addItemAfter(None)
        counter.assertOnce()
        container.addItemAfter(None, id1)
        counter.assertOnce()
        container.addItemAfter(id1)
        counter.assertOnce()
        container.addItemAfter(id1, id2)
        counter.assertOnce()
        container.addItemAfter(container.firstItemId())
        counter.assertOnce()
        container.addItemAfter(container.lastItemId())
        counter.assertOnce()
        container.addItemAfter(container.lastItemId(), id3)
        counter.assertOnce()
        # no notification if already in container
        container.addItemAfter(0, id1)
        counter.assertNone()

        self.initializeContainer(container)
        counter.reset()
        container.removeItem(self.sampleData[0])
        counter.assertOnce()

        self.initializeContainer(container)
        counter.reset()
        # no notification for removing a non-existing item
        container.removeItem(id1)
        counter.assertNone()

        self.initializeContainer(container)
        counter.reset()
        container.removeAllItems()
        counter.assertOnce()
        # already empty
        container.removeAllItems()
        counter.assertNone()
开发者ID:kranthikumar,项目名称:muntjac,代码行数:68,代码来源:indexed_container_test.py


示例16: testItemSetChangeListenersFiltering

    def testItemSetChangeListenersFiltering(self):
        container = IndexedContainer()
        counter = ItemSetChangeCounter()
        container.addListener(counter)

        counter.reset()
        container.addContainerFilter(self.FULLY_QUALIFIED_NAME, 'Test', True, False)
        # no real change, so no notification required
        counter.assertNone()

        id1 = 'com.example.Test1'
        id2 = 'com.example.Test2'
        id3 = 'com.example.Other'

        # perform operations while filtering container

        self.initializeContainer(container)
        counter.reset()
        # passes filter
        item = container.addItem(id1)
        # no event if filtered out
        counter.assertNone()
        item.getItemProperty(self.FULLY_QUALIFIED_NAME).setValue(id1)
        counter.assertOnce()
        # passes filter but already in the container
        item = container.addItem(id1)
        counter.assertNone()

        self.initializeContainer(container)
        counter.reset()
        # passes filter after change
        item = container.addItemAt(0, id1)
        counter.assertNone()
        item.getItemProperty(self.FULLY_QUALIFIED_NAME).setValue(id1)
        counter.assertOnce()
        item = container.addItemAt(len(container), id2)
        counter.assertNone()
        item.getItemProperty(self.FULLY_QUALIFIED_NAME).setValue(id2)
        counter.assertOnce()
        # passes filter but already in the container
        item = container.addItemAt(0, id1)
        counter.assertNone()
        item = container.addItemAt(len(container), id2)
        counter.assertNone()

        self.initializeContainer(container)
        counter.reset()
        # passes filter
        item = container.addItemAfter(None, id1)
        counter.assertNone()
        item.getItemProperty(self.FULLY_QUALIFIED_NAME).setValue(id1)
        counter.assertOnce()
        item = container.addItemAfter(container.lastItemId(), id2)
        counter.assertNone()
        item.getItemProperty(self.FULLY_QUALIFIED_NAME).setValue(id2)
        counter.assertOnce()
        # passes filter but already in the container
        item = container.addItemAfter(None, id1)
        counter.assertNone()
        item = container.addItemAfter(container.lastItemId(), id2)
        counter.assertNone()

        # does not pass filter

        # TODO implement rest

        self.initializeContainer(container)
        counter.reset()
        item = container.addItemAfter(None, id3)
        counter.assertNone()
        item.getItemProperty(self.FULLY_QUALIFIED_NAME).setValue(id3)
        counter.assertNone()

        self.initializeContainer(container)
        counter.reset()
        item = container.addItemAfter(container.firstItemId(), id3)
        counter.assertNone()
        item.getItemProperty(self.FULLY_QUALIFIED_NAME).setValue(id3)
        counter.assertNone()

        self.initializeContainer(container)
        counter.reset()
        item = container.addItemAfter(container.lastItemId(), id3)
        counter.assertNone()
        item.getItemProperty(self.FULLY_QUALIFIED_NAME).setValue(id3)
        counter.assertNone()

        self.initializeContainer(container)
        counter.reset()
        item = container.addItemAt(0, id3)
        counter.assertNone()
        item.getItemProperty(self.FULLY_QUALIFIED_NAME).setValue(id3)
        counter.assertNone()

        self.initializeContainer(container)
        counter.reset()
        item = container.addItemAt(1, id3)
        counter.assertNone()
        item.getItemProperty(self.FULLY_QUALIFIED_NAME).setValue(id3)
        counter.assertNone()
#.........这里部分代码省略.........
开发者ID:kranthikumar,项目名称:muntjac,代码行数:101,代码来源:indexed_container_test.py


示例17: testAddRemoveContainerFilter

    def testAddRemoveContainerFilter(self):
        container = IndexedContainer()
        counter = ItemSetChangeCounter()
        container.addListener(counter)

        # simply adding or removing container filters should cause events
        # (content changes)

        self.initializeContainer(container)
        counter.reset()
        container.addContainerFilter(self.SIMPLE_NAME, 'a', True, False)
        counter.assertOnce()
        container.removeContainerFilters(self.SIMPLE_NAME)
        counter.assertOnce()
        container.addContainerFilter(self.SIMPLE_NAME, 'a', True, False)
        counter.assertOnce()
        container.removeAllContainerFilters()
        counter.assertOnce()
开发者ID:kranthikumar,项目名称:muntjac,代码行数:18,代码来源:indexed_container_test.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python i18n._函数代码示例发布时间:2022-05-27
下一篇:
Python api.Label类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap