本文整理汇总了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)
示例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])
示例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)