本文整理汇总了Python中DBManager.DBManager.getNodes方法的典型用法代码示例。如果您正苦于以下问题:Python DBManager.getNodes方法的具体用法?Python DBManager.getNodes怎么用?Python DBManager.getNodes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBManager.DBManager
的用法示例。
在下文中一共展示了DBManager.getNodes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createNodes
# 需要导入模块: from DBManager import DBManager [as 别名]
# 或者: from DBManager.DBManager import getNodes [as 别名]
def createNodes(self):
#get data for nodes in the session
db = DBManager()
nodesData = db.getNodes(self.tblName)
db.close()
#create a new Node object for each nodeData row in nodesData
# if such an object does not already exist
for nodeData in nodesData:
if not nodeData['devID'] in self.nodesDict:
#add NodeHandler object to the list of nodes
self.nodes.append(NodeHandler(nodeData))
#add devID key to nodesDict and set to false(not started yet)
self.nodesDict[nodeData['devID']] = False
示例2:
# 需要导入模块: from DBManager import DBManager [as 别名]
# 或者: from DBManager.DBManager import getNodes [as 别名]
#free a node
db.freeNode(args.free)
print "Freed node with device ID: " + args.free
elif args.SESSIONS == True:
#list all sessions
print "\t-----Session List-----"
sessions = db.getSessions()
for session in sessions:
print session
elif args.NODES != None:
#list nodes
if args.NODES == '0':
print "\t-----Node List-----"
nodes = db.getNodes()
else:
print "\t-----Node List in Session : %s-----" % args.NODES
nodes = db.getNodes(args.NODES)
for node in nodes:
print node
else:
#------------------------------------------TESTING CODE---------------------------------------------------#
ses = 'testsession'
dev1 = 'testdevx'
dev2 = 'testdevy'
dev3 = 'testdevz'
dev4 = 'testdevu'
cont1 = {'fName':'testfName', 'lName':'testlName', 'email':'[email protected]', 'sms':'18453384705'}
badfName = 'bad1234'
badlName = 'bad5678'