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


Python Service.get_all_lists方法代码示例

本文整理汇总了Python中intermine.webservice.Service.get_all_lists方法的典型用法代码示例。如果您正苦于以下问题:Python Service.get_all_lists方法的具体用法?Python Service.get_all_lists怎么用?Python Service.get_all_lists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在intermine.webservice.Service的用法示例。


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

示例1: test_user_registration

# 需要导入模块: from intermine.webservice import Service [as 别名]
# 或者: from intermine.webservice.Service import get_all_lists [as 别名]
    def test_user_registration(self):
        username = 'mayfly-{0}@noreply.intermine.org'.format(uuid.uuid4())
        password = 'yolo'
        try:
            s = Service(self.SERVICE.root, username, password)
            s.deregister(s.get_deregistration_token())
        except:
            pass

        s = self.SERVICE.register(username, password)

        self.assertEqual(s.root, self.SERVICE.root)
        self.assertEqual(2, len(s.get_all_lists()))

        drt = s.get_deregistration_token()
        s.deregister(drt)

        self.assertRaises(WebserviceError, s.get_all_lists)
开发者ID:intermine,项目名称:intermine-ws-client.py,代码行数:20,代码来源:live_results.py

示例2: attack

# 需要导入模块: from intermine.webservice import Service [as 别名]
# 或者: from intermine.webservice.Service import get_all_lists [as 别名]
    def attack(self):
        service = Service(self.service.root)
        self.counter.add(2)

        lists = list(l for l in service.get_all_lists() if l.size and l.status == 'CURRENT')
        Lists.LOG.debug("%d lists", len(lists))
        self.counter.add(1)

        target = random.choice(lists)

        classkeys = None
        with closing(service.opener.open(service.root + "/classkeys")) as sock:
            classkeys = json.loads(sock.read())['classes']
            Lists.LOG.debug("Classkeys for %s are %r", target.name, classkeys[target.list_type])
            self.counter.add(1)

        q = service.query(target.list_type).where(target.list_type, 'IN', target.name)

        index = random.randint(0, target.size - 1)
        rand_member = next(q.rows(size = 1, start = index))
        self.counter.add(1)
        Lists.LOG.debug(rand_member)

        target_keys = classkeys[target.list_type]
        if target_keys:
            lu_q = q.where(target.list_type, 'LOOKUP', rand_member[target_keys[0]])
            Lists.LOG.debug("lookup q: %s", lu_q)
            Lists.LOG.debug("%s should be one", lu_q.count())
            self.counter.add(1)

        suitable_widgets = list(w for w in service.widgets.values() if w['widgetType'] == 'enrichment' and target.list_type in w['targets'])
        self.counter.add(1)

        if not suitable_widgets:
            return

        widget = random.choice(suitable_widgets)

        Lists.LOG.debug("Calculating %s of %s", widget['name'], target.name)
        enriched = list(target.calculate_enrichment(widget['name']))
        self.counter.add(1)

        if enriched:
            Lists.LOG.debug(enriched[0])
开发者ID:alexkalderimis,项目名称:death-by-snoo-snoo,代码行数:46,代码来源:weapons.py

示例3: testListsFromFlyMine

# 需要导入模块: from intermine.webservice import Service [as 别名]
# 或者: from intermine.webservice.Service import get_all_lists [as 别名]
 def testListsFromFlyMine(self):
     s = Service("www.flymine.org/query")
     all_lists = s.get_all_lists()
     possible_statuses = set(["CURRENT", "TO_UPGRADE", "NOT_CURRENT"])
     got = set((l.status for l in all_lists)) 
     self.assertTrue(got <= possible_statuses)
开发者ID:allankamau,项目名称:intermine,代码行数:8,代码来源:live_lists.py


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