本文整理汇总了Python中Tree.print_tree方法的典型用法代码示例。如果您正苦于以下问题:Python Tree.print_tree方法的具体用法?Python Tree.print_tree怎么用?Python Tree.print_tree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tree
的用法示例。
在下文中一共展示了Tree.print_tree方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: checkPerms
# 需要导入模块: import Tree [as 别名]
# 或者: from Tree import print_tree [as 别名]
def checkPerms(target, permissions):
# Login to DCC
s = DCC.login(CF.dcc_url + CF.dcc_login)
if 'Collection' in target:
tr = Tree.get_tree(s,target)
Tree.print_tree(s, tr)
docList = Tree.get_flat_tree(tr)
else:
docList = [target]
printCheckCriteria(target, permissions)
passList = []
failList = []
for doc in docList:
checkFlag = True
if 'Document' in doc:
fd = DCC.prop_get(s, doc, InfoSet = 'DocBasic')
fd['permissions'] = DCC.prop_get(s, doc, InfoSet = 'Perms', Depth = '0')
print("\n\n*** Document Entry", fd['handle'], "***")
print("DCC Name: \"",fd['title'],"\"",sep="")
print("TMT Document Number: ", fd['tmtnum'])
print("https://docushare.tmt.org/docushare/dsweb/ServicesLib/" + fd['handle'] + "/view")
elif 'Collection' in doc:
fd = DCC.prop_get(s, doc, InfoSet = 'CollData')
fd['permissions'] = DCC.prop_get(s, doc, InfoSet = 'Perms', Depth = '0')
print("\n\n*** Collection Entry", fd['handle'], "***")
print("https://docushare.tmt.org/docushare/dsweb/ServicesLib/" + fd['handle'] + "/view")
else:
checkFlag = False
print("\nNot checking permissions on object that is not a Collection or Document):",doc)
if checkFlag:
OkayPerms = []
for perm in sorted(fd["permissions"]["perms"], key = lambda x: x["handle"]):
# Go through each set and create a dictionary of entries that have perms okay
for sets in permissions:
for item,plist in sets.items():
if perm["handle"] == item:
if printCheckPerms(perm,plist) == True:
OkayPerms.append(item)
permFlag = False
for sets in permissions:
testFlag = True
for item in sets:
if not item in OkayPerms:
testFlag = False
if testFlag == True:
permFlag = True
if permFlag == True:
print("*** PERMISSIONS MEET CRITERIA ***")
passList.append(doc)
else:
print("!!! PERMISSIONS DO NOT MEET CRITERIA !!!")
failList.append(doc)
return([passList,failList])
示例2: create_DCC_mirror
# 需要导入模块: import Tree [as 别名]
# 或者: from Tree import print_tree [as 别名]
def create_DCC_mirror(s, dcc_handle, dirpath, **kwargs):
tr = Tree.get_tree(s,dcc_handle)
Tree.print_tree(s, tr)
docList = Tree.get_flat_tree(tr)
traverse(s, tr, tr['root']['collections'][0], dirpath, **kwargs)