當前位置: 首頁>>代碼示例>>Python>>正文


Python Util.debugging方法代碼示例

本文整理匯總了Python中hgu.Util.debugging方法的典型用法代碼示例。如果您正苦於以下問題:Python Util.debugging方法的具體用法?Python Util.debugging怎麽用?Python Util.debugging使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在hgu.Util的用法示例。


在下文中一共展示了Util.debugging方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _processNode

# 需要導入模塊: from hgu import Util [as 別名]
# 或者: from hgu.Util import debugging [as 別名]
def _processNode(node, parentApo, rank, depth, isPrimaryPath):
    """
    Generate part of records for an anatomy node, and all its children.
    """

    if Util.debugging():
        Util.debugMessage([
            "In _processnode.",
            "Node: " + node.getPublicId() + " '" +
            node.getComponentName() + "'",
            "Rank: " + str(rank) + "  Depth: " + str(depth)])

    # Generate record for this node.
    anatApo = AnadPartOfDb.AnadPartOfDbRecord()
    anatApo.setOid(rank)
    anatApo.setSpecies(node.getSpecies())
    anatApo.setNodeOid(node.getOid())
    anatApo.setSequence(rank)
    anatApo.setDepth(depth)
    anatApo.setIsPrimaryPath(isPrimaryPath)

    # Gather stage range of anatomy node
    nodeStartStage, nodeEndStage = Nodes.getStageWindowForNodeOid(node.getOid())
    StartStage = Stages.getByOid(nodeStartStage.getOid())
    EndStage = Stages.getByOid(nodeEndStage.getOid())

    if parentApo != None:
        anatApo.setParentApoOid(parentApo.getOid())
        anatApo.setFullPath(parentApo.getFullPath() + "." +
                            node.getComponentName())
        anatApo.setFullPathOids(parentApo.getFullPathOids() + "." +
                            str(node.getOid()))
        anatApo.setFullPathEmapas(parentApo.getFullPathEmapas() + "." +
                            str(node.getPublicId()))
        anatApo.setFullPathJsonHead(parentApo.getFullPathJsonHead() + 
                                '{\"attr\": { \"ext_id\": \"' + node.getPublicId() + 
                                '\", \"id\": \"li.node.BRANCH.Abstract.id' + str(node.getOid()) + 
                                '\", \"name\": \"' + node.getComponentName() + 
                                '\", \"start\": \"' + StartStage.getName() +
                                '\", \"end\": \"' + EndStage.getName() +
                                '\"}, \"data\": \"' + node.getComponentName() + 
                                '\", \"state\": \"open\", \"children\": [')
        anatApo.setFullPathJsonTail(parentApo.getFullPathJsonTail() + ']}')
    else:
        anatApo.setFullPath(node.getComponentName())
        anatApo.setFullPathOids(str(node.getOid()))
        anatApo.setFullPathEmapas(str(node.getPublicId()))
        anatApo.setFullPathJsonHead(
                                '{\"attr\": { \"ext_id\": \"' + node.getPublicId() + 
                                '\", \"id\": \"li.node.BRANCH.Abstract.id' + str(node.getOid()) + 
                                '\", \"name\": \"' + node.getComponentName() + 
                                '\", \"start\": \"' + StartStage.getName() +
                                '\", \"end\": \"' + EndStage.getName() +
                                '\"}, \"data\": \"' + node.getComponentName() + 
                                '\", \"state\": \"open\", \"children\": [')
        anatApo.setFullPathJsonTail(']}')

        
    # Gather stage range of anatomy node
    anatApo.setNodeStartStageOid(nodeStartStage.getOid())
    anatApo.setNodeEndStageOid(nodeEndStage.getOid())

    # Path start and end stages may be narrower than node start and
    # end stages.  Used to reason about what parts of the tree to display
    # for what stages.
    pathStartStage = nodeStartStage
    pathEndStage   = nodeEndStage
    
    if parentApo:
        parentPathStartStage = Stages.getByOid(parentApo.getPathStartStageOid())
        parentPathEndStage   = Stages.getByOid(parentApo.getPathEndStageOid())
    
        if pathStartStage.getSequence() < parentPathStartStage.getSequence():
            pathStartStage = parentPathStartStage
        
        if pathEndStage.getSequence() > parentPathEndStage.getSequence():
            pathEndStage = parentPathEndStage
    
    anatApo.setPathStartStageOid(pathStartStage.getOid())
    anatApo.setPathEndStageOid(pathEndStage.getOid())

    if pathStartStage.getSequence() > pathEndStage.getSequence():
        Util.fatalError(["Bad path stage range"])

    # part of record fully populated.  Add it to database and to this module's
    # knowledge base.
    anatApo.insert()
    _addToKnowledge(anatApo, deferReverse = True)
    # Other globals populated after everything has been created.

    rank += 1

    # Generate records, recursively, depth first, left to right, for all
    # its children.
    childIsPrimary = isPrimaryPath and node.isPrimary()
    childRels = Relationships.getByParentOid(node.getOid())
    
    for childRel in childRels:
        childOid = childRel.getChildOid()
        
#.........這裏部分代碼省略.........
開發者ID:ma-tech,項目名稱:Anatomy,代碼行數:103,代碼來源:PartOfs.py


注:本文中的hgu.Util.debugging方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。